1 /* Plugin that prints message if it inserted (and invoked) more than once. */
3 #include "gcc-plugin.h"
10 #include "tree-pass.h"
14 int plugin_is_GPL_compatible
;
18 const pass_data pass_data_one_pass
=
20 GIMPLE_PASS
, /* type */
22 OPTGROUP_NONE
, /* optinfo_flags */
24 true, /* has_execute */
26 PROP_gimple_any
, /* properties_required */
27 0, /* properties_provided */
28 0, /* properties_destroyed */
29 0, /* todo_flags_start */
30 0, /* todo_flags_finish */
33 class one_pass
: public gimple_opt_pass
36 one_pass(gcc::context
*ctxt
)
37 : gimple_opt_pass(pass_data_one_pass
, ctxt
),
41 /* opt_pass methods: */
43 unsigned int execute ();
51 bool one_pass::gate (void)
56 unsigned int one_pass::execute ()
59 printf ("Executed more than once \n");
66 make_one_pass (gcc::context
*ctxt
)
68 return new one_pass (ctxt
);
72 int plugin_init (struct plugin_name_args
*plugin_info
,
73 struct plugin_gcc_version
*version
)
75 struct register_pass_info p
;
77 p
.pass
= make_one_pass (g
);
78 p
.reference_pass_name
= "cfg";
79 p
.ref_pass_instance_number
= 1;
80 p
.pos_op
= PASS_POS_INSERT_AFTER
;
82 register_callback ("one_pass", PLUGIN_PASS_MANAGER_SETUP
, NULL
, &p
);