Add pass parameter to TERMINATE_PASS_LIST 2015-12-11 Tom de Vries * pass_manager.h (TERMINATE_PASS_LIST): Add pass argument. * passes.c (pass_manager::pass_manager): Declare and init p_start in INSERT_PASSES_AFTER. Add pass parameter to TERMINATE_PASS_LIST, and check if it's equal to p_start. * passes.def: Add arguments to TERMINATE_PASS_LISTs. --- gcc/pass_manager.h | 2 +- gcc/passes.c | 14 +++++++++----- gcc/passes.def | 12 ++++++------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h index a8199e2..9340820 100644 --- a/gcc/pass_manager.h +++ b/gcc/pass_manager.h @@ -121,7 +121,7 @@ private: #define POP_INSERT_PASSES() #define NEXT_PASS(PASS, NUM) opt_pass *PASS ## _ ## NUM #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM) -#define TERMINATE_PASS_LIST() +#define TERMINATE_PASS_LIST(PASS) #include "pass-instances.def" diff --git a/gcc/passes.c b/gcc/passes.c index ba9bfc2..4266673 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1555,8 +1555,15 @@ pass_manager::pass_manager (context *ctxt) /* Build the tree of passes. */ -#define INSERT_PASSES_AFTER(PASS) \ - p = &(PASS); +#define INSERT_PASSES_AFTER(PASS) \ + { \ + opt_pass **p_start; \ + p_start = p = &(PASS); + +#define TERMINATE_PASS_LIST(PASS) \ + gcc_assert (p_start == &PASS); \ + *p = NULL; \ + } #define PUSH_INSERT_PASSES_WITHIN(PASS) \ { \ @@ -1584,9 +1591,6 @@ pass_manager::pass_manager (context *ctxt) PASS ## _ ## NUM->set_pass_param (0, ARG); \ } while (0) -#define TERMINATE_PASS_LIST() \ - *p = NULL; - #include "pass-instances.def" #undef INSERT_PASSES_AFTER diff --git a/gcc/passes.def b/gcc/passes.def index 43ce3d5..fde4690 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see PUSH_INSERT_PASSES_WITHIN (PASS) POP_INSERT_PASSES () NEXT_PASS (PASS) - TERMINATE_PASS_LIST () + TERMINATE_PASS_LIST (PASS) */ /* All passes needed to lower the function into shape optimizers can @@ -43,7 +43,7 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_warn_function_return); NEXT_PASS (pass_expand_omp); NEXT_PASS (pass_build_cgraph_edges); - TERMINATE_PASS_LIST () + TERMINATE_PASS_LIST (all_lowering_passes) /* Interprocedural optimization passes. */ INSERT_PASSES_AFTER (all_small_ipa_passes) @@ -134,7 +134,7 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_ipa_increase_alignment); NEXT_PASS (pass_ipa_tm); NEXT_PASS (pass_ipa_lower_emutls); - TERMINATE_PASS_LIST () + TERMINATE_PASS_LIST (all_small_ipa_passes) INSERT_PASSES_AFTER (all_regular_ipa_passes) NEXT_PASS (pass_ipa_whole_program_visibility); @@ -153,7 +153,7 @@ along with GCC; see the file COPYING3. If not see symbols are not allowed outside of the comdat group. Privatizing early would result in missed optimizations due to this restriction. */ NEXT_PASS (pass_ipa_comdats); - TERMINATE_PASS_LIST () + TERMINATE_PASS_LIST (all_regular_ipa_passes) /* Simple IPA passes executed after the regular passes. In WHOPR mode the passes are executed after partitioning and thus see just parts of the @@ -162,7 +162,7 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_ipa_pta); NEXT_PASS (pass_dispatcher_calls); NEXT_PASS (pass_omp_simd_clone); - TERMINATE_PASS_LIST () + TERMINATE_PASS_LIST (all_late_ipa_passes) /* These passes are run after IPA passes on every function that is being output to the assembler file. */ @@ -482,4 +482,4 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_df_finish); POP_INSERT_PASSES () NEXT_PASS (pass_clean_state); - TERMINATE_PASS_LIST () + TERMINATE_PASS_LIST (all_passes)