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

ir: Use foreach_irn_in{,_r}().

parent 023b870a
...@@ -195,8 +195,8 @@ static void assure_should_be_same_requirements(ir_node *const node) ...@@ -195,8 +195,8 @@ static void assure_should_be_same_requirements(ir_node *const node)
continue; continue;
/* test if any other input is using the out register */ /* test if any other input is using the out register */
for (int i2 = 0, arity = get_irn_arity(node); i2 < arity; ++i2) { foreach_irn_in(node, i2, in) {
const arch_register_t *reg = arch_get_irn_register_in(node, i2); arch_register_t const *const reg = arch_get_irn_register(in);
if (reg == out_reg && (unsigned)i2 != same_pos) { if (reg == out_reg && (unsigned)i2 != same_pos) {
if (!is_amd64_irn(node)) if (!is_amd64_irn(node))
panic("cannot fulfill should_be_same on non-amd64 node"); panic("cannot fulfill should_be_same on non-amd64 node");
......
...@@ -144,8 +144,7 @@ static void dump(unsigned mask, ir_graph *irg, ...@@ -144,8 +144,7 @@ static void dump(unsigned mask, ir_graph *irg,
static void memory_operand_walker(ir_node *irn, void *env) static void memory_operand_walker(ir_node *irn, void *env)
{ {
(void)env; (void)env;
for (int i = 0, arity = get_irn_arity(irn); i < arity; ++i) { foreach_irn_in(irn, i, in) {
ir_node *in = get_irn_n(irn, i);
if (!arch_irn_is(skip_Proj(in), reload)) if (!arch_irn_is(skip_Proj(in), reload))
continue; continue;
if (get_nodes_block(in) != get_nodes_block(irn)) if (get_nodes_block(in) != get_nodes_block(irn))
......
...@@ -534,8 +534,7 @@ void remove_End_n(ir_node *n, int idx) ...@@ -534,8 +534,7 @@ void remove_End_n(ir_node *n, int idx)
void remove_End_keepalive(ir_node *end, const ir_node *irn) void remove_End_keepalive(ir_node *end, const ir_node *irn)
{ {
assert(END_KEEPALIVE_OFFSET == 0); assert(END_KEEPALIVE_OFFSET == 0);
for (unsigned i = get_irn_arity(end); i-- > 0; ) { foreach_irn_in_r(end, i, ka) {
const ir_node *ka = get_irn_n(end, i);
if (ka == irn) { if (ka == irn) {
remove_irn_n(end, i); remove_irn_n(end, i);
return; return;
......
...@@ -445,8 +445,7 @@ static ir_node *find_const_or_confirm(jumpthreading_env_t *env, ir_node *jump, ...@@ -445,8 +445,7 @@ static ir_node *find_const_or_confirm(jumpthreading_env_t *env, ir_node *jump,
if (get_nodes_block(value) != block) if (get_nodes_block(value) != block)
return NULL; return NULL;
for (int i = 0, arity = get_irn_arity(value); i < arity; ++i) { foreach_irn_in(value, i, phi_pred) {
ir_node *phi_pred = get_Phi_pred(value, i);
ir_node *cfgpred = get_Block_cfgpred(block, i); ir_node *cfgpred = get_Block_cfgpred(block, i);
ir_node *copy_block = find_const_or_confirm(env, cfgpred, phi_pred); ir_node *copy_block = find_const_or_confirm(env, cfgpred, phi_pred);
if (copy_block == NULL) if (copy_block == NULL)
...@@ -496,8 +495,7 @@ static ir_node *find_candidate(jumpthreading_env_t *env, ir_node *jump, ...@@ -496,8 +495,7 @@ static ir_node *find_candidate(jumpthreading_env_t *env, ir_node *jump,
if (get_nodes_block(value) != block) if (get_nodes_block(value) != block)
return NULL; return NULL;
for (int i = 0, arity = get_irn_arity(value); i < arity; ++i) { foreach_irn_in(value, i, phi_pred) {
ir_node *phi_pred = get_Phi_pred(value, i);
ir_node *cfgpred = get_Block_cfgpred(block, i); ir_node *cfgpred = get_Block_cfgpred(block, i);
ir_node *copy_block = find_candidate(env, cfgpred, phi_pred); ir_node *copy_block = find_candidate(env, cfgpred, phi_pred);
if (copy_block == NULL) if (copy_block == NULL)
......
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