Commit 3bb47464 authored by Matthias Braun's avatar Matthias Braun
Browse files

remove loopinfo stuff and exclusively use IR_GRAPH_STATE_CONSISTENT_LOOPINFO

parent 4ebb78a2
......@@ -326,52 +326,6 @@ typedef enum {
FIRM_API irg_extblk_info_state get_irg_extblk_state(const ir_graph *irg);
FIRM_API void set_irg_extblk_inconsistent(ir_graph *irg);
/** state: loopinfo_state
* Loop information describes the loops within the control and
* data flow of the procedure.
*/
typedef enum {
loopinfo_none = 0, /**< No loop information is constructed. Default. */
loopinfo_constructed = 1, /**< Some kind of loop information is constructed. */
loopinfo_valid = 2, /**< Loop information is valid. */
loopinfo_cf = 4, /**< Loop information constructed for control flow only. */
loopinfo_inter = 8, /**< Loop information for interprocedural view. */
/** IntRAprocedural loop information constructed and valid. */
loopinfo_consistent = loopinfo_constructed | loopinfo_valid,
/** IntRAprocedural loop information constructed and invalid. */
loopinfo_inconsistent = loopinfo_constructed,
/** IntERprocedural loop information constructed and valid. */
loopinfo_ip_consistent = loopinfo_constructed | loopinfo_inter | loopinfo_valid,
/** IntERprocedural loop information constructed and invalid. */
loopinfo_ip_inconsistent = loopinfo_constructed | loopinfo_inter,
/** IntRAprocedural control loop information constructed and valid. */
loopinfo_cf_consistent = loopinfo_constructed | loopinfo_cf | loopinfo_valid,
/** IntRAprocedural control loop information constructed and invalid. */
loopinfo_cf_inconsistent = loopinfo_constructed | loopinfo_cf,
/** IntERprocedural control loop information constructed and valid. */
loopinfo_cf_ip_consistent = loopinfo_constructed | loopinfo_cf | loopinfo_inter | loopinfo_valid,
/** IntERprocedural control loop information constructed and invalid. */
loopinfo_cf_ip_inconsistent = loopinfo_constructed | loopinfo_cf | loopinfo_inter
} irg_loopinfo_state;
/** Return the current loop information state. */
FIRM_API irg_loopinfo_state get_irg_loopinfo_state(const ir_graph *irg);
/** Sets the current loop information state. */
FIRM_API void set_irg_loopinfo_state(ir_graph *irg, irg_loopinfo_state s);
/** Sets the loop information state to the appropriate inconsistent state.
* If state is 'none' does not change. */
FIRM_API void set_irg_loopinfo_inconsistent(ir_graph *irg);
/** Sets the loop information state to the appropriate inconsistent state.
* If state is 'none' does not change.
* Does this for all irgs. */
FIRM_API void set_irp_loopinfo_inconsistent(void);
/** state: callee_information_state
* Call nodes contain a list of possible callees. This list must be
* computed by an analysis.
......
......@@ -169,7 +169,7 @@ FIRM_API int construct_cf_backedges(ir_graph *irg);
*
* @param irg the graph
*/
FIRM_API void assure_cf_loop(ir_graph *irg);
FIRM_API void assure_loopinfo(ir_graph *irg);
/**
* Removes all loop information.
......
......@@ -652,17 +652,15 @@ int construct_cf_backedges(ir_graph *irg)
assert(head_rem == current_loop);
mature_loops(current_loop, irg->obst);
set_irg_loop(irg, current_loop);
set_irg_loopinfo_state(irg, loopinfo_cf_consistent);
assert(get_irg_loop(irg)->kind == k_ir_loop);
set_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
current_ir_graph = rem;
return max_loop_depth;
}
void assure_cf_loop(ir_graph *irg)
void assure_loopinfo(ir_graph *irg)
{
irg_loopinfo_state state = get_irg_loopinfo_state(irg);
if (state != loopinfo_cf_consistent)
construct_cf_backedges(irg);
if (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO))
return;
construct_cf_backedges(irg);
}
......@@ -776,7 +776,7 @@ int construct_backedges(ir_graph *irg)
assert(head_rem == current_loop);
mature_loops(current_loop, irg->obst);
set_irg_loop(irg, current_loop);
set_irg_loopinfo_state(irg, loopinfo_consistent);
set_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
assert(get_irg_loop(irg)->kind == k_ir_loop);
current_ir_graph = rem;
return max_loop_depth;
......@@ -820,7 +820,7 @@ void free_loop_information(ir_graph *irg)
*/
irg_walk_graph(irg, loop_reset_node, NULL, NULL);
set_irg_loop(irg, NULL);
set_irg_loopinfo_state(current_ir_graph, loopinfo_none);
clear_irg_state(current_ir_graph, IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
/* We cannot free the loop nodes, they are on the obstack. */
}
......
......@@ -498,10 +498,7 @@ static ir_node **create_block_schedule_greedy(ir_graph *irg, ir_exec_freq *execf
env.worklist = NULL;
env.blockcount = 0;
/* make sure loopinfo is up-to-date */
if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
construct_cf_backedges(irg);
}
assure_loopinfo(irg);
// collect edge execution frequencies
irg_block_walk_graph(irg, collect_egde_frequency, NULL, &env);
......
......@@ -166,10 +166,7 @@ be_loopana_t *be_new_loop_pressure_cls(ir_graph *irg,
DBG((dbg, LEVEL_1, " Computing register pressure for class %s:\n", cls->name));
DBG((dbg, LEVEL_1, "=====================================================\n", cls->name));
/* construct control flow loop tree */
if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
construct_cf_backedges(irg);
}
assure_loopinfo(irg);
be_compute_loop_pressure(loop_ana, get_irg_loop(irg), cls);
......@@ -192,10 +189,7 @@ be_loopana_t *be_new_loop_pressure(ir_graph *irg,
loop_ana->data = new_set(cmp_loop_info, 16);
loop_ana->irg = irg;
/* construct control flow loop tree */
if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
construct_cf_backedges(irg);
}
assure_loopinfo(irg);
if (cls != NULL) {
be_compute_loop_pressure(loop_ana, irg_loop, cls);
......
......@@ -948,10 +948,7 @@ static void be_spill_belady(ir_graph *irg, const arch_register_class_t *rcls)
be_liveness_assure_sets(be_assure_liveness(irg));
stat_ev_tim_push();
/* construct control flow loop tree */
if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
construct_cf_backedges(irg);
}
assure_loopinfo(irg);
stat_ev_tim_pop("belady_time_backedges");
stat_ev_tim_push();
......
......@@ -529,10 +529,7 @@ void be_assure_state(ir_graph *irg, const arch_register_t *reg, void *func_env,
be_lv_t *lv = be_assure_liveness(irg);
be_liveness_assure_sets(lv);
/* construct control flow loop tree */
if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
construct_cf_backedges(irg);
}
assure_loopinfo(irg);
obstack_init(&env.obst);
env.reg = reg;
......
......@@ -1608,7 +1608,7 @@ static void dump_block_graph(FILE *F, ir_graph *irg)
dump_ir_edges(node, F);
}
if ((flags & ir_dump_flag_loops) && (get_irg_loopinfo_state(irg) & loopinfo_valid))
if (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO))
dump_loop_nodes_into_graph(F, irg);
current_ir_graph = rem;
......@@ -2229,7 +2229,7 @@ static void dump_extblock_graph(FILE *F, ir_graph *irg)
}
if ((flags & ir_dump_flag_loops)
&& (get_irg_loopinfo_state(irg) & loopinfo_valid))
&& (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO)))
dump_loop_nodes_into_graph(F, irg);
current_ir_graph = rem;
......
......@@ -123,7 +123,7 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
}
/* Loop node. Someone else please tell me what's wrong ... */
if (get_irg_loopinfo_state(irg) & loopinfo_valid) {
if (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO)) {
ir_loop *loop = get_irn_loop(n);
if (loop != NULL) {
fprintf(F, " in loop %ld with depth %u\n",
......
......@@ -114,9 +114,8 @@ void exchange(ir_node *old, ir_node *nw)
}
/* update irg flags */
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
set_irg_loopinfo_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS
| IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
}
/*--------------------------------------------------------------------*/
......
......@@ -189,7 +189,6 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc)
res->typeinfo_state = ir_typeinfo_none;
set_irp_typeinfo_inconsistent(); /* there is a new graph with typeinfo_none. */
res->callee_info_state = irg_callee_info_none;
res->loopinfo_state = loopinfo_none;
res->class_cast_state = ir_class_casts_transitive;
res->extblk_state = ir_extblk_info_none;
res->execfreq_state = exec_freq_none;
......@@ -658,31 +657,6 @@ void (set_irg_extblk_inconsistent)(ir_graph *irg)
_set_irg_extblk_inconsistent(irg);
}
irg_loopinfo_state (get_irg_loopinfo_state)(const ir_graph *irg)
{
return _get_irg_loopinfo_state(irg);
}
void (set_irg_loopinfo_state)(ir_graph *irg, irg_loopinfo_state s)
{
_set_irg_loopinfo_state(irg, s);
}
void (set_irg_loopinfo_inconsistent)(ir_graph *irg)
{
_set_irg_loopinfo_inconsistent(irg);
}
void set_irp_loopinfo_inconsistent(void)
{
size_t i, n;
for (i = 0, n = get_irp_n_irgs(); i < n; ++i) {
set_irg_loopinfo_inconsistent(get_irp_irg(i));
}
}
void (set_irg_pinned)(ir_graph *irg, op_pin_state p)
{
_set_irg_pinned(irg, p);
......
......@@ -251,22 +251,6 @@ static inline void _set_irg_extblk_inconsistent(ir_graph *irg)
irg->extblk_state = ir_extblk_info_invalid;
}
static inline irg_loopinfo_state _get_irg_loopinfo_state(const ir_graph *irg)
{
return irg->loopinfo_state;
}
static inline void _set_irg_loopinfo_state(ir_graph *irg, irg_loopinfo_state s)
{
irg->loopinfo_state = s;
}
static inline void _set_irg_loopinfo_inconsistent(ir_graph *irg)
{
irg->loopinfo_state = (irg_loopinfo_state) (irg->loopinfo_state & ~loopinfo_valid);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
}
static inline void _set_irg_pinned(ir_graph *irg, op_pin_state p)
{
irg->irg_pinned_state = p;
......@@ -505,9 +489,6 @@ static inline ir_phase *irg_get_phase(const ir_graph *irg, ir_phase_id id)
#define get_irg_pinned(irg) _get_irg_pinned(irg)
#define get_irg_extblk_state(irg) _get_irg_extblk_state(irg)
#define set_irg_extblk_inconsistent(irg) _set_irg_extblk_inconsistent(irg)
#define get_irg_loopinfo_state(irg) _get_irg_loopinfo_state(irg)
#define set_irg_loopinfo_state(irg, s) _set_irg_loopinfo_state(irg, s)
#define set_irg_loopinfo_inconsistent(irg) _set_irg_loopinfo_inconsistent(irg)
#define set_irg_pinned(irg, p) _set_irg_pinned(irg, p)
#define get_irg_callee_info_state(irg) _get_irg_callee_info_state(irg)
#define set_irg_callee_info_state(irg, s) _set_irg_callee_info_state(irg, s)
......
......@@ -253,8 +253,7 @@ void set_irn_in(ir_node *node, int arity, ir_node **in)
memcpy((*pOld_in) + 1, in, sizeof(ir_node *) * arity);
/* update irg flags */
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
set_irg_loopinfo_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS | IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
}
ir_node *(get_irn_n)(const ir_node *node, int n)
......@@ -279,8 +278,7 @@ void set_irn_n(ir_node *node, int n, ir_node *in)
node->in[n + 1] = in;
/* update irg flags */
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
set_irg_loopinfo_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS | IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
}
int add_irn_n(ir_node *node, ir_node *in)
......
......@@ -481,7 +481,6 @@ struct ir_graph {
op_pin_state irg_pinned_state; /**< Flag for status of nodes. */
ir_typeinfo_state typeinfo_state; /**< Validity of type information. */
irg_callee_info_state callee_info_state; /**< Validity of callee information. */
irg_loopinfo_state loopinfo_state; /**< State of loop information. */
ir_class_cast_state class_cast_state; /**< Kind of cast operations in code. */
irg_extblk_info_state extblk_state; /**< State of extended basic block info. */
exec_freq_state execfreq_state; /**< Execution frequency state. */
......
......@@ -868,7 +868,7 @@ static ir_graph_state_t do_fixpoint_vrp(ir_graph* const irg)
optdesc_t opt_fpvrp = {
"fp-vrp",
IR_GRAPH_STATE_NO_BAD_BLOCKS | IR_GRAPH_STATE_NO_UNREACHABLE_CODE | IR_GRAPH_STATE_CONSISTENT_DOMINANCE | IR_GRAPH_STATE_CONSISTENT_OUT_EDGES,
IR_GRAPH_STATE_NO_BADS | IR_GRAPH_STATE_NO_UNREACHABLE_CODE | IR_GRAPH_STATE_CONSISTENT_DOMINANCE | IR_GRAPH_STATE_CONSISTENT_OUT_EDGES,
do_fixpoint_vrp,
};
......
......@@ -238,12 +238,10 @@ static void fix_const_call_lists(ir_graph *irg, env_t *ctx)
}
}
/* changes were done ... */
set_irg_loopinfo_state(irg, loopinfo_cf_inconsistent);
if (exc_changed) {
/* ... including exception edges */
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE
| IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
}
} /* fix_const_call_list */
......@@ -373,11 +371,10 @@ static void fix_nothrow_call_list(ir_graph *irg, ir_node *call_list, ir_node *pr
}
/* changes were done ... */
set_irg_loopinfo_state(irg, loopinfo_cf_inconsistent);
if (exc_changed) {
/* ... including exception edges */
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE
| IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
}
} /* fix_nothrow_call_list */
......@@ -985,7 +982,7 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top)
static void check_for_possible_endless_loops(ir_graph *irg)
{
ir_loop *root_loop;
assure_cf_loop(irg);
assure_loopinfo(irg);
root_loop = get_irg_loop(irg);
if (root_loop->flags & loop_outer_loop)
......
......@@ -499,7 +499,7 @@ static ir_graph_state_t do_ifconv(ir_graph *irg)
optdesc_t opt_ifconv = {
"if-conversion",
IR_GRAPH_STATE_NO_CRITICAL_EDGES | IR_GRAPH_STATE_NO_UNREACHABLE_CODE | IR_GRAPH_STATE_NO_BAD_BLOCKS | IR_GRAPH_STATE_ONE_RETURN,
IR_GRAPH_STATE_NO_CRITICAL_EDGES | IR_GRAPH_STATE_NO_UNREACHABLE_CODE | IR_GRAPH_STATE_NO_BADS | IR_GRAPH_STATE_ONE_RETURN,
do_ifconv,
};
......
......@@ -2296,7 +2296,7 @@ static ir_graph_state_t do_loadstore_opt(ir_graph *irg)
}
if (!(env.changes & CF_CHANGED)) {
res |= IR_GRAPH_STATE_CONSISTENT_DOMINANCE | IR_GRAPH_STATE_NO_BAD_BLOCKS;
res |= IR_GRAPH_STATE_CONSISTENT_DOMINANCE | IR_GRAPH_STATE_NO_BADS;
}
return res;
......
......@@ -1355,8 +1355,8 @@ static void loop_inversion(ir_graph *irg)
DEL_ARR_F(cur_head_outs);
/* Duplicated blocks changed doms */
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
set_irg_loopinfo_state(irg, loopinfo_cf_inconsistent);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE
| IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
++stats.inverted;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment