Commit a70660f6 authored by Matthias Braun's avatar Matthias Braun
Browse files

Simplify backends by removing unnecessary constructs:

- removed be_FrameLoad and be_FrameStore nodes which weren't used anymore
- removed be_StackParam and replace it with Load(be_FrameAddr) constructs

[r15610]
parent fad022b1
......@@ -170,10 +170,7 @@ void arm_emit_offset(arm_emit_env_t *env, const ir_node *node) {
int offset = 0;
ir_op *irn_op = get_irn_op(node);
if (irn_op == op_be_StackParam) {
ir_entity *ent = be_get_frame_entity(node);
offset = get_entity_offset(ent);
} else if (irn_op == op_be_Reload || irn_op == op_be_Spill) {
if (irn_op == op_be_Reload || irn_op == op_be_Spill) {
ir_entity *ent = be_get_frame_entity(node);
offset = get_entity_offset(ent);
} else if (irn_op == op_be_IncSP) {
......@@ -854,29 +851,6 @@ static void emit_be_Perm(arm_emit_env_t *env, const ir_node *irn) {
be_emit_finish_line_gas(env->emit, irn);
}
static void emit_be_StackParam(arm_emit_env_t *env, const ir_node *irn) {
ir_mode *mode = get_irn_mode(irn);
if (mode_is_float(mode)) {
if (USE_FPA(env->cg->isa)) {
be_emit_cstring(env->emit,"\tldf");
arm_emit_fpa_postfix(env->emit, mode);
be_emit_char(env->emit, ' ');
} else {
assert(0 && "stackparam not supported for this mode");
panic("emit_be_StackParam: stackparam not supported for this mode");
}
} else {
be_emit_cstring(env->emit,"\tldr ");
}
arm_emit_dest_register(env, irn, 0);
be_emit_cstring(env->emit, ", [");
arm_emit_source_register(env, irn, 0);
be_emit_cstring(env->emit,", #");
arm_emit_offset(env, irn);
be_emit_finish_line_gas(env->emit, irn);
}
/************************************************************************/
/* emit */
/************************************************************************/
......@@ -990,7 +964,6 @@ static void arm_register_emitters(void) {
BE_EMIT(Spill);
BE_EMIT(Reload);
BE_EMIT(Perm);
BE_EMIT(StackParam);
/* firm emitter */
EMIT(Jmp);
......
......@@ -1712,7 +1712,6 @@ static void arm_register_transformers(void) {
GEN(be_FrameAddr);
//GEN(be_Call);
//GEN(be_Return);
BAD(be_StackParam); /* unsupported yet */
GEN(be_AddSP);
GEN(be_SubSP);
GEN(be_Copy);
......
......@@ -1940,18 +1940,22 @@ static void modify_irg(be_abi_irg_t *env)
}
else if(arg->on_stack) {
/* For atomic parameters which are actually used, we create a StackParam node. */
ir_node *addr = be_new_FrameAddr(sp->reg_class, irg, reg_params_bl, frame_pointer, arg->stack_ent);
/* For atomic parameters which are actually used, we create a Load node. */
if(is_atomic_type(param_type) && get_irn_n_edges(args[i]) > 0) {
ir_mode *mode = get_type_mode(param_type);
const arch_register_class_t *cls = arch_isa_get_reg_class_for_mode(isa, mode);
repl = be_new_StackParam(cls, isa->bp->reg_class, irg, reg_params_bl, mode, frame_pointer, arg->stack_ent);
ir_node *load = new_rd_Load(NULL, irg, reg_params_bl,
new_NoMem(), addr, mode);
repl = new_rd_Proj(NULL, irg, reg_params_bl, load,
mode, pn_Load_res);
}
/* The stack parameter is not primitive (it is a struct or array),
we thus will create a node representing the parameter's address
on the stack. */
else {
repl = be_new_FrameAddr(sp->reg_class, irg, reg_params_bl, frame_pointer, arg->stack_ent);
repl = addr;
}
}
......
......@@ -127,7 +127,6 @@ ir_op *op_be_AddSP;
ir_op *op_be_SubSP;
ir_op *op_be_SetSP;
ir_op *op_be_RegParams;
ir_op *op_be_StackParam;
ir_op *op_be_FrameAddr;
ir_op *op_be_Barrier;
......@@ -275,7 +274,6 @@ void be_node_init(void) {
op_be_IncSP = new_ir_op(beo_base + beo_IncSP, "be_IncSP", op_pin_state_pinned, N, oparity_unary, 0, sizeof(be_stack_attr_t), &be_node_op_ops);
op_be_SetSP = new_ir_op(beo_base + beo_SetSP, "be_SetSP", op_pin_state_pinned, N, oparity_binary, 0, sizeof(be_stack_attr_t), &be_node_op_ops);
op_be_RegParams = new_ir_op(beo_base + beo_RegParams, "be_RegParams", op_pin_state_pinned, N, oparity_zero, 0, sizeof(be_node_attr_t), &be_node_op_ops);
op_be_StackParam = new_ir_op(beo_base + beo_StackParam, "be_StackParam", op_pin_state_floats, N, oparity_unary, 0, sizeof(be_frame_attr_t), &be_node_op_ops);
op_be_FrameAddr = new_ir_op(beo_base + beo_FrameAddr, "be_FrameAddr", op_pin_state_floats, N, oparity_unary, 0, sizeof(be_frame_attr_t), &be_node_op_ops);
op_be_Barrier = new_ir_op(beo_base + beo_Barrier, "be_Barrier", op_pin_state_pinned, N, oparity_dynamic, 0, sizeof(be_node_attr_t), &be_node_op_ops);
......@@ -307,8 +305,6 @@ void be_node_init(void) {
op_be_IncSP->ops.node_cmp_attr = Stack_cmp_attr;
set_op_tag(op_be_RegParams, &be_node_tag);
op_be_RegParams->ops.node_cmp_attr = node_cmp_attr;
set_op_tag(op_be_StackParam, &be_node_tag);
op_be_StackParam->ops.node_cmp_attr = FrameAddr_cmp_attr;
set_op_tag(op_be_FrameAddr, &be_node_tag);
op_be_FrameAddr->ops.node_cmp_attr = FrameAddr_cmp_attr;
set_op_tag(op_be_Barrier, &be_node_tag);
......@@ -782,24 +778,6 @@ ir_node *be_new_SetSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl,
return irn;
}
ir_node *be_new_StackParam(const arch_register_class_t *cls, const arch_register_class_t *cls_frame, ir_graph *irg, ir_node *bl, ir_mode *mode, ir_node *frame_pointer, ir_entity *ent)
{
be_frame_attr_t *a;
ir_node *irn;
ir_node *in[1];
in[0] = frame_pointer;
irn = new_ir_node(NULL, irg, bl, op_be_StackParam, mode, 1, in);
a = init_node_attr(irn, 1);
a->ent = ent;
be_node_set_reg_class(irn, 0, cls_frame);
be_node_set_reg_class(irn, OUT_POS(0), cls);
be_node_set_flags(irn, OUT_POS(0), arch_irn_flags_rematerializable);
return irn;
}
ir_node *be_new_RegParams(ir_graph *irg, ir_node *bl, int n_outs)
{
ir_node *res;
......@@ -931,14 +909,12 @@ int be_is_SetSP (const ir_node *irn) { return be_get_irn_opcode(irn) ==
int be_is_AddSP (const ir_node *irn) { return be_get_irn_opcode(irn) == beo_AddSP ; }
int be_is_SubSP (const ir_node *irn) { return be_get_irn_opcode(irn) == beo_SubSP ; }
int be_is_RegParams (const ir_node *irn) { return be_get_irn_opcode(irn) == beo_RegParams ; }
int be_is_StackParam (const ir_node *irn) { return be_get_irn_opcode(irn) == beo_StackParam ; }
int be_is_FrameAddr (const ir_node *irn) { return be_get_irn_opcode(irn) == beo_FrameAddr ; }
int be_is_Barrier (const ir_node *irn) { return be_get_irn_opcode(irn) == beo_Barrier ; }
int be_has_frame_entity(const ir_node *irn)
{
switch(be_get_irn_opcode(irn)) {
case beo_StackParam:
case beo_Spill:
case beo_Reload:
case beo_FrameAddr:
......@@ -1219,7 +1195,6 @@ static arch_irn_class_t be_node_classify(const void *self, const ir_node *irn)
XXX(Perm, perm);
XXX(Copy, copy);
XXX(Return, branch);
XXX(StackParam, stackparam);
#undef XXX
default:
return arch_irn_class_normal;
......
......@@ -55,7 +55,6 @@ extern ir_op *op_be_AddSP;
extern ir_op *op_be_SubSP;
extern ir_op *op_be_SetSP;
extern ir_op *op_be_RegParams;
extern ir_op *op_be_StackParam;
extern ir_op *op_be_FrameAddr;
extern ir_op *op_be_Barrier;
......@@ -75,9 +74,6 @@ typedef enum {
beo_IncSP,
beo_SetSP,
beo_RegParams,
beo_StackParam,
beo_FrameLoad,
beo_FrameStore,
beo_FrameAddr,
beo_Barrier,
beo_Last
......@@ -177,29 +173,6 @@ ir_node *be_new_Keep(const arch_register_class_t *cls, ir_graph *irg, ir_node *b
void be_Keep_add_node(ir_node *keep, const arch_register_class_t *cls, ir_node *node);
/**
* Position numbers for the be_FrameLoad inputs
*/
enum {
be_pos_FrameLoad_mem = 0,
be_pos_FrameLoad_ptr = 1
};
ir_node *be_new_FrameLoad(const arch_register_class_t *cls_frame, const arch_register_class_t *cls_data,
ir_graph *irg, ir_node *bl, ir_node *mem, ir_node *frame, ir_entity *ent);
/**
* Position numbers for the be_FrameStore inputs
*/
enum {
be_pos_FrameStore_mem = 0,
be_pos_FrameStore_ptr = 1,
be_pos_FrameStore_val = 2
};
ir_node *be_new_FrameStore(const arch_register_class_t *cls_frame, const arch_register_class_t *cls_data,
ir_graph *irg, ir_node *bl, ir_node *mem, ir_node *frame, ir_node *data, ir_entity *ent);
/**
* Position numbers for the be_FrameAddr inputs
*/
......@@ -374,17 +347,6 @@ int be_Return_get_n_rets(ir_node *ret);
/** appends a node to the return node, returns the position of the node */
int be_Return_append_node(ir_node *ret, ir_node *node);
/**
* StackParam input positions
*/
enum {
be_pos_StackParam_ptr = 0
};
/**
* Construct a new Stack Parameter node.
*/
ir_node *be_new_StackParam(const arch_register_class_t *cls, const arch_register_class_t *cls_frame, ir_graph *irg, ir_node *bl, ir_mode *mode, ir_node *frame_pointer, ir_entity *ent);
ir_node *be_new_RegParams(ir_graph *irg, ir_node *bl, int n_out);
ir_node *be_new_Barrier(ir_graph *irg, ir_node *bl, int n, ir_node *in[]);
......@@ -454,10 +416,7 @@ int be_is_SetSP(const ir_node *irn);
int be_is_AddSP(const ir_node *irn);
int be_is_SubSP(const ir_node *irn);
int be_is_RegParams(const ir_node *irn);
int be_is_StackParam(const ir_node *irn);
int be_is_FrameAddr(const ir_node *irn);
int be_is_FrameLoad(const ir_node *irn);
int be_is_FrameStore(const ir_node *irn);
int be_is_Barrier(const ir_node *irn);
/**
......
......@@ -2976,50 +2976,6 @@ ir_node *gen_ASM(ir_node *node)
*
********************************************/
static ir_node *gen_be_StackParam(ir_node *node) {
ir_node *block = be_transform_node(get_nodes_block(node));
ir_node *ptr = get_irn_n(node, be_pos_StackParam_ptr);
ir_node *new_ptr = be_transform_node(ptr);
ir_node *new_op = NULL;
ir_graph *irg = current_ir_graph;
dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *nomem = new_rd_NoMem(current_ir_graph);
ir_entity *ent = arch_get_frame_entity(env_cg->arch_env, node);
ir_mode *load_mode = get_irn_mode(node);
ir_node *noreg = ia32_new_NoReg_gp(env_cg);
ir_mode *proj_mode;
long pn_res;
if (mode_is_float(load_mode)) {
if (USE_SSE2(env_cg)) {
new_op = new_rd_ia32_xLoad(dbgi, irg, block, new_ptr, noreg, nomem);
pn_res = pn_ia32_xLoad_res;
proj_mode = mode_xmm;
} else {
new_op = new_rd_ia32_vfld(dbgi, irg, block, new_ptr, noreg, nomem, load_mode);
pn_res = pn_ia32_vfld_res;
proj_mode = mode_vfp;
}
} else {
new_op = new_rd_ia32_Load(dbgi, irg, block, new_ptr, noreg, nomem);
proj_mode = mode_Iu;
pn_res = pn_ia32_Load_res;
}
set_irn_pinned(new_op, op_pin_state_floats);
set_ia32_frame_ent(new_op, ent);
set_ia32_use_frame(new_op);
set_ia32_op_type(new_op, ia32_AddrModeS);
set_ia32_am_flavour(new_op, ia32_am_B);
set_ia32_ls_mode(new_op, load_mode);
set_ia32_flags(new_op, get_ia32_flags(new_op) | arch_irn_flags_rematerializable);
SET_IA32_ORIG_NODE(new_op, ia32_get_old_node_name(env_cg, node));
return new_rd_Proj(dbgi, irg, block, new_op, proj_mode, pn_res);
}
/**
* Transforms a FrameAddr into an ia32 Add.
*/
......@@ -4287,7 +4243,6 @@ static void register_transformers(void)
GEN(be_FrameAddr);
//GEN(be_Call);
GEN(be_Return);
GEN(be_StackParam);
GEN(be_AddSP);
GEN(be_SubSP);
GEN(be_Copy);
......
......@@ -1258,18 +1258,6 @@ static ir_node *gen_be_FrameAddr(ppc32_transform_env_t *env) {
return add;
}
/**
* Transforms a StackParam into a ppc Load
*
* @param env The transformation environment
*/
static ir_node *gen_be_StackParam(ppc32_transform_env_t *env) {
ir_node *load = new_rd_ppc32_Lwz(env->dbg, env->irg, env->block, get_irn_n(env->irn, 0), new_NoMem());
ir_node *proj = new_rd_Proj(env->dbg, env->irg, env->block, load, env->mode, pn_Load_res);
set_ppc32_frame_entity(load, be_get_frame_entity(env->irn));
return proj;
}
/*********************************************************
* _ _ _
......@@ -1365,7 +1353,6 @@ void ppc32_register_transformers(void) {
BAD(EndExcept);
FIRM_OP(be_FrameAddr);
FIRM_OP(be_StackParam);
op_Mulh = get_op_Mulh();
if (op_Mulh)
FIRM_OP(Mulh);
......
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