partially revert 2e9fdf8841de40f008697ba8bf711fa3f3f2c0e8
[libfirm] / ir / lower / lower_mux.c
index a8c97e3..9965268 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -21,7 +21,6 @@
  * @file
  * @brief   Replaces Mux nodes with control-flow
  * @author  Olaf Liebe
- * @version $Id$
  */
 #include "config.h"
 
@@ -43,7 +42,7 @@ typedef struct walk_env {
 
 static void find_mux_nodes(ir_node *mux, void *ctx)
 {
-       walk_env_t *env = ctx;
+       walk_env_t *env = (walk_env_t*)ctx;
 
        /* Skip non-mux nodes. */
        if (!is_Mux(mux))
@@ -114,7 +113,7 @@ static void lower_mux_node(ir_node* mux)
 
 void lower_mux(ir_graph *irg, lower_mux_callback *cb_func)
 {
-       int        i, n_muxes;
+       size_t     i, n_muxes;
        walk_env_t env;
 
        /* Scan the graph for mux nodes to lower. */
@@ -137,25 +136,23 @@ void lower_mux(ir_graph *irg, lower_mux_callback *cb_func)
                /* Cleanup, verify the graph. */
                ir_free_resources(irg, resources);
 
-               set_irg_outs_inconsistent(irg);
-               set_irg_doms_inconsistent(irg);
-               set_irg_extblk_inconsistent(irg);
-               set_irg_loopinfo_inconsistent(irg);
+               clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE
+                                  | IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS);
        }
        DEL_ARR_F(env.muxes);
 }
 
-struct pass_t {
+typedef struct pass_t {
        ir_graph_pass_t    pass;
        lower_mux_callback *cb_func;
-};
+} pass_t;
 
 /**
  * Wrapper to run ir_lower_mux() as an ir_graph pass
  */
 static int pass_wrapper(ir_graph *irg, void *context)
 {
-       struct pass_t *pass = context;
+       pass_t *pass = (pass_t*)context;
 
        lower_mux(irg, pass->cb_func);
        return 0;
@@ -163,7 +160,7 @@ static int pass_wrapper(ir_graph *irg, void *context)
 
 ir_graph_pass_t *lower_mux_pass(const char *name, lower_mux_callback *cb_func)
 {
-       struct pass_t *pass = XMALLOCZ(struct pass_t);
+       pass_t *pass = XMALLOCZ(pass_t);
 
        pass->cb_func = cb_func;
        return def_graph_pass_constructor(