This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to migrate struct rtl_opt_pass to class for GCC v6.x?
- From: Leslie Zhai <lesliezhai at llvm dot org dot cn>
- To: dmalcolm at redhat dot com
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Thu, 3 Aug 2017 11:24:16 +0800
- Subject: How to migrate struct rtl_opt_pass to class for GCC v6.x?
- Authentication-results: sourceware.org; auth=none
- Feedback-id: bizesmtp:llvm.org.cn:qybgforeign:qybgforeign4
Hi GCC developers,
As ChangeLog-2013 mentioned:
2013-08-05 David Malcolm <dmalcolm@redhat.com>
This is the automated part of the conversion of passes from C
structs to C++ classes.
...
* auto-inc-dec.c (pass_inc_dec): Convert from a global struct to a
subclass of rtl_opt_pass along with...
so I migrate struct rtl_opt_pass:
https://github.com/llvm-mirror/dragonegg/blob/master/src/Backend.cpp#L1731
static struct rtl_opt_pass pass_rtl_emit_function = { {
RTL_PASS, "rtl_emit_function", /* name */
#if (GCC_MINOR > 7)
OPTGROUP_NONE, /* optinfo_flags */
#endif
NULL, /* gate */
rtl_emit_function, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_NONE, /* tv_id */
PROP_ssa | PROP_gimple_leh | PROP_cfg, /* properties_required */
0, /* properties_provided */
PROP_ssa | PROP_trees, /* properties_destroyed */
TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts, /*
todo_flags_start */
TODO_ggc_collect /* todo_flags_finish */
} };
to GCC v6.x C++ classes' style:
https://github.com/xiangzhai/dragonegg/blob/gcc-6_3-branch/src/Backend.cpp#L2072
const pass_data pass_data_rtl_emit_function = {
RTL_PASS, /* type */
"rtl_emit_function", /* name */
OPTGROUP_NONE, /* optinfo_flags */
TV_NONE, /* tv_id */
PROP_ssa | PROP_gimple_leh | PROP_cfg, /* properties_required */
0, /* properties_provided */
PROP_ssa | PROP_trees, /* properties_destroyed */
0, /* todo_flags_start */
0, /* todo_flags_finish */
};
class pass_rtl_emit_function : public rtl_opt_pass {
public:
pass_rtl_emit_function(gcc::context *ctxt)
: rtl_opt_pass(pass_data_rtl_emit_function, ctxt) {}
unsigned int execute(function *) { return rtl_emit_function(); }
opt_pass *clone() { return this; }
};
GCC v4.6 will call the callback `rtl_emit_function`, but GCC v6.x will
not, did I forget something? is there some options need to be set?
please give me some hint, thanks a lot!
PS: GCC v6.x *call* the callback `rtl_emit_function`
https://github.com/xiangzhai/dragonball/blob/master/tests/plugin.cpp#L67
in this testcase, I will check the source code about register_callback,
rtl_opt_pass, and opt_pass.
--
Regards,
Leslie Zhai - a LLVM developer https://reviews.llvm.org/p/xiangzhai/
@