}
/*--------------------------------------------------------------------*/
-/* Building and Removing the dominator datastructure */
+/* Building and Removing the dominator data structure */
/*--------------------------------------------------------------------*/
/**
/**
- * Walks Blocks along the out datastructure. If recursion started with
+ * Walks Blocks along the out data structure. If recursion started with
* Start block misses control dead blocks.
*/
static void init_tmp_dom_info(ir_node *bl, tmp_dom_info *parent,
tmp_dom_info *tdi;
int i;
- assert(get_irn_op(bl) == op_Block);
+ assert(is_Block(bl));
if (get_irg_block_visited(current_ir_graph) == get_Block_block_visited(bl))
return;
mark_Block_block_visited(bl);
tdi->block = bl;
/* Iterate */
- for(i = 0; i < get_Block_n_cfg_outs(bl); i++) {
+ for (i = get_Block_n_cfg_outs(bl) - 1; i >= 0; --i) {
ir_node *pred = get_Block_cfg_out(bl, i);
- assert(get_irn_opcode(pred) == iro_Block);
+ assert(is_Block(pred));
init_tmp_dom_info(pred, tdi, tdi_list, used);
}
}
tmp_dom_info *tdi;
int i;
- assert(get_irn_op(bl) == op_Block);
+ assert(is_Block(bl));
if (get_irg_block_visited(current_ir_graph) == get_Block_block_visited(bl))
return;
mark_Block_block_visited(bl);
tdi->block = bl;
/* Iterate */
- for(i = 0; i < get_Block_n_cfgpreds(bl); i++) {
+ for (i = get_Block_n_cfgpreds(bl) - 1; i >= 0; --i) {
ir_node *pred = get_Block_cfgpred_block(bl, i);
if (is_Bad(pred))
continue;
/* Memory for temporary information. */
tdi_list = xcalloc(n_blocks, sizeof(tdi_list[0]));
- /* We need the out datastructure. */
+ /* We need the out data structure. */
if (current_ir_graph->outs_state != outs_consistent)
compute_irg_outs(current_ir_graph);
/* Step 2 */
irn_arity = get_irn_arity(w->block);
- for (j = 0; j < irn_arity; j++) {
+ for (j = 0; j < irn_arity; j++) {
ir_node *pred = get_Block_cfgpred_block(w->block, j);
tmp_dom_info *u;
if (u->semi < w->semi) w->semi = u->semi;
}
/* Add w to w->semi's bucket. w is in exactly one bucket, so
- buckets can ben implemented as linked lists. */
+ buckets can been implemented as linked lists. */
w->bucket = w->semi->bucket;
w->semi->bucket = w;
tdi_list[0].dom = NULL;
set_Block_idom(tdi_list[0].block, NULL);
set_Block_dom_depth(tdi_list[0].block, 1);
- for (i = 1; i < n_blocks; i++) {
+ for (i = 1; i < n_blocks; i++) {
tmp_dom_info *w = &tdi_list[i];
if (w->dom != w->semi) w->dom = w->dom->dom;
/* Memory for temporary information. */
tdi_list = xcalloc(n_blocks, sizeof(tdi_list[0]));
- /* We need the out datastructure. */
+ /* We need the out data structure. */
if (current_ir_graph->outs_state != outs_consistent)
compute_irg_outs(current_ir_graph);