-/**
- * Additional block info.
- */
-typedef struct block_info {
- ir_node *phi; /**< head of the Phi list */
- int has_pinned; /**< set if the block contains instructions that cannot be moved */
-} block_info;
-
-/** Returns the additional block info of a block. */
-static INLINE block_info* get_block_blockinfo(const ir_node* block) {
- return get_irn_link(block);
-}
-
-
ir_node* pred_block = get_nodes_block(get_irn_n(block, i));
int arity = get_irn_arity(block);
int new_pred_arity;
ir_node* pred_block = get_nodes_block(get_irn_n(block, i));
int arity = get_irn_arity(block);
int new_pred_arity;
ir_node* copy = copy_to(get_irn_n(phi, i), pred_block, j);
for (k = 0; k < i; ++k) ins[k] = get_irn_n(phi, k);
ir_node* copy = copy_to(get_irn_n(phi, i), pred_block, j);
for (k = 0; k < i; ++k) ins[k] = get_irn_n(phi, k);
new_pred_arity = get_irn_arity(pred_block) - 1;
NEW_ARR_A(ir_node*, pred_ins, new_pred_arity);
new_pred_arity = get_irn_arity(pred_block) - 1;
NEW_ARR_A(ir_node*, pred_ins, new_pred_arity);
for (k = 0; k < j; ++k) pred_ins[k] = get_irn_n(phi, k);
for (; k < new_pred_arity; ++k) pred_ins[k] = get_irn_n(phi, k + 1);
assert(k == new_pred_arity);
for (k = 0; k < j; ++k) pred_ins[k] = get_irn_n(phi, k);
for (; k < new_pred_arity; ++k) pred_ins[k] = get_irn_n(phi, k + 1);
assert(k == new_pred_arity);
if (new_pred_arity > 1) {
set_irn_in(phi, new_pred_arity, pred_ins);
} else {
if (new_pred_arity > 1) {
set_irn_in(phi, new_pred_arity, pred_ins);
} else {
for (cdep = find_cdep(pred0); cdep != NULL; cdep = cdep->next) {
const ir_node* dependency = cdep->node;
ir_node* projx0 = walk_to_projx(pred0, dependency);
for (cdep = find_cdep(pred0); cdep != NULL; cdep = cdep->next) {
const ir_node* dependency = cdep->node;
ir_node* projx0 = walk_to_projx(pred0, dependency);
if (!opt_info->allow_ifconv(get_Cond_selector(cond), phi, i, j)) continue;
DB((dbg, LEVEL_1, "Found Cond %+F with proj %+F and %+F\n",
if (!opt_info->allow_ifconv(get_Cond_selector(cond), phi, i, j)) continue;
DB((dbg, LEVEL_1, "Found Cond %+F with proj %+F and %+F\n",
DB((dbg, LEVEL_2, "Generating %+F for %+F\n", psi, phi));
}
DB((dbg, LEVEL_2, "Generating %+F for %+F\n", psi, phi));
}
#if 1
DB((dbg, LEVEL_1, "Welding block %+F and %+F\n", block, psi_block));
/* copy the block-info from the Psi-block to the block before merging */
#if 1
DB((dbg, LEVEL_1, "Welding block %+F and %+F\n", block, psi_block));
/* copy the block-info from the Psi-block to the block before merging */
- get_block_blockinfo(psi_block)->has_pinned |= get_block_blockinfo(block)->has_pinned;
- set_irn_link(block, get_irn_link(psi_block));
+
+ mark = get_Block_mark(psi_block) | get_Block_mark(block);
+ set_Block_mark(block, mark);
+ set_Block_phis(block, get_Block_phis(psi_block));
set_irn_in(block, get_irn_arity(psi_block), get_irn_in(psi_block) + 1);
exchange_cdep(psi_block, block);
exchange(psi_block, block);
#else
DB((dbg, LEVEL_1, "Welding block %+F to %+F\n", block, psi_block));
set_irn_in(block, get_irn_arity(psi_block), get_irn_in(psi_block) + 1);
exchange_cdep(psi_block, block);
exchange(psi_block, block);
#else
DB((dbg, LEVEL_1, "Welding block %+F to %+F\n", block, psi_block));
- get_block_blockinfo(psi_block)->has_pinned |= get_block_blockinfo(block)->has_pinned;
+ mark = get_Block_mark(psi_block) | get_Block_mark(block);
+ /* mark both block just to be sure, should be enough to mark psi_block */
+ set_Block_mark(psi_block, mark);
- struct obstack *obst = env;
- block_info *bi = obstack_alloc(obst, sizeof(*bi));
-
- bi->phi = NULL;
- bi->has_pinned = 0;
- set_irn_link(block, bi);
+ (void)env;
+ set_Block_mark(block, 0);
+ set_Block_phis(block, NULL);
DB((dbg, LEVEL_2, "Node %+F in block %+F is unmovable\n", node, block));
DB((dbg, LEVEL_2, "Node %+F in block %+F is unmovable\n", node, block));
- obstack_init(&obst);
- irg_block_walk_graph(irg, init_block_link, NULL, &obst);
+ irg_block_walk_graph(irg, init_block_link, NULL, NULL);
irg_walk_graph(irg, collect_phis, NULL, NULL);
irg_block_walk_graph(irg, NULL, if_conv_walker, &p);
irg_walk_graph(irg, collect_phis, NULL, NULL);
irg_block_walk_graph(irg, NULL, if_conv_walker, &p);
irg_walk_graph(irg, NULL, optimise_psis_1, NULL);
#endif
irg_walk_graph(irg, NULL, optimise_psis_1, NULL);
#endif
/* TODO: graph might be changed, handle more graceful */
set_irg_outs_inconsistent(irg);
set_irg_extblk_inconsistent(irg);
/* TODO: graph might be changed, handle more graceful */
set_irg_outs_inconsistent(irg);
set_irg_extblk_inconsistent(irg);