aboutsummaryrefslogtreecommitdiff
path: root/gcc/passes.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/passes.cc')
-rw-r--r--gcc/passes.cc63
1 files changed, 26 insertions, 37 deletions
diff --git a/gcc/passes.cc b/gcc/passes.cc
index 3c28db7..a33c8d9 100644
--- a/gcc/passes.cc
+++ b/gcc/passes.cc
@@ -64,6 +64,9 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "attribs.h"
+/* Reserved TODOs */
+#define TODO_verify_il (1u << 31)
+
using namespace gcc;
/* This is used for debugging. It allows the current pass to printed
@@ -116,14 +119,14 @@ opt_pass::opt_pass (const pass_data &data, context *ctxt)
void
pass_manager::execute_early_local_passes ()
{
- execute_pass_list (cfun, pass_build_ssa_passes_1->sub);
- execute_pass_list (cfun, pass_local_optimization_passes_1->sub);
+ execute_pass_list (cfun, m_pass_build_ssa_passes_1->sub);
+ execute_pass_list (cfun, m_pass_local_optimization_passes_1->sub);
}
unsigned int
pass_manager::execute_pass_mode_switching ()
{
- return pass_mode_switching_1->execute (cfun);
+ return m_pass_mode_switching_1->execute (cfun);
}
@@ -352,13 +355,6 @@ finish_optimization_passes (void)
gcc::dump_manager *dumps = m_ctxt->get_dumps ();
timevar_push (TV_DUMP);
- if (coverage_instrumentation_p () || flag_test_coverage
- || flag_branch_probabilities)
- {
- dumps->dump_start (pass_profile_1->static_pass_number, NULL);
- end_branch_prob ();
- dumps->dump_finish (pass_profile_1->static_pass_number);
- }
/* Do whatever is necessary to finish printing the graphs. */
for (i = TDI_end; (dfi = dumps->get_dump_file_info (i)) != NULL; ++i)
@@ -1587,7 +1583,7 @@ pass_manager::pass_manager (context *ctxt)
#define INSERT_PASSES_AFTER(PASS)
#define PUSH_INSERT_PASSES_WITHIN(PASS, NUM)
#define POP_INSERT_PASSES()
-#define NEXT_PASS(PASS, NUM) PASS ## _ ## NUM = NULL
+#define NEXT_PASS(PASS, NUM) m_ ## PASS ## _ ## NUM = NULL
#define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...) NEXT_PASS (PASS, NUM)
#define TERMINATE_PASS_LIST(PASS)
@@ -1612,28 +1608,28 @@ pass_manager::pass_manager (context *ctxt)
#define PUSH_INSERT_PASSES_WITHIN(PASS, NUM) \
{ \
- opt_pass **p = &(PASS ## _ ## NUM)->sub;
+ opt_pass **p = &(m_ ## PASS ## _ ## NUM)->sub;
#define POP_INSERT_PASSES() \
}
#define NEXT_PASS(PASS, NUM) \
do { \
- gcc_assert (PASS ## _ ## NUM == NULL); \
+ gcc_assert (m_ ## PASS ## _ ## NUM == NULL); \
if ((NUM) == 1) \
- PASS ## _1 = make_##PASS (m_ctxt); \
+ m_ ## PASS ## _1 = make_##PASS (m_ctxt); \
else \
{ \
- gcc_assert (PASS ## _1); \
- PASS ## _ ## NUM = PASS ## _1->clone (); \
+ gcc_assert (m_ ## PASS ## _1); \
+ m_ ## PASS ## _ ## NUM = m_ ## PASS ## _1->clone (); \
} \
- p = next_pass_1 (p, PASS ## _ ## NUM, PASS ## _1); \
+ p = next_pass_1 (p, m_ ## PASS ## _ ## NUM, m_ ## PASS ## _1); \
} while (0)
#define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) \
do { \
NEXT_PASS (PASS, NUM); \
- PASS ## _ ## NUM->set_pass_param (0, ARG); \
+ m_ ## PASS ## _ ## NUM->set_pass_param (0, ARG); \
} while (0)
#define NEXT_PASS_WITH_ARGS(PASS, NUM, ...) \
@@ -1643,7 +1639,7 @@ pass_manager::pass_manager (context *ctxt)
unsigned i = 0; \
for (bool value : values) \
{ \
- PASS ## _ ## NUM->set_pass_param (i, value); \
+ m_ ## PASS ## _ ## NUM->set_pass_param (i, value); \
i++; \
} \
} while (0)
@@ -2020,7 +2016,7 @@ pass_manager::dump_profile_report () const
fprintf (dump_file, " ");
/* Size/time units change across gimple and RTL. */
- if (i == pass_expand_1->static_pass_number)
+ if (i == m_pass_expand_1->static_pass_number)
fprintf (dump_file,
"|-------------------|--------------------------");
else
@@ -2032,8 +2028,9 @@ pass_manager::dump_profile_report () const
fprintf (dump_file, " ");
fprintf (dump_file, "| %12.0f", profile_record[i].time);
/* Time units changes with profile estimate and feedback. */
- if (i == pass_profile_1->static_pass_number
- || i == pass_ipa_tree_profile_1->static_pass_number)
+ if (i == m_pass_profile_1->static_pass_number
+ || i == m_pass_ipa_auto_profile_1->static_pass_number
+ || i == m_pass_ipa_tree_profile_1->static_pass_number)
fprintf (dump_file, "-------------");
else if (rel_time_change)
fprintf (dump_file, " %+11.1f%%", rel_time_change);
@@ -2059,7 +2056,6 @@ execute_function_todo (function *fn, void *data)
{
bool from_ipa_pass = (cfun == NULL);
unsigned int flags = (size_t)data;
- flags &= ~fn->last_verified;
if (!flags)
return;
@@ -2127,8 +2123,6 @@ execute_function_todo (function *fn, void *data)
gcc_assert (dom_info_state (fn, CDI_POST_DOMINATORS) == pre_verify_pstate);
}
- fn->last_verified = flags & TODO_verify_all;
-
pop_cfun ();
/* For IPA passes make sure to release dominator info, it can be
@@ -2193,14 +2187,6 @@ verify_interpass_invariants (void)
gcc_checking_assert (!fold_deferring_overflow_warnings_p ());
}
-/* Clear the last verified flag. */
-
-static void
-clear_last_verified (function *fn, void *data ATTRIBUTE_UNUSED)
-{
- fn->last_verified = 0;
-}
-
/* Helper function. Verify that the properties has been turn into the
properties expected by the pass. */
@@ -2339,13 +2325,15 @@ execute_one_ipa_transform_pass (struct cgraph_node *node,
if (pass->tv_id != TV_NONE)
timevar_push (pass->tv_id);
+ gcc_checking_assert (!(ipa_pass->function_transform_todo_flags_start & TODO_verify_il));
/* Run pre-pass verification. */
execute_todo (ipa_pass->function_transform_todo_flags_start);
/* Do it! */
todo_after = ipa_pass->function_transform (node);
- /* Run post-pass cleanup and verification. */
+ /* Run post-pass cleanup. */
+ gcc_checking_assert (!(todo_after & TODO_verify_il));
execute_todo (todo_after);
verify_interpass_invariants ();
@@ -2391,7 +2379,7 @@ execute_all_ipa_transforms (bool do_not_collect)
for (auto p : node->ipa_transforms_to_apply)
{
- /* To get consistent statistics, we need to account each functio
+ /* To get consistent statistics, we need to account each function
to each IPA pass. */
if (report)
{
@@ -2649,6 +2637,7 @@ execute_one_pass (opt_pass *pass)
/* Run pre-pass verification. */
+ gcc_checking_assert (!(pass->todo_flags_start & TODO_verify_il));
execute_todo (pass->todo_flags_start);
if (flag_checking)
@@ -2697,11 +2686,11 @@ execute_one_pass (opt_pass *pass)
return true;
}
- do_per_function (clear_last_verified, NULL);
-
do_per_function (update_properties_after_pass, pass);
/* Run post-pass cleanup and verification. */
+ gcc_checking_assert (!(todo_after & TODO_verify_il));
+ gcc_checking_assert (!(pass->todo_flags_finish & TODO_verify_il));
execute_todo (todo_after | pass->todo_flags_finish | TODO_verify_il);
if (profile_report)
{