}
}
} else {
- // printf(" # comp_val: Proj node, not optimized\n");
+ /* printf(" # comp_val: Proj node, not optimized\n"); */
}
}
break;
}
if (n_preds == 0) { /* Phi of dead Region without predecessors. */
- // GL: why not return new_Bad?
+ /* GL: why not return new_Bad? */
break;
}
return 1;
/* compare a->in[0..ins] with b->in[0..ins], i.e., include the block. */
- // do if (*ain++ != *bin++) return 1; while (ins--);
+ /* do if (*ain++ != *bin++) return 1; while (ins--); */
for (i = -1; i < get_irn_arity(a); i++)
if (get_irn_n(a, i) != get_irn_n(b, i))
return 1;
unsigned h;
int i;
- // hash table value = 9*(9*(9*(9*(9*arity+in[0])+in[1])+ ...)+mode)+code
+ /* hash table value = 9*(9*(9*(9*(9*arity+in[0])+in[1])+ ...)+mode)+code */
h = get_irn_arity(node);
- // consider all in nodes... except the block.
+ /* consider all in nodes... except the block. */
for (i = 0; i < get_irn_arity(node); i++) {
h = 9*h + (unsigned long)get_irn_n(node, i);
}
- // ...mode,...
+ /* ...mode,... */
h = 9*h + (unsigned long) get_irn_mode (node);
- // ...and code
+ /* ...and code */
h = 9*h + (unsigned long) get_irn_op (node);
return h;
/* evaluation was succesful -- replace the node. */
obstack_free (current_ir_graph->obst, n);
return new_Const (get_tv_mode (tv), tv);
- // xprintf("* optimize: computed node %I\n", n->op->name);
+ /* xprintf("* optimize: computed node %I\n", n->op->name); */
}
}
}
/** common subexpression elimination **/
/* Checks whether n is already available. */
- /* The block input is used to distinguish different subexpressions. Right
+ /* The block input is used to distinguish different subexpressions. Right
now all nodes are pinned to blocks, i.e., the cse only finds common
subexpressions within a block. */
/* identify found a cse, so deallocate the old node. */
if (n != old_n) {
obstack_free (current_ir_graph->obst, old_n);
- // The AmRoq fiasco returns n here. Martin's version doesn't.
+ /* The AmRoq fiasco returns n here. Martin's version doesn't. */
}
#if 0
/* Now we have a legal, useful node. Enter it in hash table for cse */
if (get_opt_cse()) {
- // aborts ??! set/pset can not handle several hash tables??!
- // No, suddenly it works.
+ /* aborts ??! set/pset can not handle several hash tables??!
+ No, suddenly it works. */
n = identify_remember (current_ir_graph->value_table, n);
}
-#if 0 // GL: what's the use of this??
+#if 0 /* GL: what's the use of this?? */
if ((current_ir_graph->state & irgs_building) && IR_KEEP_ALIVE (n)) {
assert (~current_ir_graph->state & irgs_keep_alives_in_arr);
pdeq_putr (current_ir_graph->keep.living, n);
/* if not optimize return n */
if (n == NULL) {
- // Here this is possible. Why?
+ /* Here this is possible. Why? */
return n;
}
if (tv != NULL) {
/* evaluation was succesful -- replace the node. */
return new_Const (get_tv_mode (tv), tv);
- // xprintf("* optimize: computed node %I\n", n->op->name);
+ /* xprintf("* optimize: computed node %I\n", n->op->name);*/
}
}
}
/* identify found a cse, so deallocate the old node. */
if (n != old_n) {
- // The AmRoq fiasco returns n here. Martin's version doesn't.
+ /* The AmRoq fiasco returns n here. Martin's version doesn't. */
}
#if 0
/* Now we have a legal, useful node. Enter it in hash table for cse */
if (get_opt_cse()) {
- // aborts ??! set/pset can not handle several hash tables??!
- // No, suddenly it works.
+ /* aborts ??! set/pset can not handle several hash tables??!
+ No, suddenly it works. */
n = identify_remember (current_ir_graph->value_table, n);
}
return n;
}
-
-
-void
-optimize_in_place_wrapper (ir_node *n, void *env) {
- int i;
- ir_node *optimized;
-
- /* optimize all sons after recursion, i.e., the sons' sons are
- optimized already. */
- for (i = -1; i < get_irn_arity(n); i++) {
- optimized = optimize_in_place(get_irn_n(n, i));
- set_irn_n(n, i, optimized);
- }
-}
-
-
-void
-optimize_graph (ir_graph *irg)
-{
- ir_graph *rem = current_ir_graph;
- current_ir_graph = irg;
-
- /* walk over the graph */
- irg_walk(irg->end, NULL, optimize_in_place_wrapper, NULL);
-
- current_ir_graph = rem;
-}