key.src = src;
- return (LFTR_edge*)set_find(env->lftr_edges, &key, sizeof(key), hash_ptr(src));
+ return set_find(LFTR_edge, env->lftr_edges, &key, sizeof(key), hash_ptr(src));
} /* LFTR_find */
/**
* There might be more than one edge here. This is rather bad
* because we currently store only one.
*/
- set_insert(env->lftr_edges, &key, sizeof(key), hash_ptr(src));
+ (void)set_insert(LFTR_edge, env->lftr_edges, &key, sizeof(key), hash_ptr(src));
} /* LFTR_add */
/**
key.op1 = op1;
key.op2 = op2;
- entry = (quadruple_t*)set_find(env->quad_map, &key, sizeof(key),
- (code * 9) ^ hash_ptr(op1) ^hash_ptr(op2));
+ entry = set_find(quadruple_t, env->quad_map, &key, sizeof(key), (code * 9) ^ hash_ptr(op1) ^ hash_ptr(op2));
if (entry)
return entry->res;
return NULL;
key.op2 = op2;
key.res = result;
- set_insert(env->quad_map, &key, sizeof(key),
- (code * 9) ^ hash_ptr(op1) ^hash_ptr(op2));
+ (void)set_insert(quadruple_t, env->quad_map, &key, sizeof(key), (code * 9) ^ hash_ptr(op1) ^ hash_ptr(op2));
} /* add */
/**
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);
next = e->next;
switch (get_irn_opcode(irn)) {
- case iro_Add:
case iro_Sub:
+ only_phi = 0;
+ {
+ ir_node *left = get_Sub_left(irn);
+ node_entry *left_entry = get_irn_ne(left, env);
+ ir_node *right = get_Sub_right(irn);
+ node_entry *right_entry = get_irn_ne(right, env);
+
+ if (left_entry->pscc != e->pscc ||
+ (right_entry->pscc != e->pscc && !is_rc(right, header))) {
+ /*
+ * Not an induction variable.
+ * Region constant are only allowed on right hand side.
+ */
+ goto fail;
+ }
+ }
+ break;
+
+ case iro_Add:
only_phi = 0;
/* fall through */
case iro_Phi:
irg_walk_graph(irg, NULL, do_lftr, env);
} /* lftr */
-/**
- * Pre-walker: set all node links to NULL and fix the
- * block of Proj nodes.
- */
-static void clear_and_fix(ir_node *irn, void *env)
-{
- (void)env;
-
- set_irn_link(irn, NULL);
-
- if (is_Proj(irn)) {
- ir_node *pred = get_Proj_pred(irn);
- ir_node *pred_block = get_nodes_block(pred);
-
- if (get_nodes_block(irn) != pred_block) {
- set_nodes_block(irn, pred_block);
- }
- }
-} /* clear_and_fix */
-
-
/* Remove any Phi cycles with only one real input. */
void remove_phi_cycles(ir_graph *irg)
{
* the same block as their predecessors.
* This can improve the placement of new nodes.
*/
- irg_walk_graph(irg, NULL, clear_and_fix, NULL);
+ irg_walk_graph(irg, NULL, firm_clear_link, NULL);
/* calculate the post order number for blocks. */
irg_out_block_walk(get_irg_start_block(irg), NULL, assign_po, &env);
* the same block as its predecessors.
* This can improve the placement of new nodes.
*/
- irg_walk_graph(irg, NULL, clear_and_fix, NULL);
+ irg_walk_graph(irg, NULL, firm_clear_link, NULL);
irg_block_edges_walk(get_irg_start_block(irg), NULL, assign_po, &env);