diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/plugin/selfassign.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/plugin/selfassign.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c index 041f25dce34..4dad0c28817 100644 --- a/gcc/testsuite/gcc.dg/plugin/selfassign.c +++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c @@ -253,31 +253,6 @@ warn_self_assign (gimple stmt) } } -/* Entry point for the self-assignment detection pass. */ - -static unsigned int -execute_warn_self_assign (void) -{ - gimple_stmt_iterator gsi; - basic_block bb; - - FOR_EACH_BB_FN (bb, cfun) - { - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - warn_self_assign (gsi_stmt (gsi)); - } - - return 0; -} - -/* Pass gate function. Currently always returns true. */ - -static bool -gate_warn_self_assign (void) -{ - return true; -} - namespace { const pass_data pass_data_warn_self_assign = @@ -285,7 +260,6 @@ const pass_data pass_data_warn_self_assign = GIMPLE_PASS, /* type */ "warn_self_assign", /* name */ OPTGROUP_NONE, /* optinfo_flags */ - true, /* has_gate */ true, /* has_execute */ TV_NONE, /* tv_id */ PROP_ssa, /* properties_required */ @@ -303,11 +277,25 @@ public: {} /* opt_pass methods: */ - bool gate () { return gate_warn_self_assign (); } - unsigned int execute () { return execute_warn_self_assign (); } + virtual unsigned int execute (function *); }; // class pass_warn_self_assign +unsigned int +pass_warn_self_assign::execute (function *fun) +{ + gimple_stmt_iterator gsi; + basic_block bb; + + FOR_EACH_BB_FN (bb, fun) + { + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + warn_self_assign (gsi_stmt (gsi)); + } + + return 0; +} + } // anon namespace static gimple_opt_pass * |