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"
16 #include "gimple-expr.h"
19 #include "tree-pass.h"
23 int plugin_is_GPL_compatible
;
27 const pass_data pass_data_one_pass
=
29 GIMPLE_PASS
, /* type */
31 OPTGROUP_NONE
, /* optinfo_flags */
33 PROP_gimple_any
, /* properties_required */
34 0, /* properties_provided */
35 0, /* properties_destroyed */
36 0, /* todo_flags_start */
37 0, /* todo_flags_finish */
40 class one_pass
: public gimple_opt_pass
43 one_pass(gcc::context
*ctxt
)
44 : gimple_opt_pass(pass_data_one_pass
, ctxt
),
48 /* opt_pass methods: */
49 virtual bool gate (function
*);
50 virtual unsigned int execute (function
*);
58 bool one_pass::gate (function
*)
64 one_pass::execute (function
*)
67 printf ("Executed more than once \n");
74 make_one_pass (gcc::context
*ctxt
)
76 return new one_pass (ctxt
);
80 int plugin_init (struct plugin_name_args
*plugin_info
,
81 struct plugin_gcc_version
*version
)
83 struct register_pass_info p
;
85 p
.pass
= make_one_pass (g
);
86 p
.reference_pass_name
= "cfg";
87 p
.ref_pass_instance_number
= 1;
88 p
.pos_op
= PASS_POS_INSERT_AFTER
;
90 register_callback ("one_pass", PLUGIN_PASS_MANAGER_SETUP
, NULL
, &p
);