summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bestack.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2012-11-27 15:45:34 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2012-11-27 16:30:15 +0100
commite40b76a350bfda9e97b6fb204b634dd9eceaadf9 (patch)
tree0f1dbcd82242ada12831e8dc8e55feda680bc975 /ir/be/bestack.c
parentd93e17b357f7e250a312bb2836433afb78136208 (diff)
bestack: Simplify be_abi_fix_stack_nodes() using be_create_reg_req().
Diffstat (limited to 'ir/be/bestack.c')
-rw-r--r--ir/be/bestack.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/ir/be/bestack.c b/ir/be/bestack.c
index bcbefc3..7941734 100644
--- a/ir/be/bestack.c
+++ b/ir/be/bestack.c
@@ -285,34 +285,20 @@ void be_abi_fix_stack_nodes(ir_graph *irg)
be_lv_t *lv = be_get_irg_liveness(irg);
const arch_env_t *arch_env = be_get_irg_arch_env(irg);
be_irg_t *birg = be_birg_from_irg(irg);
- const arch_register_req_t *sp_req = birg->sp_req;
const arch_register_t *sp = arch_env->sp;
be_ssa_construction_env_t senv;
int i, len;
ir_node **phis;
fix_stack_walker_env_t walker_env;
+ arch_register_req_t const *sp_req = birg->sp_req;
if (sp_req == NULL) {
- struct obstack *obst = be_get_be_obst(irg);
- arch_register_req_t *new_sp_req;
- unsigned *limited_bitset;
-
- new_sp_req = OALLOCZ(obst, arch_register_req_t);
- new_sp_req->type = arch_register_req_type_limited
- | arch_register_req_type_produces_sp;
- new_sp_req->cls = arch_env->sp->reg_class;
- new_sp_req->width = 1;
-
- limited_bitset = rbitset_obstack_alloc(obst, new_sp_req->cls->n_regs);
- rbitset_set(limited_bitset, sp->index);
- new_sp_req->limited = limited_bitset;
-
- if (!rbitset_is_set(birg->allocatable_regs, sp->global_index)) {
- new_sp_req->type |= arch_register_req_type_ignore;
- }
+ arch_register_req_type_t type = arch_register_req_type_produces_sp;
+ if (!rbitset_is_set(birg->allocatable_regs, sp->global_index))
+ type |= arch_register_req_type_ignore;
- sp_req = new_sp_req;
- birg->sp_req = new_sp_req;
+ struct obstack *const obst = be_get_be_obst(irg);
+ birg->sp_req = sp_req = be_create_reg_req(obst, sp, type);
}
walker_env.sp_nodes = NEW_ARR_F(ir_node*, 0);