1 /* Plugin that prints message if it inserted (and invoked) more than once. */
3 #include "gcc-plugin.h"
9 #include "hash-table.h"
12 #include "basic-block.h"
13 #include "tree-ssa-alias.h"
14 #include "internal-fn.h"
15 #include "gimple-fold.h"
17 #include "gimple-expr.h"
20 #include "tree-pass.h"
24 int plugin_is_GPL_compatible
;
28 const pass_data pass_data_one_pass
=
30 GIMPLE_PASS
, /* type */
32 OPTGROUP_NONE
, /* optinfo_flags */
34 PROP_gimple_any
, /* properties_required */
35 0, /* properties_provided */
36 0, /* properties_destroyed */
37 0, /* todo_flags_start */
38 0, /* todo_flags_finish */
41 class one_pass
: public gimple_opt_pass
44 one_pass(gcc::context
*ctxt
)
45 : gimple_opt_pass(pass_data_one_pass
, ctxt
),
49 /* opt_pass methods: */
50 virtual bool gate (function
*);
51 virtual unsigned int execute (function
*);
59 bool one_pass::gate (function
*)
65 one_pass::execute (function
*)
68 printf ("Executed more than once \n");
75 make_one_pass (gcc::context
*ctxt
)
77 return new one_pass (ctxt
);
81 int plugin_init (struct plugin_name_args
*plugin_info
,
82 struct plugin_gcc_version
*version
)
84 struct register_pass_info p
;
86 p
.pass
= make_one_pass (g
);
87 p
.reference_pass_name
= "cfg";
88 p
.ref_pass_instance_number
= 1;
89 p
.pos_op
= PASS_POS_INSERT_AFTER
;
91 register_callback ("one_pass", PLUGIN_PASS_MANAGER_SETUP
, NULL
, &p
);