Commit dc3b229f authored by Andreas Zwinkau's avatar Andreas Zwinkau
Browse files

Remove outs_state attribute

API change: removes set_irg_outs_inconsistent and get_irg_outs_state
Use set_irg_state and is_irg_state instead!
parent 1a9f131a
...@@ -316,8 +316,6 @@ typedef enum { ...@@ -316,8 +316,6 @@ typedef enum {
outs_inconsistent /**< Outs have been computed, memory is still allocated, outs_inconsistent /**< Outs have been computed, memory is still allocated,
but the graph has been changed since. */ but the graph has been changed since. */
} irg_outs_state; } irg_outs_state;
FIRM_API irg_outs_state get_irg_outs_state(const ir_graph *irg);
FIRM_API void set_irg_outs_inconsistent(ir_graph *irg);
/** state: extended basic block state. */ /** state: extended basic block state. */
typedef enum { typedef enum {
......
...@@ -231,8 +231,9 @@ void irg_out_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post, ...@@ -231,8 +231,9 @@ void irg_out_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
void *env) void *env)
{ {
assert(node); assert(node);
if (get_irg_outs_state(current_ir_graph) != outs_none) { ir_graph *irg = get_irn_irg(node);
inc_irg_visited (current_ir_graph); if (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS)) {
inc_irg_visited (irg);
irg_out_walk_2(node, pre, post, env); irg_out_walk_2(node, pre, post, env);
} }
} }
...@@ -450,8 +451,7 @@ void compute_irg_outs(ir_graph *irg) ...@@ -450,8 +451,7 @@ void compute_irg_outs(ir_graph *irg)
/* Update graph state */ /* Update graph state */
assert(get_irg_phase_state(current_ir_graph) != phase_building); assert(get_irg_phase_state(current_ir_graph) != phase_building);
if (current_ir_graph->outs_state != outs_none) free_irg_outs(current_ir_graph);
free_irg_outs(current_ir_graph);
/* This first iteration counts the overall number of out edges and the /* This first iteration counts the overall number of out edges and the
number of out edges for each node. */ number of out edges for each node. */
...@@ -470,13 +470,13 @@ void compute_irg_outs(ir_graph *irg) ...@@ -470,13 +470,13 @@ void compute_irg_outs(ir_graph *irg)
/* Check how much memory we have used */ /* Check how much memory we have used */
assert (end == (irg->outs + n_out_edges)); assert (end == (irg->outs + n_out_edges));
current_ir_graph->outs_state = outs_consistent; set_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
current_ir_graph = rem; current_ir_graph = rem;
} }
void assure_irg_outs(ir_graph *irg) void assure_irg_outs(ir_graph *irg)
{ {
if (get_irg_outs_state(irg) != outs_consistent) if (! is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS))
compute_irg_outs(irg); compute_irg_outs(irg);
} }
...@@ -497,7 +497,6 @@ void free_irp_outs(void) ...@@ -497,7 +497,6 @@ void free_irp_outs(void)
void free_irg_outs(ir_graph *irg) void free_irg_outs(ir_graph *irg)
{ {
/* current_ir_graph->outs_state = outs_none; */ /* current_ir_graph->outs_state = outs_none; */
irg->outs_state = outs_none;
if (irg->outs) { if (irg->outs) {
#ifdef DEBUG_libfirm #ifdef DEBUG_libfirm
......
...@@ -2319,7 +2319,7 @@ void dump_ir_graph_file(FILE *out, ir_graph *irg) ...@@ -2319,7 +2319,7 @@ void dump_ir_graph_file(FILE *out, ir_graph *irg)
/* dump the out edges in a separate walk */ /* dump the out edges in a separate walk */
if ((flags & ir_dump_flag_out_edges) if ((flags & ir_dump_flag_out_edges)
&& (get_irg_outs_state(irg) != outs_none)) { && (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS))) {
irg_out_walk(get_irg_start(irg), dump_out_edge, NULL, out); irg_out_walk(get_irg_start(irg), dump_out_edge, NULL, out);
} }
......
...@@ -114,7 +114,8 @@ void exchange(ir_node *old, ir_node *nw) ...@@ -114,7 +114,8 @@ void exchange(ir_node *old, ir_node *nw)
} }
/* update irg flags */ /* update irg flags */
set_irg_outs_inconsistent(irg); clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
set_irg_loopinfo_inconsistent(irg); set_irg_loopinfo_inconsistent(irg);
} }
......
...@@ -186,7 +186,6 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) ...@@ -186,7 +186,6 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc)
res->additional_properties = mtp_property_inherited; /* inherited from type */ res->additional_properties = mtp_property_inherited; /* inherited from type */
res->irg_pinned_state = op_pin_state_pinned; res->irg_pinned_state = op_pin_state_pinned;
res->outs_state = outs_none;
res->dom_state = dom_none; res->dom_state = dom_none;
res->pdom_state = dom_none; res->pdom_state = dom_none;
res->typeinfo_state = ir_typeinfo_none; res->typeinfo_state = ir_typeinfo_none;
...@@ -445,8 +444,7 @@ void free_ir_graph(ir_graph *irg) ...@@ -445,8 +444,7 @@ void free_ir_graph(ir_graph *irg)
edges_deactivate(irg); edges_deactivate(irg);
hook_free_graph(irg); hook_free_graph(irg);
if (irg->outs_state != outs_none) free_irg_outs(irg);
free_irg_outs(irg);
if (irg->frame_type) if (irg->frame_type)
free_type(irg->frame_type); free_type(irg->frame_type);
del_identities(irg); del_identities(irg);
...@@ -653,16 +651,6 @@ op_pin_state (get_irg_pinned)(const ir_graph *irg) ...@@ -653,16 +651,6 @@ op_pin_state (get_irg_pinned)(const ir_graph *irg)
return _get_irg_pinned(irg); return _get_irg_pinned(irg);
} }
irg_outs_state (get_irg_outs_state)(const ir_graph *irg)
{
return _get_irg_outs_state(irg);
}
void (set_irg_outs_inconsistent)(ir_graph *irg)
{
_set_irg_outs_inconsistent(irg);
}
irg_extblk_info_state (get_irg_extblk_state)(const ir_graph *irg) irg_extblk_info_state (get_irg_extblk_state)(const ir_graph *irg)
{ {
return _get_irg_extblk_state(irg); return _get_irg_extblk_state(irg);
......
...@@ -240,17 +240,6 @@ static inline op_pin_state _get_irg_pinned(const ir_graph *irg) ...@@ -240,17 +240,6 @@ static inline op_pin_state _get_irg_pinned(const ir_graph *irg)
return irg->irg_pinned_state; return irg->irg_pinned_state;
} }
static inline irg_outs_state _get_irg_outs_state(const ir_graph *irg)
{
return irg->outs_state;
}
static inline void _set_irg_outs_inconsistent(ir_graph *irg)
{
if (irg->outs_state == outs_consistent)
irg->outs_state = outs_inconsistent;
}
static inline irg_extblk_info_state _get_irg_extblk_state(const ir_graph *irg) static inline irg_extblk_info_state _get_irg_extblk_state(const ir_graph *irg)
{ {
return irg->extblk_state; return irg->extblk_state;
...@@ -278,6 +267,7 @@ static inline void _set_irg_doms_inconsistent(ir_graph *irg) ...@@ -278,6 +267,7 @@ static inline void _set_irg_doms_inconsistent(ir_graph *irg)
irg->dom_state = dom_inconsistent; irg->dom_state = dom_inconsistent;
if (irg->pdom_state != dom_none) if (irg->pdom_state != dom_none)
irg->pdom_state = dom_inconsistent; irg->pdom_state = dom_inconsistent;
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
} }
static inline irg_loopinfo_state _get_irg_loopinfo_state(const ir_graph *irg) static inline irg_loopinfo_state _get_irg_loopinfo_state(const ir_graph *irg)
...@@ -293,6 +283,7 @@ static inline void _set_irg_loopinfo_state(ir_graph *irg, irg_loopinfo_state s) ...@@ -293,6 +283,7 @@ static inline void _set_irg_loopinfo_state(ir_graph *irg, irg_loopinfo_state s)
static inline void _set_irg_loopinfo_inconsistent(ir_graph *irg) static inline void _set_irg_loopinfo_inconsistent(ir_graph *irg)
{ {
irg->loopinfo_state = (irg_loopinfo_state) (irg->loopinfo_state & ~loopinfo_valid); 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) static inline void _set_irg_pinned(ir_graph *irg, op_pin_state p)
...@@ -531,8 +522,6 @@ static inline ir_phase *irg_get_phase(const ir_graph *irg, ir_phase_id id) ...@@ -531,8 +522,6 @@ static inline ir_phase *irg_get_phase(const ir_graph *irg, ir_phase_id id)
#define get_irg_phase_state(irg) _get_irg_phase_state(irg) #define get_irg_phase_state(irg) _get_irg_phase_state(irg)
#define set_irg_phase_state(irg, state) _set_irg_phase_state(irg, state) #define set_irg_phase_state(irg, state) _set_irg_phase_state(irg, state)
#define get_irg_pinned(irg) _get_irg_pinned(irg) #define get_irg_pinned(irg) _get_irg_pinned(irg)
#define get_irg_outs_state(irg) _get_irg_outs_state(irg)
#define set_irg_outs_inconsistent(irg) _set_irg_outs_inconsistent(irg)
#define get_irg_extblk_state(irg) _get_irg_extblk_state(irg) #define get_irg_extblk_state(irg) _get_irg_extblk_state(irg)
#define set_irg_extblk_inconsistent(irg) _set_irg_extblk_inconsistent(irg) #define set_irg_extblk_inconsistent(irg) _set_irg_extblk_inconsistent(irg)
#define get_irg_dom_state(irg) _get_irg_dom_state(irg) #define get_irg_dom_state(irg) _get_irg_dom_state(irg)
......
...@@ -253,7 +253,7 @@ void set_irn_in(ir_node *node, int arity, ir_node **in) ...@@ -253,7 +253,7 @@ void set_irn_in(ir_node *node, int arity, ir_node **in)
memcpy((*pOld_in) + 1, in, sizeof(ir_node *) * arity); memcpy((*pOld_in) + 1, in, sizeof(ir_node *) * arity);
/* update irg flags */ /* update irg flags */
set_irg_outs_inconsistent(irg); clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
set_irg_loopinfo_inconsistent(irg); set_irg_loopinfo_inconsistent(irg);
} }
...@@ -279,7 +279,7 @@ void set_irn_n(ir_node *node, int n, ir_node *in) ...@@ -279,7 +279,7 @@ void set_irn_n(ir_node *node, int n, ir_node *in)
node->in[n + 1] = in; node->in[n + 1] = in;
/* update irg flags */ /* update irg flags */
set_irg_outs_inconsistent(irg); clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
set_irg_loopinfo_inconsistent(irg); set_irg_loopinfo_inconsistent(irg);
} }
...@@ -727,7 +727,7 @@ void set_End_keepalives(ir_node *end, int n, ir_node *in[]) ...@@ -727,7 +727,7 @@ void set_End_keepalives(ir_node *end, int n, ir_node *in[])
} }
/* update irg flags */ /* update irg flags */
set_irg_outs_inconsistent(irg); clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
} }
/* Set new keep-alives from old keep-alives, skipping irn */ /* Set new keep-alives from old keep-alives, skipping irn */
...@@ -765,7 +765,7 @@ found: ...@@ -765,7 +765,7 @@ found:
ARR_RESIZE(ir_node *, end->in, (n - 1) + 1 + END_KEEPALIVE_OFFSET); ARR_RESIZE(ir_node *, end->in, (n - 1) + 1 + END_KEEPALIVE_OFFSET);
/* update irg flags */ /* update irg flags */
set_irg_outs_inconsistent(irg); clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
} }
/* remove Bads, NoMems and doublets from the keep-alive set */ /* remove Bads, NoMems and doublets from the keep-alive set */
...@@ -808,7 +808,7 @@ void remove_End_Bads_and_doublets(ir_node *end) ...@@ -808,7 +808,7 @@ void remove_End_Bads_and_doublets(ir_node *end)
pset_new_destroy(&keeps); pset_new_destroy(&keeps);
if (changed) { if (changed) {
set_irg_outs_inconsistent(irg); clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
} }
} }
......
...@@ -479,7 +479,6 @@ struct ir_graph { ...@@ -479,7 +479,6 @@ struct ir_graph {
ir_graph_state_t state; ir_graph_state_t state;
irg_phase_state phase_state; /**< Compiler phase. */ irg_phase_state phase_state; /**< Compiler phase. */
op_pin_state irg_pinned_state; /**< Flag for status of nodes. */ op_pin_state irg_pinned_state; /**< Flag for status of nodes. */
irg_outs_state outs_state; /**< Out edges. */
irg_dom_state dom_state; /**< Dominator state information. */ irg_dom_state dom_state; /**< Dominator state information. */
irg_dom_state pdom_state; /**< Post Dominator state information. */ irg_dom_state pdom_state; /**< Post Dominator state information. */
ir_typeinfo_state typeinfo_state; /**< Validity of type information. */ ir_typeinfo_state typeinfo_state; /**< Validity of type information. */
...@@ -580,7 +579,7 @@ struct ir_prog { ...@@ -580,7 +579,7 @@ struct ir_prog {
/* -- states of and access to generated information -- */ /* -- states of and access to generated information -- */
irg_phase_state phase_state; /**< The state of construction. */ irg_phase_state phase_state; /**< The state of construction. */
irg_outs_state outs_state; /**< The state of out edges of ir nodes. */ irg_outs_state outs_state; /**< The state of out edges of type information. */
ir_node **ip_outedges; /**< A huge Array that contains all out edges ir_node **ip_outedges; /**< A huge Array that contains all out edges
in interprocedural view. */ in interprocedural view. */
irg_outs_state trouts_state; /**< The state of out edges of type information. */ irg_outs_state trouts_state; /**< The state of out edges of type information. */
......
...@@ -138,7 +138,7 @@ int remove_bads(ir_graph *irg) ...@@ -138,7 +138,7 @@ int remove_bads(ir_graph *irg)
if (changed) { if (changed) {
edges_deactivate(irg); edges_deactivate(irg);
set_irg_outs_inconsistent(irg); clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
} }
return changed; return changed;
......
...@@ -65,7 +65,7 @@ void remove_unreachable_blocks(ir_graph *irg) ...@@ -65,7 +65,7 @@ void remove_unreachable_blocks(ir_graph *irg)
if (changed) { if (changed) {
edges_deactivate(irg); edges_deactivate(irg);
set_irg_outs_inconsistent(irg); clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
clear_irg_state(irg, IR_GRAPH_STATE_NO_BAD_BLOCKS); clear_irg_state(irg, IR_GRAPH_STATE_NO_BAD_BLOCKS);
} }
set_irg_state(irg, IR_GRAPH_STATE_NO_UNREACHABLE_BLOCKS); set_irg_state(irg, IR_GRAPH_STATE_NO_UNREACHABLE_BLOCKS);
......
...@@ -508,7 +508,7 @@ void escape_enalysis_irg(ir_graph *irg, check_alloc_entity_func callback) ...@@ -508,7 +508,7 @@ void escape_enalysis_irg(ir_graph *irg, check_alloc_entity_func callback)
return; return;
} }
if (get_irg_outs_state(irg) != outs_consistent) if (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS))
compute_irg_outs(irg); compute_irg_outs(irg);
env.found_allocs = NULL; env.found_allocs = NULL;
......
...@@ -38,8 +38,6 @@ void perform_irg_optimization(ir_graph *irg, optdesc_t *opt) ...@@ -38,8 +38,6 @@ void perform_irg_optimization(ir_graph *irg, optdesc_t *opt)
// FIXME should not be necessary! // FIXME should not be necessary!
if (dom_inconsistent == get_irg_dom_state(irg)) if (dom_inconsistent == get_irg_dom_state(irg))
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE); clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
if (outs_inconsistent == get_irg_outs_state(irg))
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
if (loopinfo_inconsistent == get_irg_loopinfo_state(irg)) if (loopinfo_inconsistent == get_irg_loopinfo_state(irg))
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO); clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
if (ir_entity_usage_not_computed == get_irg_entity_usage_state(irg)) if (ir_entity_usage_not_computed == get_irg_entity_usage_state(irg))
...@@ -79,7 +77,7 @@ void perform_irg_optimization(ir_graph *irg, optdesc_t *opt) ...@@ -79,7 +77,7 @@ void perform_irg_optimization(ir_graph *irg, optdesc_t *opt)
INVALIDATE(IR_GRAPH_STATE_ONE_RETURN, nop) INVALIDATE(IR_GRAPH_STATE_ONE_RETURN, nop)
INVALIDATE(IR_GRAPH_STATE_CONSISTENT_DOMINANCE, set_irg_doms_inconsistent) INVALIDATE(IR_GRAPH_STATE_CONSISTENT_DOMINANCE, set_irg_doms_inconsistent)
INVALIDATE(IR_GRAPH_STATE_CONSISTENT_POSTDOMINANCE, set_irg_postdoms_inconsistent) INVALIDATE(IR_GRAPH_STATE_CONSISTENT_POSTDOMINANCE, set_irg_postdoms_inconsistent)
INVALIDATE(IR_GRAPH_STATE_CONSISTENT_OUTS, set_irg_outs_inconsistent) INVALIDATE(IR_GRAPH_STATE_CONSISTENT_OUTS, nop)
INVALIDATE(IR_GRAPH_STATE_CONSISTENT_OUT_EDGES, edges_deactivate) INVALIDATE(IR_GRAPH_STATE_CONSISTENT_OUT_EDGES, edges_deactivate)
INVALIDATE(IR_GRAPH_STATE_CONSISTENT_LOOPINFO, set_irg_loopinfo_inconsistent) INVALIDATE(IR_GRAPH_STATE_CONSISTENT_LOOPINFO, set_irg_loopinfo_inconsistent)
INVALIDATE(IR_GRAPH_STATE_CONSISTENT_ENTITY_USAGE, deactivate_entity_usage) INVALIDATE(IR_GRAPH_STATE_CONSISTENT_ENTITY_USAGE, deactivate_entity_usage)
......
Supports Markdown
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