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

arm, sparc: Avoid creation of duplicate Projs at the Start node.

Duplicate Projs are a problem when CSE is off, e.g. -O0.
parent 9ac40ed1
......@@ -44,7 +44,6 @@ static be_stackorder_t *stackorder;
static calling_convention_t *cconv = NULL;
static be_start_info_t start_mem;
static be_start_info_t start_val[N_ARM_REGISTERS];
static unsigned start_callee_saves_offset;
static pmap *node_to_stack;
static const arch_register_t *const callee_saves[] = {
......@@ -1727,12 +1726,9 @@ static ir_node *gen_Start(ir_node *node)
be_make_start_out(&start_val[reg1->global_index], start, o++, reg1, false);
}
/* callee save regs */
start_callee_saves_offset = o;
for (size_t i = 0; i < ARRAY_SIZE(callee_saves); ++i) {
const arch_register_t *reg = callee_saves[i];
arch_set_irn_register_req_out(start, o, reg->single_req);
arch_set_irn_register_out(start, o, reg);
++o;
arch_register_t const *const reg = callee_saves[i];
be_make_start_out(&start_val[reg->global_index], start, o++, reg, false);
}
assert(n_outs == o);
......@@ -1797,10 +1793,10 @@ static ir_node *gen_Return(ir_node *node)
++p;
}
/* connect callee saves with their values at the function begin */
ir_node *start = get_irg_start(irg);
for (unsigned i = 0; i < n_callee_saves; ++i) {
in[p] = be_new_Proj(start, start_callee_saves_offset + i);
reqs[p] = callee_saves[i]->single_req;
arch_register_t const *const reg = callee_saves[i];
in[p] = be_get_start_proj(irg, &start_val[reg->global_index]);
reqs[p] = reg->single_req;
++p;
}
assert(p == n_ins);
......
......@@ -53,7 +53,6 @@ static pmap *node_to_stack;
static be_start_info_t start_mem;
static be_start_info_t start_val[N_SPARC_REGISTERS];
static ir_node *frame_base;
static size_t start_callee_saves_offset;
static const arch_register_t *const omit_fp_callee_saves[] = {
&sparc_registers[REG_L0],
......@@ -1586,14 +1585,10 @@ static ir_node *gen_Start(ir_node *node)
}
/* we need the values of the callee saves (Note: non omit-fp mode has no
* callee saves) */
start_callee_saves_offset = o;
if (current_cconv->omit_fp) {
size_t n_callee_saves = ARRAY_SIZE(omit_fp_callee_saves);
for (size_t c = 0; c < n_callee_saves; ++c) {
const arch_register_t *reg = omit_fp_callee_saves[c];
arch_set_irn_register_req_out(start, o, reg->single_req);
arch_set_irn_register_out(start, o, reg);
++o;
for (size_t c = 0; c < ARRAY_SIZE(omit_fp_callee_saves); ++c) {
arch_register_t const *const reg = omit_fp_callee_saves[c];
be_make_start_out(&start_val[reg->global_index], start, o++, reg, false);
}
}
assert(n_outs == o);
......@@ -1676,11 +1671,10 @@ static ir_node *gen_Return(ir_node *node)
}
/* callee saves */
if (current_cconv->omit_fp) {
ir_node *start = get_irg_start(irg);
size_t n_callee_saves = ARRAY_SIZE(omit_fp_callee_saves);
for (size_t i = 0; i < n_callee_saves; ++i) {
in[p] = be_new_Proj(start, i + start_callee_saves_offset);
reqs[p] = omit_fp_callee_saves[i]->single_req;
for (size_t i = 0; i < ARRAY_SIZE(omit_fp_callee_saves); ++i) {
arch_register_t const *const reg = omit_fp_callee_saves[i];
in[p] = be_get_start_proj(irg, &start_val[reg->global_index]);
reqs[p] = reg->single_req;
++p;
}
}
......
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