Commit 715ea9b6 authored by Matthias Braun's avatar Matthias Braun
Browse files

do not put beo_XXX into main firm opcode enum

parent e670329a
......@@ -93,6 +93,7 @@ typedef struct {
ir_entity **out_entities;
} be_memperm_attr_t;
static unsigned be_opcode_start;
ir_op *op_be_Spill;
ir_op *op_be_Reload;
ir_op *op_be_Perm;
......@@ -108,6 +109,8 @@ ir_op *op_be_SubSP;
ir_op *op_be_Start;
ir_op *op_be_FrameAddr;
#define be_op_tag FOURCC('B', 'E', '\0', '\0')
/**
* Compare the attributes of two be_FrameAddr nodes.
*
......@@ -746,14 +749,7 @@ void be_set_CopyKeep_op(ir_node *cpy, ir_node *op)
static bool be_has_frame_entity(const ir_node *irn)
{
switch (get_irn_opcode(irn)) {
case beo_Spill:
case beo_Reload:
case beo_FrameAddr:
return true;
default:
return false;
}
return be_is_Spill(irn) || be_is_Reload(irn) || be_is_FrameAddr(irn);
}
ir_entity *be_get_frame_entity(const ir_node *irn)
......@@ -1164,7 +1160,7 @@ static void dump_node(FILE *f, const ir_node *irn, dump_reason_t reason)
}
switch (get_irn_opcode(irn)) {
switch (get_be_irn_opcode(irn)) {
case beo_IncSP: {
const be_incsp_attr_t *a = (const be_incsp_attr_t*)get_irn_generic_attr_const(irn);
fprintf(f, "align: %d\n", a->align);
......@@ -1236,9 +1232,15 @@ static void copy_attr(ir_graph *irg, const ir_node *old_node, ir_node *new_node)
}
}
int is_be_node(const ir_node *irn)
bool is_be_node(const ir_node *irn)
{
return get_op_tag(get_irn_op(irn)) == be_op_tag;
}
be_opcode get_be_irn_opcode(const ir_node *node)
{
return get_op_ops(get_irn_op(irn))->be_ops == &be_node_irn_ops;
assert(is_be_node(node));
return (be_opcode) (get_irn_opcode(node) - be_opcode_start);
}
static ir_op *new_be_op(unsigned code, const char *name, op_pin_state p,
......@@ -1248,6 +1250,7 @@ static ir_op *new_be_op(unsigned code, const char *name, op_pin_state p,
res->ops.dump_node = dump_node;
res->ops.copy_attr = copy_attr;
res->ops.be_ops = &be_node_irn_ops;
set_op_tag(res, be_op_tag);
return res;
}
......@@ -1255,23 +1258,27 @@ void be_init_op(void)
{
assert(op_be_Spill == NULL);
be_opcode_start = get_next_ir_opcodes(beo_last+1);
/* Acquire all needed opcodes. */
op_be_Spill = new_be_op(beo_Spill, "be_Spill", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_frame_attr_t));
op_be_Reload = new_be_op(beo_Reload, "be_Reload", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_frame_attr_t));
op_be_Perm = new_be_op(beo_Perm, "be_Perm", op_pin_state_exc_pinned, irop_flag_none, oparity_variable, sizeof(be_node_attr_t));
op_be_MemPerm = new_be_op(beo_MemPerm, "be_MemPerm", op_pin_state_exc_pinned, irop_flag_none, oparity_variable, sizeof(be_memperm_attr_t));
op_be_Copy = new_be_op(beo_Copy, "be_Copy", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_node_attr_t));
op_be_Keep = new_be_op(beo_Keep, "be_Keep", op_pin_state_exc_pinned, irop_flag_keep, oparity_dynamic, sizeof(be_node_attr_t));
op_be_CopyKeep = new_be_op(beo_CopyKeep, "be_CopyKeep", op_pin_state_exc_pinned, irop_flag_keep, oparity_variable, sizeof(be_node_attr_t));
op_be_Call = new_be_op(beo_Call, "be_Call", op_pin_state_exc_pinned, irop_flag_fragile|irop_flag_uses_memory, oparity_variable, sizeof(be_call_attr_t));
unsigned o = be_opcode_start;
op_be_Spill = new_be_op(o+beo_Spill, "be_Spill", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_frame_attr_t));
op_be_Reload = new_be_op(o+beo_Reload, "be_Reload", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_frame_attr_t));
op_be_Perm = new_be_op(o+beo_Perm, "be_Perm", op_pin_state_exc_pinned, irop_flag_none, oparity_variable, sizeof(be_node_attr_t));
op_be_MemPerm = new_be_op(o+beo_MemPerm, "be_MemPerm", op_pin_state_exc_pinned, irop_flag_none, oparity_variable, sizeof(be_memperm_attr_t));
op_be_Copy = new_be_op(o+beo_Copy, "be_Copy", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_node_attr_t));
op_be_Keep = new_be_op(o+beo_Keep, "be_Keep", op_pin_state_exc_pinned, irop_flag_keep, oparity_dynamic, sizeof(be_node_attr_t));
op_be_CopyKeep = new_be_op(o+beo_CopyKeep, "be_CopyKeep", op_pin_state_exc_pinned, irop_flag_keep, oparity_variable, sizeof(be_node_attr_t));
op_be_Call = new_be_op(o+beo_Call, "be_Call", op_pin_state_exc_pinned, irop_flag_fragile|irop_flag_uses_memory, oparity_variable, sizeof(be_call_attr_t));
op_be_Return = new_be_op(o+beo_Return, "be_Return", op_pin_state_exc_pinned, irop_flag_cfopcode, oparity_variable, sizeof(be_return_attr_t));
op_be_AddSP = new_be_op(o+beo_AddSP, "be_AddSP", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_node_attr_t));
op_be_SubSP = new_be_op(o+beo_SubSP, "be_SubSP", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_node_attr_t));
op_be_IncSP = new_be_op(o+beo_IncSP, "be_IncSP", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_incsp_attr_t));
op_be_Start = new_be_op(o+beo_Start, "be_Start", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_start_attr_t));
op_be_FrameAddr = new_be_op(o+beo_FrameAddr, "be_FrameAddr", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_frame_attr_t));
ir_op_set_memory_index(op_be_Call, n_be_Call_mem);
ir_op_set_fragile_indices(op_be_Call, pn_be_Call_X_regular, pn_be_Call_X_except);
op_be_Return = new_be_op(beo_Return, "be_Return", op_pin_state_exc_pinned, irop_flag_cfopcode, oparity_variable, sizeof(be_return_attr_t));
op_be_AddSP = new_be_op(beo_AddSP, "be_AddSP", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_node_attr_t));
op_be_SubSP = new_be_op(beo_SubSP, "be_SubSP", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_node_attr_t));
op_be_IncSP = new_be_op(beo_IncSP, "be_IncSP", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_incsp_attr_t));
op_be_Start = new_be_op(beo_Start, "be_Start", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_start_attr_t));
op_be_FrameAddr = new_be_op(beo_FrameAddr, "be_FrameAddr", op_pin_state_exc_pinned, irop_flag_none, oparity_any, sizeof(be_frame_attr_t));
op_be_Spill->ops.node_cmp_attr = FrameAddr_cmp_attr;
op_be_Reload->ops.node_cmp_attr = FrameAddr_cmp_attr;
......
......@@ -21,6 +21,26 @@
#include "irnode_t.h"
#include "bearch.h"
typedef enum be_opcode {
beo_Spill,
beo_Reload,
beo_Perm,
beo_MemPerm,
beo_Copy,
beo_Keep,
beo_CopyKeep,
beo_Call,
beo_Return,
beo_IncSP,
beo_AddSP,
beo_SubSP,
beo_Start,
beo_FrameAddr,
beo_first = beo_Spill,
beo_last = beo_FrameAddr
} be_opcode;
/**
* The benode op's. Must be available to register emitter function.
*/
......@@ -42,7 +62,9 @@ extern ir_op *op_be_FrameAddr;
/**
* Determines if irn is a be_node.
*/
int is_be_node(const ir_node *irn);
bool is_be_node(const ir_node *irn);
be_opcode get_be_irn_opcode(const ir_node *node);
/**
* Create all BE specific opcodes.
......@@ -440,19 +462,19 @@ ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode,
*/
ir_node *be_get_initial_reg_value(ir_graph *irg, const arch_register_t *reg);
static inline int be_is_Spill (const ir_node *irn) { return get_irn_opcode(irn) == beo_Spill ; }
static inline int be_is_Reload (const ir_node *irn) { return get_irn_opcode(irn) == beo_Reload ; }
static inline int be_is_Copy (const ir_node *irn) { return get_irn_opcode(irn) == beo_Copy ; }
static inline int be_is_CopyKeep (const ir_node *irn) { return get_irn_opcode(irn) == beo_CopyKeep ; }
static inline int be_is_Perm (const ir_node *irn) { return get_irn_opcode(irn) == beo_Perm ; }
static inline int be_is_MemPerm (const ir_node *irn) { return get_irn_opcode(irn) == beo_MemPerm ; }
static inline int be_is_Keep (const ir_node *irn) { return get_irn_opcode(irn) == beo_Keep ; }
static inline int be_is_Call (const ir_node *irn) { return get_irn_opcode(irn) == beo_Call ; }
static inline int be_is_Return (const ir_node *irn) { return get_irn_opcode(irn) == beo_Return ; }
static inline int be_is_IncSP (const ir_node *irn) { return get_irn_opcode(irn) == beo_IncSP ; }
static inline int be_is_AddSP (const ir_node *irn) { return get_irn_opcode(irn) == beo_AddSP ; }
static inline int be_is_SubSP (const ir_node *irn) { return get_irn_opcode(irn) == beo_SubSP ; }
static inline int be_is_Start (const ir_node *irn) { return get_irn_opcode(irn) == beo_Start ; }
static inline int be_is_FrameAddr(const ir_node *irn) { return get_irn_opcode(irn) == beo_FrameAddr; }
static inline bool be_is_Spill (const ir_node *irn) { return get_irn_op(irn) == op_be_Spill ; }
static inline bool be_is_Reload (const ir_node *irn) { return get_irn_op(irn) == op_be_Reload ; }
static inline bool be_is_Copy (const ir_node *irn) { return get_irn_op(irn) == op_be_Copy ; }
static inline bool be_is_CopyKeep (const ir_node *irn) { return get_irn_op(irn) == op_be_CopyKeep ; }
static inline bool be_is_Perm (const ir_node *irn) { return get_irn_op(irn) == op_be_Perm ; }
static inline bool be_is_MemPerm (const ir_node *irn) { return get_irn_op(irn) == op_be_MemPerm ; }
static inline bool be_is_Keep (const ir_node *irn) { return get_irn_op(irn) == op_be_Keep ; }
static inline bool be_is_Call (const ir_node *irn) { return get_irn_op(irn) == op_be_Call ; }
static inline bool be_is_Return (const ir_node *irn) { return get_irn_op(irn) == op_be_Return ; }
static inline bool be_is_IncSP (const ir_node *irn) { return get_irn_op(irn) == op_be_IncSP ; }
static inline bool be_is_AddSP (const ir_node *irn) { return get_irn_op(irn) == op_be_AddSP ; }
static inline bool be_is_SubSP (const ir_node *irn) { return get_irn_op(irn) == op_be_SubSP ; }
static inline bool be_is_Start (const ir_node *irn) { return get_irn_op(irn) == op_be_Start ; }
static inline bool be_is_FrameAddr(const ir_node *irn) { return get_irn_op(irn) == op_be_FrameAddr; }
#endif
......@@ -467,7 +467,7 @@ static void trace_node_ready(void *data, ir_node *irn, ir_node *pred)
static void trace_update_time(void *data, ir_node *irn)
{
trace_env_t *env = (trace_env_t*)data;
if (is_Phi(irn) || get_irn_opcode(irn) == beo_Start) {
if (is_Phi(irn) || be_is_Start(irn)) {
env->curr_time += get_irn_etime(env, irn);
}
else {
......
......@@ -329,20 +329,12 @@ static void peephole_ia32_Return(ir_node *node)
/* check if this return is the first on the block */
sched_foreach_reverse_before(node, irn) {
switch (get_irn_opcode(irn)) {
case beo_Start:
/* ignore no code generated */
if (is_Phi(irn) || be_is_Start(irn))
continue;
case beo_IncSP:
/* arg, IncSP 0 nodes might occur, ignore these */
if (be_get_IncSP_offset(irn) == 0)
continue;
return;
case iro_Phi:
/* arg, IncSP 0 nodes might occur, ignore these */
if (be_is_IncSP(irn) && be_get_IncSP_offset(irn) == 0)
continue;
default:
return;
}
return;
}
/* ensure, that the 3 byte return is generated */
......
......@@ -26,7 +26,7 @@
static ir_op **opcodes;
/** the available next opcode */
static unsigned next_iro = iro_MaxOpcode;
static unsigned next_iro = iro_last+1;
static ir_type *default_get_type_attr(const ir_node *node);
static ir_entity *default_get_entity_attr(const ir_node *node);
......
......@@ -20,28 +20,6 @@ typedef enum {{spec.name}}_opcode {
{%- endfor %}
{{spec.name}}o_first = {{spec.name}}o_{{nodes[0].name}},
{{spec.name}}o_last = {{spec.name}}o_{{nodes[-1].name}},
{%- if spec.name == "ir" %}
beo_First,
/* backend specific nodes */
beo_Spill = beo_First,
beo_Reload,
beo_Perm,
beo_MemPerm,
beo_Copy,
beo_Keep,
beo_CopyKeep,
beo_Call,
beo_Return,
beo_AddSP,
beo_SubSP,
beo_IncSP,
beo_Start,
beo_FrameAddr,
/* last backend node number */
beo_Last = beo_FrameAddr,
{%- endif %}
{{spec.name}}o_MaxOpcode
} {{spec.name}}_opcode;
/**
......
Markdown is supported
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