summaryrefslogtreecommitdiffhomepage
path: root/ir/be/benode.c
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2015-07-27 21:52:04 +0200
committerChristoph Mallon <mallon@cs.uni-saarland.de>2015-07-28 10:36:31 +0200
commit9a6b8525e9916f0b0448468defd150413814ecfe (patch)
tree8560176b7b598b84c47f88efd0f6dbaff2cb5679 /ir/be/benode.c
parent6a3abbe420b99019efd3e8a51bfce4e3cf713d5b (diff)
be: Add and use be_new_Proj().
It is like new_r_Proj(), but the mode is determined automatically from the out requirement of the predecessor. This probably resolves some mode mismatches in untested code paths -- AMD64 backend and SPARC hard float, I'm looking at you!
Diffstat (limited to 'ir/be/benode.c')
-rw-r--r--ir/be/benode.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ir/be/benode.c b/ir/be/benode.c
index 733096c..89943b2 100644
--- a/ir/be/benode.c
+++ b/ir/be/benode.c
@@ -417,7 +417,7 @@ ir_node *be_get_initial_reg_value(ir_graph *irg, const arch_register_t *reg)
unsigned const i = get_start_reg_index(irg, reg);
ir_node *const start = get_irg_start(irg);
ir_node *const proj = get_Proj_for_pn(start, i);
- return proj ? proj : new_r_Proj(start, reg->cls->mode, i);
+ return proj ? proj : be_new_Proj(start, i);
}
ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode,
@@ -523,6 +523,12 @@ ir_entity *be_get_Relocation_entity(ir_node const* const node)
return attr->entity;
}
+ir_node *be_new_Proj(ir_node *const pred, unsigned const pos)
+{
+ arch_register_req_t const *const req = arch_get_irn_register_req_out(pred, pos);
+ return new_r_Proj(pred, req->cls->mode, pos);
+}
+
/**
* ir_op-Operation: dump a be node to file
*/