Do not pass the cg to transform_nodes().
[libfirm] / ir / be / betranshlp.c
index 1f4785e..f5d88f6 100644 (file)
@@ -46,8 +46,6 @@
 
 typedef struct be_transform_env_t {
        ir_graph *irg;         /**< The irg, the node should be created in */
-       int      visited;      /**< visited count that indicates whether a
-                                   node is already transformed */
        waitq    *worklist;    /**< worklist of nodes that still need to be
                                    transformed */
        ir_node  *old_anchor;  /**< the old anchor node in the old irg */
@@ -56,8 +54,10 @@ typedef struct be_transform_env_t {
 
 static be_transform_env_t env;
 
-void be_set_transformed_node(ir_node *old_node, ir_node *new_node) {
+void be_set_transformed_node(ir_node *old_node, ir_node *new_node)
+{
        set_irn_link(old_node, new_node);
+       mark_irn_visited(old_node);
 }
 
 int be_is_transformed(const ir_node *node) {
@@ -234,11 +234,6 @@ ir_node *be_pre_transform_node(ir_node *place) {
        return be_transform_node(place);
 }
 
-ir_node *be_get_old_anchor(int anchor)
-{
-       return get_irn_n(env.old_anchor, anchor);
-}
-
 static void pre_transform_anchor(int anchor)
 {
        ir_node *old_anchor_node = get_irn_n(env.old_anchor, anchor);
@@ -258,8 +253,7 @@ static void kill_unused_anchor(int anchor)
 /**
  * Transforms all nodes. Deletes the old obstack and creates a new one.
  */
-static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform,
-                            void *cg)
+static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform)
 {
        int       i;
        ir_node  *old_end, *new_anchor;
@@ -269,7 +263,6 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform,
        inc_irg_visited(irg);
 
        env.irg         = irg;
-       env.visited     = get_irg_visited(irg);
        env.worklist    = new_waitq();
        env.old_anchor  = irg->anchor;
 
@@ -297,7 +290,7 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform,
        kill_unused_anchor(anchor_tls);
 
        if (pre_transform)
-               (*pre_transform)(cg);
+               pre_transform();
 
        /* process worklist (this should transform all nodes in the graph) */
        while (! waitq_empty(env.worklist)) {
@@ -390,7 +383,7 @@ static ir_node *gen_End(ir_node *node) {
        return new_end;
 }
 
-void be_transform_graph(be_irg_t *birg, arch_pretrans_nodes *func, void *cg)
+void be_transform_graph(be_irg_t *birg, arch_pretrans_nodes *func)
 {
        ir_graph *irg = birg->irg;
        ir_graph *old_current_ir_graph = current_ir_graph;
@@ -415,7 +408,7 @@ void be_transform_graph(be_irg_t *birg, arch_pretrans_nodes *func, void *cg)
        op_End->ops.generic   = (op_func)gen_End;
 
        /* do the main transformation */
-       transform_nodes(irg, func, cg);
+       transform_nodes(irg, func);
 
        /* free the old obstack */
        obstack_free(old_obst, 0);