Commit 00be7779 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

be: Make the function to get the output position of a node for given register backend-generic.

parent e1e04a12
......@@ -1575,20 +1575,6 @@ static ir_node *gen_Proj_Proj_Start(ir_node *node)
}
}
/**
* Finds number of output value of a mode_T node which is constrained to
* a single specific register.
*/
static int find_out_for_reg(ir_node *node, const arch_register_t *reg)
{
be_foreach_out(node, o) {
const arch_register_req_t *req = arch_get_irn_register_req_out(node, o);
if (req == reg->single_req)
return o;
}
return -1;
}
static ir_node *gen_Proj_Proj_Call(ir_node *node)
{
unsigned pn = get_Proj_num(node);
......@@ -1600,10 +1586,7 @@ static ir_node *gen_Proj_Proj_Call(ir_node *node)
const reg_or_stackslot_t *res = &cconv->results[pn];
assert(res->reg0 != NULL && res->reg1 == NULL);
int regn = find_out_for_reg(new_call, res->reg0);
if (regn < 0) {
panic("Internal error in calling convention for return %+F", node);
}
unsigned const regn = be_get_out_for_reg(new_call, res->reg0);
arm_free_calling_convention(cconv);
......
......@@ -953,3 +953,13 @@ ir_node *be_make_Sync(ir_node *const block, int const arity, ir_node **const ins
arity == 1 ? ins[0] :
new_r_Sync(block, arity, ins);
}
unsigned be_get_out_for_reg(ir_node const *const node, arch_register_t const *const reg)
{
be_foreach_out(node, o) {
arch_register_req_t const *const req = arch_get_irn_register_req_out(node, o);
if (req == reg->single_req)
return o;
}
panic("register requirement not found");
}
......@@ -193,4 +193,10 @@ static inline bool be_mode_needs_gp_reg(ir_mode *const mode)
return get_mode_arithmetic(mode) == irma_twos_complement;
}
/**
* Finds number of output value of a node which is constrained to a single
* specific register.
*/
unsigned be_get_out_for_reg(ir_node const *node, arch_register_t const *reg);
#endif
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