summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bespillslots.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/bespillslots.c
parentcc281f880e6e186609e3c0222dca4dfca968f1f6 (diff)
Add and use foreach_irn_pred{,_r}().
Diffstat (limited to 'ir/be/bespillslots.c')
-rw-r--r--ir/be/bespillslots.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/ir/be/bespillslots.c b/ir/be/bespillslots.c
index 2eaf23f..8f85d09 100644
--- a/ir/be/bespillslots.c
+++ b/ir/be/bespillslots.c
@@ -100,11 +100,7 @@ static spill_t *get_spill(be_fec_env_t *env, ir_node *node)
static inline ir_node *get_memory_edge(const ir_node *node)
{
- int i, arity;
-
- arity = get_irn_arity(node);
- for (i = arity - 1; i >= 0; --i) {
- ir_node *arg = get_irn_n(node, i);
+ foreach_irn_in_r(node, i, arg) {
if (get_irn_mode(arg) == mode_M)
return arg;
}
@@ -138,11 +134,8 @@ static spill_t *collect_spill(be_fec_env_t *env, ir_node *node,
DB((dbg, DBG_COALESCING, "Slot %d: %+F\n", spill->spillslot, node));
if (is_Phi(node)) {
- int arity = get_irn_arity(node);
- int i;
- for (i = 0; i < arity; ++i) {
+ foreach_irn_in(node, i, arg) {
affinity_edge_t *affinty_edge;
- ir_node *arg = get_irn_n(node, i);
spill_t *arg_spill = collect_spill(env, arg, mode, align);
ir_node *block = get_nodes_block(arg);
@@ -255,17 +248,13 @@ static bool my_values_interfere2(ir_graph *const irg, ir_node const *a, ir_node
static int my_values_interfere(ir_graph *irg, ir_node *a, ir_node *b)
{
if (is_Sync(a)) {
- int i, arity = get_irn_arity(a);
- for (i = 0; i < arity; ++i) {
- ir_node *in = get_irn_n(a, i);
+ foreach_irn_in(a, i, in) {
if (my_values_interfere(irg, in, b))
return 1;
}
return 0;
} else if (is_Sync(b)) {
- int i, arity = get_irn_arity(b);
- for (i = 0; i < arity; ++i) {
- ir_node *in = get_irn_n(b, i);
+ foreach_irn_in(b, i, in) {
/* a is not a sync, so no need for my_values_interfere */
if (my_values_interfere2(irg, a, in))
return 1;
@@ -477,13 +466,8 @@ static void assign_spill_entity(be_fec_env_t *env,
if (is_NoMem(node))
return;
if (is_Sync(node)) {
- int i, arity;
-
- arity = get_irn_arity(node);
- for (i = 0; i < arity; ++i) {
- ir_node *in = get_irn_n(node, i);
+ foreach_irn_in(node, i, in) {
assert(!is_Phi(in));
-
assign_spill_entity(env, in, entity);
}
return;
@@ -535,15 +519,12 @@ static void assign_spillslots(be_fec_env_t *env)
}
if (is_Phi(node)) {
- int arity = get_irn_arity(node);
- int i;
ir_node *block = get_nodes_block(node);
/* should be a PhiM */
assert(get_irn_mode(node) == mode_M);
- for (i = 0; i < arity; ++i) {
- ir_node *arg = get_irn_n(node, i);
+ foreach_irn_in(node, i, arg) {
ir_node *predblock = get_Block_cfgpred_block(block, i);
spill_t *argspill = get_spill(env, arg);
int argslotid = argspill->spillslot;