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

be: Add and use be_new_Keep_one() to keep a single node.

parent 5b92dd68
......@@ -217,7 +217,6 @@ static ir_node* create_spproj(ir_node *pred, int pos)
*/
static void transform_MemPerm(ir_node *node)
{
ir_node *block = get_nodes_block(node);
ir_graph *irg = get_irn_irg(node);
ir_node *sp = be_get_initial_reg_value(irg, &amd64_registers[REG_RSP]);
int arity = be_get_MemPerm_entity_arity(node);
......@@ -300,8 +299,7 @@ static void transform_MemPerm(ir_node *node)
pops[i] = pop;
}
ir_node *const in[] = { sp };
ir_node *const keep = be_new_Keep(block, ARRAY_SIZE(in), in);
ir_node *const keep = be_new_Keep_one(sp);
sched_replace(node, keep);
/* exchange memprojs */
......
......@@ -243,6 +243,13 @@ ir_node *be_new_Keep(ir_node *const block, int const n,
return res;
}
ir_node *be_new_Keep_one(ir_node *const kept)
{
ir_node *const in[] = { kept };
ir_node *const block = get_nodes_block(kept);
return be_new_Keep(block, ARRAY_SIZE(in), in);
}
void be_Keep_add_node(ir_node *keep, const arch_register_class_t *cls,
ir_node *node)
{
......
......@@ -98,6 +98,7 @@ void be_Perm_reduce(ir_node *perm, int new_size, int *map);
ir_node *be_new_MemPerm(ir_node *block, int n, ir_node *const *in);
ir_node *be_new_Keep(ir_node *block, int arity, ir_node *const *in);
ir_node *be_new_Keep_one(ir_node *kept);
void be_Keep_add_node(ir_node *keep, const arch_register_class_t *cls,
ir_node *node);
......
......@@ -1212,10 +1212,7 @@ static ir_node *add_to_keep(ir_node *last_keep,
if (last_keep != NULL) {
be_Keep_add_node(last_keep, cls, node);
} else {
ir_node *const in[] = { node };
ir_node *const block = get_nodes_block(node);
last_keep = be_new_Keep(block, ARRAY_SIZE(in), in);
last_keep = be_new_Keep_one(node);
ir_node *const schedpoint = skip_Proj(node);
if (sched_is_scheduled(schedpoint)) {
sched_add_after(schedpoint, last_keep);
......
......@@ -171,9 +171,7 @@ void be_remove_dead_nodes_from_schedule(ir_graph *irg)
void be_keep_if_unused(ir_node *node)
{
if (get_irn_n_edges(node) == 0) {
ir_node *const in[] = { node };
ir_node *const block = get_nodes_block(node);
ir_node *const keep = be_new_Keep(block, ARRAY_SIZE(in), in);
ir_node *const keep = be_new_Keep_one(node);
sched_add_after(node, keep);
}
}
......@@ -830,7 +830,6 @@ static ir_node* create_spproj(ir_node *node, ir_node *pred, int pos)
*/
static void transform_MemPerm(ir_node *node)
{
ir_node *block = get_nodes_block(node);
ir_graph *irg = get_irn_irg(node);
ir_node *sp = be_get_initial_reg_value(irg, &ia32_registers[REG_ESP]);
int arity = be_get_MemPerm_entity_arity(node);
......@@ -907,8 +906,7 @@ static void transform_MemPerm(ir_node *node)
pops[i] = pop;
}
ir_node *in[] = { sp };
ir_node *keep = be_new_Keep(block, ARRAY_SIZE(in), in);
ir_node *const keep = be_new_Keep_one(sp);
sched_replace(node, keep);
/* exchange memprojs */
......
......@@ -635,8 +635,7 @@ static ir_node *create_pop(dbg_info *dbgi, ir_node *block,
sched_add_before(schedpoint, pop);
ir_node *const in[] = { val };
ir_node *const keep = be_new_Keep(block, ARRAY_SIZE(in), in);
ir_node *const keep = be_new_Keep_one(val);
sched_add_before(schedpoint, keep);
return stack;
......
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