/** A scc. */
typedef struct scc {
- ir_node *head; /**< the head of the list */
- tarval *init; /**< the init value iff only one exists. */
- tarval *incr; /**< the induction variable increment if only a single const exists. */
- unsigned code; /**< == iro_Add if +incr, iro_Sub if -incr, 0 if not analysed, iro_Bad else */
+ ir_node *head; /**< the head of the list */
+ ir_tarval *init; /**< the init value iff only one exists. */
+ ir_tarval *incr; /**< the induction variable increment if only a single const exists. */
+ unsigned code; /**< == iro_Add if +incr, iro_Sub if -incr, 0 if not analysed, iro_Bad else */
} scc;
/** A node entry */
* There might be more than one edge here. This is rather bad
* because we currently store only one.
*/
-// assert(LFTR_find(src, env) == NULL);
set_insert(env->lftr_edges, &key, sizeof(key), HASH_PTR(src));
} /* LFTR_add */
if (result != irn) {
node_entry *e;
- hook_strength_red(current_ir_graph, irn);
+ hook_strength_red(get_irn_irg(irn), irn);
exchange(irn, result);
e = get_irn_ne(result, env);
if (e->pscc == NULL) {
/* normalization put constants on the right side */
rc = get_Mul_right(mul);
if (is_Const(rc)) {
- tarval *tv = get_Const_tarval(rc);
+ ir_tarval *tv = get_Const_tarval(rc);
if (tarval_is_long(tv)) {
long value = get_tarval_long(tv);
*/
static void do_dfs(ir_graph *irg, iv_env *env)
{
- ir_graph *rem = current_ir_graph;
ir_node *end = get_irg_end(irg);
int i;
ir_reserve_resources(irg, IR_RESOURCE_IRN_VISITED);
- current_ir_graph = irg;
inc_irg_visited(irg);
/* visit all visible nodes */
}
ir_free_resources(irg, IR_RESOURCE_IRN_VISITED);
-
- current_ir_graph = rem;
} /* do_dfs */
/**
static ir_node *applyOneEdge(ir_node *iv, ir_node *rc, LFTR_edge *e, iv_env *env)
{
if (env->osr_flags & osr_flag_lftr_with_ov_check) {
- tarval *tv_l, *tv_r, *tv, *tv_init, *tv_incr, *tv_end;
+ ir_tarval *tv_l, *tv_r, *tv, *tv_init, *tv_incr, *tv_end;
tarval_int_overflow_mode_t ovmode;
scc *pscc;
+ ir_graph *irg;
if (! is_counter_iv(iv, env)) {
DB((dbg, LEVEL_4, " not counter IV"));
DB((dbg, LEVEL_4, " = OVERFLOW"));
return NULL;
}
- return new_Const(tv);
+ irg = get_irn_irg(iv);
+ return new_r_Const(irg, tv);
}
return do_apply(e->code, NULL, rc, e->rc, get_irn_mode(e->dst));
} /* applyOneEdge */
/* Remove any Phi cycles with only one real input. */
void remove_phi_cycles(ir_graph *irg)
{
- iv_env env;
- ir_graph *rem;
- int projs_moved;
-
- rem = current_ir_graph;
- current_ir_graph = irg;
+ iv_env env;
+ int projs_moved;
FIRM_DBG_REGISTER(dbg, "firm.opt.remove_phi");
DEL_ARR_F(env.stack);
obstack_free(&env.obst, NULL);
-
- current_ir_graph = rem;
} /* remove_phi_cycles */
ir_graph_pass_t *remove_phi_cycles_pass(const char *name)
void opt_osr(ir_graph *irg, unsigned flags)
{
iv_env env;
- ir_graph *rem;
int edges;
int projs_moved;
- rem = current_ir_graph;
- current_ir_graph = irg;
-
FIRM_DBG_REGISTER(dbg, "firm.opt.osr");
DB((dbg, LEVEL_1, "Doing Operator Strength Reduction for %+F\n", irg));
if (! edges)
edges_deactivate(irg);
-
- current_ir_graph = rem;
} /* opt_osr */
struct pass_t {