* [PATCH] Add pass parameter to TERMINATE_PASS_LIST
@ 2015-12-11 10:59 Tom de Vries
2015-12-11 20:27 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2015-12-11 10:59 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
Hi,
This patch adds a parameter to TERMINATE_PASS_LIST, that should match
the pass list it's supposed to terminate.
The intention of the patch is that it:
- makes it easier to understand the top-level hierarchy of the pass
list (given that the top-level list may be quite long).
- ensures that INSERT_PASSES_AFTER and TERMINATE_PASS_LIST are paired.
OK for stage3/stage1 trunk, if bootstrap and reg-test succeeds?
Thanks,
- Tom
[-- Attachment #2: 0002-Add-pass-parameter-to-TERMINATE_PASS_LIST.patch --]
[-- Type: text/x-patch, Size: 3918 bytes --]
Add pass parameter to TERMINATE_PASS_LIST
2015-12-11 Tom de Vries <tom@codesourcery.com>
* 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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Add pass parameter to TERMINATE_PASS_LIST
2015-12-11 10:59 [PATCH] Add pass parameter to TERMINATE_PASS_LIST Tom de Vries
@ 2015-12-11 20:27 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2015-12-11 20:27 UTC (permalink / raw)
To: Tom de Vries, gcc-patches
On 12/11/2015 03:59 AM, Tom de Vries wrote:
> Hi,
>
> This patch adds a parameter to TERMINATE_PASS_LIST, that should match
> the pass list it's supposed to terminate.
>
> The intention of the patch is that it:
> - makes it easier to understand the top-level hierarchy of the pass
> list (given that the top-level list may be quite long).
> - ensures that INSERT_PASSES_AFTER and TERMINATE_PASS_LIST are paired.
>
> OK for stage3/stage1 trunk, if bootstrap and reg-test succeeds?
I'd prefer to wait for stage1 on this. It feels like we've got way too
much macro-magic going on in here. I guess as long as we have the
macro-magic in here, verification like this is OK.
Jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-11 20:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11 10:59 [PATCH] Add pass parameter to TERMINATE_PASS_LIST Tom de Vries
2015-12-11 20:27 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).