{
int i;
ir_node *new_block;
- merge_env *env = ctx;
+ merge_env *env = (merge_env*)ctx;
/* clear the link field for ALL nodes first */
set_irn_link(node, NULL);
}
/* normally, we would create a Bad block here, but this must be
- * prevented, so just set it's cf to Bad.
+ * prevented, so just set its cf to Bad.
*/
if (is_Block_dead(new_block)) {
ir_graph *irg = get_irn_irg(node);
static void remove_unreachable_blocks_and_conds(ir_node *block, void *env)
{
int i;
- int *changed = env;
+ int *changed = (int*)env;
/* Check block predecessors and turn control flow into bad.
Beware of Tuple, kill them. */
*/
static void collect_nodes(ir_node *n, void *ctx)
{
- ir_opcode code = get_irn_opcode(n);
- merge_env *env = ctx;
+ unsigned code = get_irn_opcode(n);
+ merge_env *env = (merge_env*)ctx;
if (code == iro_Block) {
/* mark the block as non-removable if it is labeled */
int i, j, k, n, max_preds, n_preds, p_preds = -1;
ir_node *pred, *phi, *next;
ir_node **in;
- merge_env *env = ctx;
+ merge_env *env = (merge_env*)ctx;
/* Count the number of predecessor if this block is merged with pred blocks
that are empty. */
in = XMALLOCN(ir_node*, max_preds);
/*- Fix the Phi nodes of the current block -*/
- for (phi = get_irn_link(b); phi != NULL; phi = next) {
+ for (phi = (ir_node*)get_irn_link(b); phi != NULL; phi = (ir_node*)next) {
assert(is_Phi(phi));
- next = get_irn_link(phi);
+ next = (ir_node*)get_irn_link(phi);
/* Find the new predecessors for the Phi */
p_preds = 0;
ir_node *next_phi;
/* we found a predecessor block at position k that will be removed */
- for (phi = get_irn_link(predb); phi; phi = next_phi) {
+ for (phi = (ir_node*)get_irn_link(predb); phi; phi = next_phi) {
int q_preds = 0;
- next_phi = get_irn_link(phi);
+ next_phi = (ir_node*)get_irn_link(phi);
assert(is_Phi(phi));
*/
static void remove_simple_blocks(ir_node *block, void *ctx)
{
- ir_node *new_blk = equivalent_node(block);
- merge_env *env = ctx;
+ merge_env *env = (merge_env*)ctx;
+ ir_node *new_blk = equivalent_node(block);
if (new_blk != block) {
exchange(block, new_blk);
{
ir_node *sel = get_Cond_selector(cond);
- ir_node *proj1 = get_irn_link(cond);
- ir_node *proj2 = get_irn_link(proj1);
+ ir_node *proj1 = (ir_node*)get_irn_link(cond);
+ ir_node *proj2 = (ir_node*)get_irn_link(proj1);
ir_node *jmp, *blk;
blk = get_nodes_block(cond);
} else if (get_irn_link(proj2) == NULL) {
/* We have two Proj's here. Check if the Cond has
a constant argument */
- tarval *tv = value_of(sel);
+ ir_tarval *tv = value_of(sel);
if (tv != tarval_bad) {
/* we have a constant switch */
int i, j, n, changed;
ir_node **in = NULL;
ir_node *cond, *end = get_irg_end(irg);
- ir_graph *rem = current_ir_graph;
plist_element_t *el;
merge_env env;
assert(get_irg_pinned(irg) != op_pin_state_floats &&
"Control flow optimization need a pinned graph");
- current_ir_graph = irg;
-
/* FIXME: control flow opt destroys block edges. So edges are deactivated here. Fix the edges! */
edges_deactivate(irg);
/* handle all collected switch-Conds */
foreach_plist(env.list, el) {
- cond = plist_element_get_value(el);
+ cond = (ir_node*)plist_element_get_value(el);
env.changed |= handle_switch_cond(cond);
}
plist_free(env.list);
fprintf(stderr, "VERIFY_BAD in optimize_cf()\n");
}
}
-
- current_ir_graph = rem;
}
/* Creates an ir_graph pass for optimize_cf. */