1 /* Plugin that prints message if it inserted (and invoked) more than once. */
3 #include "gcc-plugin.h"
9 #include "pointer-set.h"
10 #include "hash-table.h"
13 #include "basic-block.h"
14 #include "tree-ssa-alias.h"
15 #include "internal-fn.h"
16 #include "gimple-fold.h"
18 #include "gimple-expr.h"
21 #include "tree-pass.h"
25 int plugin_is_GPL_compatible
;
29 const pass_data pass_data_one_pass
=
31 GIMPLE_PASS
, /* type */
33 OPTGROUP_NONE
, /* optinfo_flags */
35 true, /* has_execute */
37 PROP_gimple_any
, /* properties_required */
38 0, /* properties_provided */
39 0, /* properties_destroyed */
40 0, /* todo_flags_start */
41 0, /* todo_flags_finish */
44 class one_pass
: public gimple_opt_pass
47 one_pass(gcc::context
*ctxt
)
48 : gimple_opt_pass(pass_data_one_pass
, ctxt
),
52 /* opt_pass methods: */
54 unsigned int execute ();
62 bool one_pass::gate (void)
67 unsigned int one_pass::execute ()
70 printf ("Executed more than once \n");
77 make_one_pass (gcc::context
*ctxt
)
79 return new one_pass (ctxt
);
83 int plugin_init (struct plugin_name_args
*plugin_info
,
84 struct plugin_gcc_version
*version
)
86 struct register_pass_info p
;
88 p
.pass
= make_one_pass (g
);
89 p
.reference_pass_name
= "cfg";
90 p
.ref_pass_instance_number
= 1;
91 p
.pos_op
= PASS_POS_INSERT_AFTER
;
93 register_callback ("one_pass", PLUGIN_PASS_MANAGER_SETUP
, NULL
, &p
);