Remove outs_state attribute
authorAndreas Zwinkau <zwinkau@kit.edu>
Tue, 13 Sep 2011 11:08:17 +0000 (13:08 +0200)
committerAndreas Zwinkau <zwinkau@kit.edu>
Wed, 14 Sep 2011 10:42:34 +0000 (12:42 +0200)
API change: removes set_irg_outs_inconsistent and get_irg_outs_state
Use set_irg_state and is_irg_state instead!

12 files changed:
include/libfirm/irgraph.h
ir/ana/irouts.c
ir/ir/irdump.c
ir/ir/irgmod.c
ir/ir/irgraph.c
ir/ir/irgraph_t.h
ir/ir/irnode.c
ir/ir/irtypes.h
ir/ir/rm_bads.c
ir/ir/unreachable.c
ir/opt/escape_ana.c
ir/opt/opt_manage.c

index 89420a9..9442814 100644 (file)
@@ -316,8 +316,6 @@ typedef enum {
        outs_inconsistent  /**< Outs have been computed, memory is still allocated,
                                but the graph has been changed since. */
 } 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. */
 typedef enum {
index d2ff583..092963a 100644 (file)
@@ -231,8 +231,9 @@ void irg_out_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
                   void *env)
 {
        assert(node);
-       if (get_irg_outs_state(current_ir_graph) != outs_none) {
-               inc_irg_visited (current_ir_graph);
+       ir_graph *irg = get_irn_irg(node);
+       if (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS)) {
+               inc_irg_visited (irg);
                irg_out_walk_2(node, pre, post, env);
        }
 }
@@ -450,8 +451,7 @@ void compute_irg_outs(ir_graph *irg)
        /* Update graph state */
        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
           number of out edges for each node. */
@@ -470,13 +470,13 @@ void compute_irg_outs(ir_graph *irg)
        /* Check how much memory we have used */
        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;
 }
 
 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);
 }
 
@@ -497,7 +497,6 @@ void free_irp_outs(void)
 void free_irg_outs(ir_graph *irg)
 {
        /*   current_ir_graph->outs_state = outs_none; */
-       irg->outs_state = outs_none;
 
        if (irg->outs) {
 #ifdef DEBUG_libfirm
index b2ab4c6..6b0a41d 100644 (file)
@@ -2319,7 +2319,7 @@ void dump_ir_graph_file(FILE *out, ir_graph *irg)
 
        /* dump the out edges in a separate walk */
        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);
        }
 
index 4ae20bb..3448630 100644 (file)
@@ -114,7 +114,8 @@ void exchange(ir_node *old, ir_node *nw)
        }
 
        /* 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);
 }
 
index 423eed1..7dc3eca 100644 (file)
@@ -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->irg_pinned_state    = op_pin_state_pinned;
-       res->outs_state          = outs_none;
        res->dom_state           = dom_none;
        res->pdom_state          = dom_none;
        res->typeinfo_state      = ir_typeinfo_none;
@@ -445,8 +444,7 @@ void free_ir_graph(ir_graph *irg)
        edges_deactivate(irg);
 
        hook_free_graph(irg);
-       if (irg->outs_state != outs_none)
-               free_irg_outs(irg);
+       free_irg_outs(irg);
        if (irg->frame_type)
                free_type(irg->frame_type);
        del_identities(irg);
@@ -653,16 +651,6 @@ op_pin_state (get_irg_pinned)(const ir_graph *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)
 {
        return _get_irg_extblk_state(irg);
index b431f06..83c534e 100644 (file)
@@ -240,17 +240,6 @@ static inline op_pin_state _get_irg_pinned(const ir_graph *irg)
        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)
 {
        return irg->extblk_state;
@@ -278,6 +267,7 @@ static inline void _set_irg_doms_inconsistent(ir_graph *irg)
                irg->dom_state = dom_inconsistent;
        if (irg->pdom_state != dom_none)
                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)
@@ -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)
 {
        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)
@@ -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 set_irg_phase_state(irg, state)       _set_irg_phase_state(irg, state)
 #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 set_irg_extblk_inconsistent(irg)      _set_irg_extblk_inconsistent(irg)
 #define get_irg_dom_state(irg)                _get_irg_dom_state(irg)
index 9086fcf..28a7dfb 100644 (file)
@@ -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);
 
        /* update irg flags */
-       set_irg_outs_inconsistent(irg);
+       clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
        set_irg_loopinfo_inconsistent(irg);
 }
 
@@ -279,7 +279,7 @@ void set_irn_n(ir_node *node, int n, ir_node *in)
        node->in[n + 1] = in;
 
        /* update irg flags */
-       set_irg_outs_inconsistent(irg);
+       clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
        set_irg_loopinfo_inconsistent(irg);
 }
 
@@ -727,7 +727,7 @@ void set_End_keepalives(ir_node *end, int n, ir_node *in[])
        }
 
        /* 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 */
@@ -765,7 +765,7 @@ found:
        ARR_RESIZE(ir_node *, end->in, (n - 1) + 1 + END_KEEPALIVE_OFFSET);
 
        /* 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 */
@@ -808,7 +808,7 @@ void remove_End_Bads_and_doublets(ir_node *end)
        pset_new_destroy(&keeps);
 
        if (changed) {
-               set_irg_outs_inconsistent(irg);
+               clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
        }
 }
 
index 081d7c6..98a5569 100644 (file)
@@ -479,7 +479,6 @@ struct ir_graph {
        ir_graph_state_t      state;
        irg_phase_state       phase_state;       /**< Compiler phase. */
        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         pdom_state;        /**< Post Dominator state information. */
        ir_typeinfo_state     typeinfo_state;    /**< Validity of type information. */
@@ -580,7 +579,7 @@ struct ir_prog {
        /* -- states of and access to generated information -- */
        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
                                             in interprocedural view. */
        irg_outs_state trouts_state;    /**< The state of out edges of type information. */
index 5cb6a82..efabee8 100644 (file)
@@ -138,7 +138,7 @@ int remove_bads(ir_graph *irg)
 
        if (changed) {
                edges_deactivate(irg);
-               set_irg_outs_inconsistent(irg);
+               clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
        }
 
        return changed;
index 15692ec..3f99963 100644 (file)
@@ -65,7 +65,7 @@ void remove_unreachable_blocks(ir_graph *irg)
 
        if (changed) {
                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);
        }
        set_irg_state(irg, IR_GRAPH_STATE_NO_UNREACHABLE_BLOCKS);
index 50bf3a9..977c1e0 100644 (file)
@@ -508,7 +508,7 @@ void escape_enalysis_irg(ir_graph *irg, check_alloc_entity_func callback)
                return;
        }
 
-       if (get_irg_outs_state(irg) != outs_consistent)
+       if (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS))
                compute_irg_outs(irg);
 
        env.found_allocs = NULL;
index a16081b..65dc4f2 100644 (file)
@@ -38,8 +38,6 @@ void perform_irg_optimization(ir_graph *irg, optdesc_t *opt)
        // FIXME should not be necessary!
        if (dom_inconsistent == get_irg_dom_state(irg))
                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))
                clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
        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)
        INVALIDATE(IR_GRAPH_STATE_ONE_RETURN,               nop)
        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_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_LOOPINFO,      set_irg_loopinfo_inconsistent)
        INVALIDATE(IR_GRAPH_STATE_CONSISTENT_ENTITY_USAGE,  deactivate_entity_usage)