#include "irtools.h"
#include "irloop_t.h"
#include "array.h"
-#include "firmstat.h"
+#include "firmstat_t.h"
#include "error.h"
#include "irpass_t.h"
(void) size;
return l1->src != l2->src;
-} /* LFTR_cmp */
+}
/**
* Find a LFTR edge.
key.src = src;
return set_find(LFTR_edge, env->lftr_edges, &key, sizeof(key), hash_ptr(src));
-} /* LFTR_find */
+}
/**
* Add a LFTR edge.
* There might be more than one edge here. This is rather bad
* because we currently store only one.
*/
- set_insert(LFTR_edge, env->lftr_edges, &key, sizeof(key), hash_ptr(src));
-} /* LFTR_add */
+ (void)set_insert(LFTR_edge, env->lftr_edges, &key, sizeof(key), hash_ptr(src));
+}
/**
* Gets the node_entry of a node.
set_irn_link(irn, e);
}
return e;
-} /* get_irn_ne */
+}
/**
* Gets the scc from an induction variable.
{
node_entry *e = get_irn_ne(iv, env);
return e->pscc;
-} /* get_iv_scc */
+}
/**
* Check if irn is an IV.
static ir_node *is_iv(ir_node *irn, iv_env *env)
{
return get_irn_ne(irn, env)->header;
-} /* is_iv */
+}
/**
* Check if irn is a region constant.
ir_node *block = get_nodes_block(irn);
return (block != header_block) && block_dominates(block, header_block);
-} /* is_rc */
+}
/**
* Set compare function for the quad set.
(void) size;
return c1->code != c2->code || c1->op1 != c2->op1 || c1->op2 != c2->op2;
-} /* quad_cmp */
+}
/**
* Check if an reduced operation was already calculated.
if (entry)
return entry->res;
return NULL;
-} /* search */
+}
/**
* Add an reduced operation.
key.op2 = op2;
key.res = result;
- set_insert(quadruple_t, env->quad_map, &key, sizeof(key), (code * 9) ^ hash_ptr(op1) ^ hash_ptr(op2));
-} /* add */
+ (void)set_insert(quadruple_t, env->quad_map, &key, sizeof(key), (code * 9) ^ hash_ptr(op1) ^ hash_ptr(op2));
+}
/**
* Find a location where to place a bin-op whose operands are in
return block2;
assert(block_dominates(block2, block1));
return block1;
-} /* find_location */
+}
/**
* Create a node that executes an op1 code op1 operation.
panic("Unsupported opcode");
}
return result;
-} /* do_apply */
+}
/**
* The Apply operation.
}
}
return result;
-} /* apply */
+}
/**
* The Reduce operation.
get_irn_opname(orig), rc));
}
return result;
-} /* reduce */
+}
/**
* Update the scc for a newly created IV.
} while (! waitq_empty(wq));
del_waitq(wq);
DB((dbg, LEVEL_2, "\n"));
-} /* update_scc */
+}
/**
* The Replace operation. We found a node representing iv (+,-,*) rc
return 1;
}
return 0;
-} /* replace */
+}
#if 0
/**
}
}
return 0;
-} /* is_x86_shift_const */
+}
#endif
/**
pscc->incr = get_Const_tarval(have_incr);
pscc->code = code;
return code != iro_Bad;
-} /* is_counter_iv */
+}
/**
* Check the users of an induction variable for register pressure.
scc *pscc = e->pscc;
for (irn = pscc->head; irn != NULL; irn = e->next) {
- const ir_edge_t *edge;
-
foreach_out_edge(irn, edge) {
ir_node *user = get_edge_src_irn(edge);
node_entry *ne = get_irn_ne(user, env);
* to do a linear function test replacement, so go on.
*/
return 1;
-} /* check_users_for_reg_pressure */
+}
/**
* Check if a node can be replaced (+, -, *).
break;
}
return 0;
-} /* check_replace */
+}
/**
* Check which SCC's are induction variables.
next = e->next;
e->header = NULL;
}
-} /* classify_iv */
+}
/**
* Process an SCC for the operator strength reduction.
} else {
classify_iv(pscc, env);
}
-} /* process_scc */
+}
/**
* If an SCC is a Phi only cycle, remove it.
exchange(irn, out_rc);
}
++env->replaced;
-} /* remove_phi_cycle */
+}
/**
* Process a SCC for the Phi cycle remove.
if (e->next != NULL)
remove_phi_cycle(pscc, env);
-} /* process_phi_only_scc */
+}
/**
env->stack[env->tos++] = n;
e = get_irn_ne(n, env);
e->in_stack = 1;
-} /* push */
+}
/**
* Pop a node from the stack.
e->in_stack = 0;
return n;
-} /* pop */
+}
/**
* Do Tarjan's SCC algorithm and drive OSR.
env->process_scc(pscc, env);
}
}
-} /* dfs */
+}
/**
* Do the DFS by starting at the End node of a graph.
}
ir_free_resources(irg, IR_RESOURCE_IRN_VISITED);
-} /* do_dfs */
+}
/**
* Post-block-walker: assign the post-order number.
node_entry *e = get_irn_ne(block, env);
e->POnum = env->POnum++;
-} /* assign_po */
+}
/**
* Apply one LFTR edge operation.
return new_r_Const(irg, tv);
}
return do_apply(e->code, NULL, rc, e->rc, get_irn_mode(e->dst));
-} /* applyOneEdge */
+}
/**
* Applies the operations represented by the LFTR edges to a
DB((dbg, LEVEL_3, "\n"));
*pIV = iv;
return rc;
-} /* applyEdges */
+}
/**
* Walker, finds Cmp(iv, rc) or Cmp(rc, iv)
set_Cmp_right(cmp, nright);
++env->lftr_replaced;
}
-} /* do_lftr */
+}
/**
* do linear function test replacement.
static void lftr(ir_graph *irg, iv_env *env)
{
irg_walk_graph(irg, NULL, do_lftr, env);
-} /* lftr */
+}
/* Remove any Phi cycles with only one real input. */
void remove_phi_cycles(ir_graph *irg)
ir_graph_pass_t *remove_phi_cycles_pass(const char *name)
{
return def_graph_pass(name ? name : "remove_phi_cycles", remove_phi_cycles);
-} /* remove_phi_cycles_pass */
+}
/**
* Post-walker: fix Add and Sub nodes that where results of I<->P conversions.
}
}
}
-} /* fix_adds_and_subs */
+}
/* Performs Operator Strength Reduction for the passed graph. */
void opt_osr(ir_graph *irg, unsigned flags)
pass_t *pass = (pass_t*)context;
opt_osr(irg, pass->flags);
return 0;
-} /* pass_wrapper */
+}
ir_graph_pass_t *opt_osr_pass(const char *name, unsigned flags)
{
pass->flags = flags;
return def_graph_pass_constructor(
&pass->pass, name ? name : "osr", pass_wrapper);
-} /* opt_osr_pass */
+}