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

be: Add the function arch_copy_irn_out_info() to copy one requirement and...

be: Add the function arch_copy_irn_out_info() to copy one requirement and register from another node.

* This avoids allocating new requirements.
* This renders be_set_constr_single_reg_out() obsolete.
parent 9f038f60
......@@ -578,8 +578,7 @@ static void introduce_prologue(ir_graph *const irg)
/* move rsp to rbp */
ir_node *const curr_bp = be_new_Copy(block, curr_sp);
sched_add_after(push, curr_bp);
be_set_constr_single_reg_out(curr_bp, 0,
bp, arch_register_req_type_ignore);
arch_copy_irn_out_info(curr_bp, 0, initial_bp);
edges_reroute_except(initial_bp, curr_bp, push);
ir_node *incsp = amd64_new_IncSP(block, curr_sp, frame_size, 0);
......
......@@ -147,3 +147,10 @@ ir_node *be_get_start_proj(ir_graph *const irg, be_start_info_t *const info)
}
return info->irn;
}
void arch_copy_irn_out_info(ir_node *const dst, unsigned const dst_pos, ir_node const *const src)
{
reg_out_info_t *const src_info = get_out_info(src);
reg_out_info_t *const dst_info = get_out_info_n(dst, dst_pos);
*dst_info = *src_info;
}
......@@ -492,4 +492,6 @@ void be_make_start_out(be_start_info_t *info, struct obstack *obst, ir_node *sta
ir_node *be_get_start_proj(ir_graph *irg, be_start_info_t *info);
void arch_copy_irn_out_info(ir_node *dst, unsigned dst_pos, ir_node const *src);
#endif
......@@ -234,7 +234,8 @@ ir_node *be_new_IncSP(const arch_register_t *sp, ir_node *bl,
/* Set output constraint to stack register. */
be_node_set_register_req_in(irn, 0, sp->cls->class_req);
be_set_constr_single_reg_out(irn, 0, sp, arch_register_req_type_produces_sp);
arch_copy_irn_out_info(irn, 0, old_sp);
assert(arch_register_req_is(arch_get_irn_register_req(irn), produces_sp));
return irn;
}
......@@ -348,28 +349,6 @@ const arch_register_req_t *be_create_reg_req(struct obstack *obst,
return req;
}
void be_set_constr_single_reg_out(ir_node *node, int pos,
const arch_register_t *reg, arch_register_req_type_t additional_types)
{
ir_graph *irg = get_irn_irg(node);
be_irg_t *birg = be_birg_from_irg(irg);
/* if we have an ignore register, add ignore flag and just assign it */
if (!rbitset_is_set(birg->allocatable_regs, reg->global_index))
additional_types |= arch_register_req_type_ignore;
const arch_register_req_t *req;
if (additional_types == 0) {
req = reg->single_req;
} else {
struct obstack *obst = be_get_be_obst(irg);
req = be_create_reg_req(obst, reg, additional_types);
}
arch_set_irn_register_out(node, pos, reg);
arch_set_irn_register_req_out(node, pos, req);
}
ir_node *be_get_IncSP_pred(ir_node *irn)
{
assert(be_is_IncSP(irn));
......
......@@ -149,16 +149,6 @@ unsigned be_get_MemPerm_entity_arity(const ir_node *irn);
*/
ir_node *be_new_AnyVal(ir_node *block, const arch_register_class_t *cls);
/**
* Impose a register constraint on a backend node.
* @param irn The node.
* @param pos The position of the argument.
* @param reg The register which is admissible for that node, argument/result
* and position.
*/
void be_set_constr_single_reg_out(ir_node *irn, int pos,
const arch_register_t *reg, arch_register_req_type_t additional_flags);
const arch_register_req_t *be_create_reg_req(struct obstack *obst,
const arch_register_t *reg, arch_register_req_type_t additional_types);
......
......@@ -1052,7 +1052,7 @@ static void introduce_prologue(ir_graph *const irg)
/* move esp to ebp */
ir_node *const curr_bp = be_new_Copy(block, curr_sp);
sched_add_after(push, curr_bp);
be_set_constr_single_reg_out(curr_bp, 0, bp, arch_register_req_type_ignore);
arch_copy_irn_out_info(curr_bp, 0, initial_bp);
edges_reroute_except(initial_bp, curr_bp, push);
ir_node *incsp = ia32_new_IncSP(block, curr_sp, frame_size, 0);
......
......@@ -5168,9 +5168,7 @@ static ir_node *gen_Call(ir_node *node)
/* Construct outputs. */
arch_set_irn_register_req_out(call, pn_ia32_Call_mem, arch_no_register_req);
arch_register_req_t const *const req = be_create_reg_req(obst, sp, arch_register_req_type_ignore | arch_register_req_type_produces_sp);
arch_set_irn_register_req_out(call, pn_ia32_Call_stack, req);
arch_set_irn_register_out(call, pn_ia32_Call_stack, sp);
arch_copy_irn_out_info(call, pn_ia32_Call_stack, callframe);
arch_set_irn_register_req_out(call, pn_ia32_Call_fpcw, fpcw->single_req);
arch_set_irn_register_out(call, pn_ia32_Call_fpcw, fpcw);
......
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