summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bestack.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2014-02-13 16:38:46 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2014-02-17 14:11:15 +0100
commit0ea8b7276a18cf5cdaa89cf6b054faa60086f9a0 (patch)
tree01d0462aed83d8b63097e7091b1feafde5f683b1 /ir/be/bestack.c
parentcc281f880e6e186609e3c0222dca4dfca968f1f6 (diff)
Add and use foreach_irn_pred{,_r}().
Diffstat (limited to 'ir/be/bestack.c')
-rw-r--r--ir/be/bestack.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/ir/be/bestack.c b/ir/be/bestack.c
index f50c293..c28ec08 100644
--- a/ir/be/bestack.c
+++ b/ir/be/bestack.c
@@ -270,7 +270,7 @@ void be_abi_fix_stack_nodes(ir_graph *irg)
be_irg_t *birg = be_birg_from_irg(irg);
const arch_register_t *sp = arch_env->sp;
be_ssa_construction_env_t senv;
- int i, len;
+ int len;
ir_node **phis;
fix_stack_walker_env_t walker_env;
@@ -306,7 +306,7 @@ void be_abi_fix_stack_nodes(ir_graph *irg)
if (lv != NULL) {
len = ARR_LEN(walker_env.sp_nodes);
- for (i = 0; i < len; ++i) {
+ for (int i = 0; i < len; ++i) {
be_liveness_update(lv, walker_env.sp_nodes[i]);
}
be_ssa_construction_update_liveness_phis(&senv, lv);
@@ -316,7 +316,7 @@ void be_abi_fix_stack_nodes(ir_graph *irg)
/* set register requirements for stack phis */
len = ARR_LEN(phis);
- for (i = 0; i < len; ++i) {
+ for (int i = 0; i < len; ++i) {
ir_node *phi = phis[i];
be_set_phi_reg_req(phi, sp_req);
arch_set_irn_register(phi, arch_env->sp);
@@ -329,21 +329,16 @@ void be_abi_fix_stack_nodes(ir_graph *irg)
* when leaving the function. Though the last incsp is often kept (because
* you often don't know which incsp is the last one and fixstack should find
* them all). Remove unnecessary keeps and IncSP nodes */
- {
- ir_node *end = get_irg_end(irg);
- int arity = get_irn_arity(end);
- int i;
- for (i = arity-1; i >= 0; --i) {
- ir_node *in = get_irn_n(end, i);
- if (!be_is_IncSP(in)) {
- continue;
- }
+ ir_node *end = get_irg_end(irg);
+ foreach_irn_in_r(end, i, in) {
+ if (!be_is_IncSP(in)) {
+ continue;
+ }
- remove_End_keepalive(end, in);
- if (get_irn_n_edges(in) == 0) {
- sched_remove(in);
- kill_node(in);
- }
+ remove_End_keepalive(end, in);
+ if (get_irn_n_edges(in) == 0) {
+ sched_remove(in);
+ kill_node(in);
}
}
}