Commit 6004627a authored by Christoph Mallon's avatar Christoph Mallon
Browse files

benode: Remove be_find_return_reg_input().

The only user knwos, where its sp is.
parent 79e494e4
......@@ -1005,24 +1005,6 @@ ir_node *be_get_initial_reg_value(ir_graph *irg, const arch_register_t *reg)
return new_r_Proj(start, mode, i);
}
int be_find_return_reg_input(ir_node *ret, const arch_register_t *reg)
{
int arity = get_irn_arity(ret);
int i;
/* do a naive linear search... */
for (i = 0; i < arity; ++i) {
const arch_register_req_t *req = arch_get_irn_register_req_in(ret, i);
if (!arch_register_req_is(req, limited))
continue;
if (req->cls != reg->reg_class)
continue;
if (!rbitset_is_set(req->limited, reg->index))
continue;
return i;
}
panic("Tried querying undefined register '%s' at Return", reg->name);
}
static ir_entity* dummy_get_frame_entity(const ir_node *node)
{
(void) node;
......
......@@ -456,12 +456,6 @@ 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);
/**
* Search for input of a return node with a specific register and return
* its number.
*/
int be_find_return_reg_input(ir_node *ret, 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 ; }
......
......@@ -86,8 +86,9 @@ static void introduce_epilog(ir_node *ret)
ir_node *block = get_nodes_block(ret);
ir_type *frame_type = get_irg_frame_type(irg);
unsigned frame_size = get_type_size_bytes(frame_type);
int sp_idx = be_find_return_reg_input(ret, sp_reg);
ir_node *sp = get_irn_n(ret, sp_idx);
assert(arch_get_irn_register_req_in(ret, n_sparc_Return_sp) == sp_reg->single_req);
ir_node *const sp = get_irn_n(ret, n_sparc_Return_sp);
if (!layout->sp_relative) {
const arch_register_t *fp_reg = &sparc_registers[REG_FRAME_POINTER];
......@@ -97,12 +98,12 @@ static void introduce_epilog(ir_node *ret)
ir_node *restore = new_bd_sparc_RestoreZero(NULL, block, sp, fp);
sched_add_before(ret, restore);
arch_set_irn_register(restore, sp_reg);
set_irn_n(ret, sp_idx, restore);
set_irn_n(ret, n_sparc_Return_sp, restore);
kill_unused_stacknodes(sp);
} else {
ir_node *incsp = be_new_IncSP(sp_reg, block, sp, -frame_size, 0);
set_irn_n(ret, sp_idx, incsp);
set_irn_n(ret, n_sparc_Return_sp, incsp);
sched_add_before(ret, incsp);
}
}
......
......@@ -95,4 +95,9 @@ struct sparc_switch_jmp_attr_t {
ir_entity *table_entity;
};
enum n_sparc_Return {
n_sparc_Return_mem = 0,
n_sparc_Return_sp = 1,
};
#endif
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