Commit cd6c34f1 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

be: Factorise code to initialise emitters.

All backends emit nothing for Phis and be_Keeps, so set this centrally.
parent 3e20b1bd
......@@ -207,8 +207,7 @@ static void emit_Return(const ir_node *node)
*/
static void TEMPLATE_register_emitters(void)
{
/* first clear the generic function pointer for all ops */
ir_clear_opcodes_generic_func();
be_init_emitters();
/* register all emitter functions defined in spec */
TEMPLATE_register_spec_emitters();
......@@ -218,10 +217,6 @@ static void TEMPLATE_register_emitters(void)
be_set_emitter(op_be_IncSP, emit_be_IncSP);
be_set_emitter(op_Return, emit_Return);
be_set_emitter(op_Start, emit_Start);
/* no need to emit anything for the following nodes */
be_set_emitter(op_Phi, be_emit_nothing);
be_set_emitter(op_be_Keep, be_emit_nothing);
}
/**
......
......@@ -737,8 +737,7 @@ static void emit_amd64_Return(const ir_node *node)
*/
static void amd64_register_emitters(void)
{
/* first clear the generic function pointer for all ops */
ir_clear_opcodes_generic_func();
be_init_emitters();
/* register all emitter functions defined in spec */
amd64_register_spec_emitters();
......@@ -752,9 +751,7 @@ static void amd64_register_emitters(void)
be_set_emitter(op_be_Copy, emit_be_Copy);
be_set_emitter(op_be_CopyKeep, emit_be_Copy);
be_set_emitter(op_be_IncSP, emit_be_IncSP);
be_set_emitter(op_be_Keep, be_emit_nothing);
be_set_emitter(op_be_Perm, emit_be_Perm);
be_set_emitter(op_Phi, be_emit_nothing);
}
/**
......
......@@ -678,8 +678,7 @@ static void emit_arm_Jmp(const ir_node *node)
*/
static void arm_register_emitters(void)
{
/* first clear the generic function pointer for all ops */
ir_clear_opcodes_generic_func();
be_init_emitters();
/* register all emitter functions defined in spec */
arm_register_spec_emitters();
......@@ -696,10 +695,8 @@ static void arm_register_emitters(void)
be_set_emitter(op_be_Copy, emit_be_Copy);
be_set_emitter(op_be_CopyKeep, emit_be_Copy);
be_set_emitter(op_be_IncSP, emit_be_IncSP);
be_set_emitter(op_be_Keep, be_emit_nothing);
be_set_emitter(op_be_MemPerm, emit_be_MemPerm);
be_set_emitter(op_be_Perm, emit_be_Perm);
be_set_emitter(op_Phi, be_emit_nothing);
}
/**
......
......@@ -11,6 +11,7 @@
*/
#include "bedwarf.h"
#include "beemitter.h"
#include "benode.h"
#include "be_t.h"
#include "panic.h"
#include "irnode_t.h"
......@@ -81,6 +82,13 @@ void be_emit_finish_line_gas(const ir_node *node)
be_emit_write_line();
}
void be_init_emitters(void)
{
ir_clear_opcodes_generic_func();
be_set_emitter(op_Phi, be_emit_nothing);
be_set_emitter(op_be_Keep, be_emit_nothing);
}
void be_emit_nothing(ir_node const *const node)
{
(void)node;
......
......@@ -117,6 +117,8 @@ static inline void be_set_emitter(ir_op *const op, emit_func *const func)
set_generic_function_ptr(op, func);
}
void be_init_emitters(void);
void be_emit_nothing(ir_node const *node);
/**
......
......@@ -1356,8 +1356,7 @@ static void emit_ia32_Return(const ir_node *node)
*/
static void ia32_register_emitters(void)
{
/* first clear the generic function pointer for all ops */
ir_clear_opcodes_generic_func();
be_init_emitters();
/* register all emitter functions defined in spec */
ia32_register_spec_emitters();
......@@ -1365,7 +1364,6 @@ static void ia32_register_emitters(void)
be_set_emitter(op_be_Copy, emit_be_Copy);
be_set_emitter(op_be_CopyKeep, emit_be_CopyKeep);
be_set_emitter(op_be_IncSP, emit_be_IncSP);
be_set_emitter(op_be_Keep, be_emit_nothing);
be_set_emitter(op_be_Perm, emit_be_Perm);
be_set_emitter(op_ia32_Return, emit_ia32_Return);
be_set_emitter(op_ia32_Start, be_emit_nothing);
......@@ -1384,7 +1382,6 @@ static void ia32_register_emitters(void)
be_set_emitter(op_ia32_Minus64, emit_ia32_Minus64);
be_set_emitter(op_ia32_Setcc, emit_ia32_Setcc);
be_set_emitter(op_ia32_SwitchJmp, emit_ia32_SwitchJmp);
be_set_emitter(op_Phi, be_emit_nothing);
}
/**
......@@ -3330,11 +3327,9 @@ static void ia32_register_binary_emitters(void)
be_set_emitter(op_ia32_fxch, bemit_fxch);
/* ignore the following nodes */
be_set_emitter(op_be_Keep, be_emit_nothing);
be_set_emitter(op_ia32_ProduceVal, be_emit_nothing);
be_set_emitter(op_ia32_Start, be_emit_nothing);
be_set_emitter(op_ia32_Unknown, be_emit_nothing);
be_set_emitter(op_Phi, be_emit_nothing);
}
static void gen_binary_block(ir_node *block)
......
......@@ -1354,8 +1354,8 @@ static void emit_be_Copy(const ir_node *node)
*/
static void sparc_register_emitters(void)
{
/* first clear the generic function pointer for all ops */
ir_clear_opcodes_generic_func();
be_init_emitters();
/* register all emitter functions defined in spec */
sparc_register_spec_emitters();
......@@ -1380,8 +1380,6 @@ static void sparc_register_emitters(void)
be_set_emitter(op_sparc_fbfcc, emit_sparc_fbfcc);
/* no need to emit anything for the following nodes */
be_set_emitter(op_Phi, be_emit_nothing);
be_set_emitter(op_be_Keep, be_emit_nothing);
be_set_emitter(op_sparc_Start, be_emit_nothing);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment