irlivechk: remove need to pass in a DFS structure
authorMatthias Braun <matze@braunis.de>
Tue, 20 Dec 2011 17:10:43 +0000 (18:10 +0100)
committerMatthias Braun <matze@braunis.de>
Wed, 21 Dec 2011 17:21:21 +0000 (18:21 +0100)
ir/ana/irlivechk.c
ir/ana/irlivechk.h
ir/be/belive.c
ir/be/belive_t.h

index 42fea52..b64b42d 100644 (file)
@@ -75,7 +75,7 @@ typedef struct bl_info_t {
 struct lv_chk_t {
        ir_nodemap     block_infos;
        struct obstack obst;
-       const dfs_t   *dfs;
+       dfs_t         *dfs;
        int            n_blocks;
        bitset_t      *back_edge_src;
        bitset_t      *back_edge_tgt;
@@ -240,7 +240,7 @@ static inline void compute_back_edge_chains(lv_chk_t *lv)
        }
 }
 
-lv_chk_t *lv_chk_new(ir_graph *irg, const dfs_t *dfs)
+lv_chk_t *lv_chk_new(ir_graph *irg)
 {
        lv_chk_t *res = XMALLOC(lv_chk_t);
        int i;
@@ -253,7 +253,7 @@ lv_chk_t *lv_chk_new(ir_graph *irg, const dfs_t *dfs)
 
        FIRM_DBG_REGISTER(res->dbg, "ir.ana.lvchk");
 
-       res->dfs           = dfs;
+       res->dfs           = dfs_new(&absgraph_irg_cfg_succ, irg);
        res->n_blocks      = dfs_get_n_nodes(res->dfs);
        res->back_edge_src = bitset_obstack_alloc(&res->obst, res->n_blocks);
        res->back_edge_tgt = bitset_obstack_alloc(&res->obst, res->n_blocks);
@@ -294,6 +294,7 @@ lv_chk_t *lv_chk_new(ir_graph *irg, const dfs_t *dfs)
 
 void lv_chk_free(lv_chk_t *lv)
 {
+       dfs_free(lv->dfs);
        obstack_free(&lv->obst, NULL);
        ir_nodemap_destroy(&lv->block_infos);
        xfree(lv);
index 750dd0c..ded033b 100644 (file)
@@ -33,7 +33,6 @@
 
 #include "irgraph.h"
 #include "irnode.h"
-#include "dfs.h"
 
 typedef enum {
        lv_chk_state_in  = 1,
@@ -47,10 +46,9 @@ typedef struct lv_chk_t lv_chk_t;
 /**
  * Make a new liveness check environment.
  * @param irg The graph.
- * @param dfs A forward DFS on CFG of the given irg.
  * @return    The environment.
  */
-extern lv_chk_t *lv_chk_new(ir_graph *irg, const dfs_t *dfs);
+extern lv_chk_t *lv_chk_new(ir_graph *irg);
 
 /**
  * Free liveness check information.
index cec1516..b5918ff 100644 (file)
@@ -34,7 +34,6 @@
 #include "irdump_t.h"
 #include "irnodeset.h"
 
-#include "dfs_t.h"
 #include "absgraph.h"
 #include "statev.h"
 
@@ -533,8 +532,7 @@ be_lv_t *be_liveness(ir_graph *irg)
 
        lv->irg  = irg;
 #ifdef USE_LIVE_CHK
-       lv->dfs  = dfs_new(&absgraph_irg_cfg_succ, irg);
-       lv->lvc  = lv_chk_new(lv->irg, lv->dfs);
+       lv->lvc  = lv_chk_new(lv->irg);
 #endif
        lv->hook_info.context = lv;
        lv->hook_info.hook._hook_node_info = be_dump_liveness_block;
@@ -570,7 +568,6 @@ void be_liveness_free(be_lv_t *lv)
        be_liveness_invalidate(lv);
 #ifdef USE_LIVE_CHK
        lv_chk_free(lv->lvc);
-       dfs_free(lv->dfs);
 #endif
        xfree(lv);
 }
index cbee3e6..5b5da70 100644 (file)
@@ -30,7 +30,6 @@
 #include "irgraph_t.h"
 #include "irnodehashmap.h"
 #include "irhooks.h"
-#include "dfs.h"
 #include "statev.h"
 
 #include "pset.h"
@@ -48,7 +47,6 @@ struct be_lv_t {
        ir_nodehashmap_t map;
        struct obstack   obst;
        ir_graph        *irg;
-       dfs_t           *dfs;
        bitset_t        *nodes;
        hook_entry_t     hook_info;
 #ifdef USE_LIVE_CHK