summaryrefslogtreecommitdiff
path: root/gcc/tracer.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tracer.c')
-rw-r--r--gcc/tracer.c72
1 files changed, 33 insertions, 39 deletions
diff --git a/gcc/tracer.c b/gcc/tracer.c
index f036c193b57..09a8f40c7f5 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -367,43 +367,7 @@ tail_duplicate (void)
return changed;
}
-
-/* Main entry point to this file. */
-
-static unsigned int
-tracer (void)
-{
- bool changed;
-
- if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1)
- return 0;
-
- mark_dfs_back_edges ();
- if (dump_file)
- brief_dump_cfg (dump_file, dump_flags);
-
- /* Trace formation is done on the fly inside tail_duplicate */
- changed = tail_duplicate ();
- if (changed)
- {
- free_dominance_info (CDI_DOMINATORS);
- /* If we changed the CFG schedule loops for fixup by cleanup_cfg. */
- if (current_loops)
- loops_state_set (LOOPS_NEED_FIXUP);
- }
-
- if (dump_file)
- brief_dump_cfg (dump_file, dump_flags);
-
- return changed ? TODO_cleanup_cfg : 0;
-}
-static bool
-gate_tracer (void)
-{
- return (optimize > 0 && flag_tracer && flag_reorder_blocks);
-}
-
namespace {
const pass_data pass_data_tracer =
@@ -411,7 +375,6 @@ const pass_data pass_data_tracer =
GIMPLE_PASS, /* type */
"tracer", /* name */
OPTGROUP_NONE, /* optinfo_flags */
- true, /* has_gate */
true, /* has_execute */
TV_TRACER, /* tv_id */
0, /* properties_required */
@@ -429,11 +392,42 @@ public:
{}
/* opt_pass methods: */
- bool gate () { return gate_tracer (); }
- unsigned int execute () { return tracer (); }
+ virtual bool gate (function *)
+ {
+ return (optimize > 0 && flag_tracer && flag_reorder_blocks);
+ }
+
+ virtual unsigned int execute (function *);
}; // class pass_tracer
+unsigned int
+pass_tracer::execute (function *fun)
+{
+ bool changed;
+
+ if (n_basic_blocks_for_fn (fun) <= NUM_FIXED_BLOCKS + 1)
+ return 0;
+
+ mark_dfs_back_edges ();
+ if (dump_file)
+ brief_dump_cfg (dump_file, dump_flags);
+
+ /* Trace formation is done on the fly inside tail_duplicate */
+ changed = tail_duplicate ();
+ if (changed)
+ {
+ free_dominance_info (CDI_DOMINATORS);
+ /* If we changed the CFG schedule loops for fixup by cleanup_cfg. */
+ if (current_loops)
+ loops_state_set (LOOPS_NEED_FIXUP);
+ }
+
+ if (dump_file)
+ brief_dump_cfg (dump_file, dump_flags);
+
+ return changed ? TODO_cleanup_cfg : 0;
+}
} // anon namespace
gimple_opt_pass *