gcc/ChangeLog:
* passes.c: Include "insn-addr.h".
(should_skip_pass_p): Add logging. Update logic for running
"expand" to be compatible with both __GIMPLE and __RTL. Guard
property-provider override so it is only done for gimple passes.
Don't skip dfinit.
(skip_pass): New function.
(execute_one_pass): Call skip_pass when skipping passes.
---
gcc/passes.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 58 insertions(+), 7 deletions(-)
diff --git a/gcc/passes.c b/gcc/passes.c
index 31262ed..6954d1e 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfgrtl.h"
#include "tree-ssa-live.h" /* For remove_unused_locals. */
#include "tree-cfgcleanup.h"
+#include "insn-addr.h" /* for INSN_ADDRESSES_ALLOC. */
using namespace gcc;
@@ -2315,26 +2316,73 @@ should_skip_pass_p (opt_pass *pass)
if (!cfun->pass_startwith)
return false;
- /* We can't skip the lowering phase yet -- ideally we'd
- drive that phase fully via properties. */
- if (!(cfun->curr_properties & PROP_ssa))
- return false;
+ /* For __GIMPLE functions, we have to at least start when we leave
+ SSA. */
+ if (pass->properties_destroyed & PROP_ssa)
+ {
+ if (!quiet_flag)
+ fprintf (stderr, "starting anyway when leaving SSA: %s\n", pass->name);
+ cfun->pass_startwith = NULL;
+ return false;
+ }
if (determine_pass_name_match (pass->name, cfun->pass_startwith))
{
+ if (!quiet_flag)
+ fprintf (stderr, "found starting pass: %s\n", pass->name);
cfun->pass_startwith = NULL;
return false;
}
- /* And also run any property provider. */
- if (pass->properties_provided != 0)
+ /* Run any property provider. */
+ if (pass->type == GIMPLE_PASS
+ && pass->properties_provided != 0)
return false;
+ /* Don't skip df init; later RTL passes need it. */
+ if (strstr (pass->name, "dfinit") != NULL)
+ return false;
+
+ if (!quiet_flag)
+ fprintf (stderr, "skipping pass: %s\n", pass->name);
+
/* If we get here, then we have a "startwith" that we haven't seen yet;
skip the pass. */
return true;
}
+/* Skip the given pass, for handling passes before "startwith"
+ in __GIMPLE and__RTL-marked functions.
+ In theory, this ought to be a no-op, but some of the RTL passes
+ need additional processing here. */
+
+static void
+skip_pass (opt_pass *pass)
+{
+ /* Pass "reload" sets the global "reload_completed", and many
+ things depend on this (e.g. instructions in .md files). */
+ if (strcmp (pass->name, "reload") == 0)
+ reload_completed = 1;
+
+ /* The INSN_ADDRESSES vec is normally set up by
+ shorten_branches; set it up for the benefit of passes that
+ run after this. */
+ if (strcmp (pass->name, "shorten") == 0)
+ INSN_ADDRESSES_ALLOC (get_max_uid ());
+
+ /* Update the cfg hooks as appropriate. */
+ if (strcmp (pass->name, "into_cfglayout") == 0)
+ {
+ cfg_layout_rtl_register_cfg_hooks ();
+ cfun->curr_properties |= PROP_cfglayout;
+ }
+ if (strcmp (pass->name, "outof_cfglayout") == 0)
+ {
+ rtl_register_cfg_hooks ();
+ cfun->curr_properties &= ~PROP_cfglayout;
+ }
+}
+
/* Execute PASS. */
bool
@@ -2375,7 +2423,10 @@ execute_one_pass (opt_pass *pass)
}
if (should_skip_pass_p (pass))
- return true;
+ {
+ skip_pass (pass);
+ return true;
+ }
/* Pass execution event trigger: useful to identify passes being
executed. */
--
1.8.5.3