rl78.c (rl78_devirt_pass): Convert from a struct to...

2013-08-07  David Malcolm  <dmalcolm@redhat.com>

	* config/rl78/rl78.c (rl78_devirt_pass): Convert from a struct to...
	(pass_rl78_devirt): ...new subclass of rtl_opt_pass along with...
	(pass_data_rl78_devirt): ...new pass_data instance and...
	(make_pass_rl78_devirt): ...new function.
	(rl78_asm_file_start): Port pass registration to new C++ API.

From-SVN: r201553
This commit is contained in:
David Malcolm 2013-08-07 01:50:43 +00:00 committed by David Malcolm
parent d0cd816041
commit 03085d1cf9
2 changed files with 51 additions and 18 deletions

View File

@ -1,3 +1,11 @@
2013-08-07 David Malcolm <dmalcolm@redhat.com>
* config/rl78/rl78.c (rl78_devirt_pass): Convert from a struct to...
(pass_rl78_devirt): ...new subclass of rtl_opt_pass along with...
(pass_data_rl78_devirt): ...new pass_data instance and...
(make_pass_rl78_devirt): ...new function.
(rl78_asm_file_start): Port pass registration to new C++ API.
2013-08-07 David Malcolm <dmalcolm@redhat.com> 2013-08-07 David Malcolm <dmalcolm@redhat.com>
* coretypes.h (rtl_opt_pass): Add. * coretypes.h (rtl_opt_pass): Add.

View File

@ -49,6 +49,7 @@
#include "rl78-protos.h" #include "rl78-protos.h"
#include "dumpfile.h" #include "dumpfile.h"
#include "tree-pass.h" #include "tree-pass.h"
#include "context.h"
static inline bool is_interrupt_func (const_tree decl); static inline bool is_interrupt_func (const_tree decl);
static inline bool is_brk_interrupt_func (const_tree decl); static inline bool is_brk_interrupt_func (const_tree decl);
@ -129,30 +130,45 @@ devirt_pass (void)
/* This pass converts virtual instructions using virtual registers, to /* This pass converts virtual instructions using virtual registers, to
real instructions using real registers. Rather than run it as real instructions using real registers. Rather than run it as
reorg, we reschedule it before vartrack to help with debugging. */ reorg, we reschedule it before vartrack to help with debugging. */
static struct opt_pass rl78_devirt_pass = namespace {
const pass_data pass_data_rl78_devirt =
{ {
RTL_PASS, RTL_PASS, /* type */
"devirt", "devirt", /* name */
OPTGROUP_NONE, /* optinfo_flags */ OPTGROUP_NONE, /* optinfo_flags */
devirt_gate, true, /* has_gate */
devirt_pass, true, /* has_execute */
NULL, TV_MACH_DEP, /* tv_id */
NULL, 0, /* properties_required */
212, 0, /* properties_provided */
TV_MACH_DEP, 0, /* properties_destroyed */
0, 0, 0, 0, /* todo_flags_start */
0, 0, /* todo_flags_finish */
0
}; };
static struct register_pass_info rl78_devirt_info = class pass_rl78_devirt : public rtl_opt_pass
{ {
& rl78_devirt_pass, public:
"vartrack", pass_rl78_devirt(gcc::context *ctxt)
1, : rtl_opt_pass(pass_data_rl78_devirt, ctxt)
PASS_POS_INSERT_BEFORE {
}
/* opt_pass methods: */
bool gate () { return devirt_gate (); }
unsigned int execute () { return devirt_pass (); }
}; };
} // anon namespace
rtl_opt_pass *
make_pass_rl78_devirt (gcc::context *ctxt)
{
return new pass_rl78_devirt (ctxt);
}
#undef TARGET_ASM_FILE_START #undef TARGET_ASM_FILE_START
#define TARGET_ASM_FILE_START rl78_asm_file_start #define TARGET_ASM_FILE_START rl78_asm_file_start
@ -167,6 +183,15 @@ rl78_asm_file_start (void)
fprintf (asm_out_file, "r%d\t=\t0x%x\n", 16 + i, 0xffee8 + i); fprintf (asm_out_file, "r%d\t=\t0x%x\n", 16 + i, 0xffee8 + i);
} }
opt_pass *rl78_devirt_pass = make_pass_rl78_devirt (g);
struct register_pass_info rl78_devirt_info =
{
rl78_devirt_pass,
"vartrack",
1,
PASS_POS_INSERT_BEFORE
};
register_pass (& rl78_devirt_info); register_pass (& rl78_devirt_info);
} }