fixed some depencies between irdump.c and irdumptxt.c
[libfirm] / ir / opt / reassoc.c
index e3ee256..bd1300a 100644 (file)
@@ -33,12 +33,12 @@ typedef struct _walker_t {
 typedef enum {
   NO_CONSTANT   = 0,    /**< node is not constant */
   REAL_CONSTANT = 1,    /**< node is a constnt that is suitable for constant folding */
-  CONST_EXPR    = 4     /**< node is not constnt expression in the current context,
+  CONST_EXPR    = 4     /**< node is not constant expression in the current context,
                              use 4 here to simplify implementation of get_comm_Binop_ops() */
 } const_class_t;
 
 /**
- * returns wheater a node is constant, ie is a constant or
+ * returns whether a node is constant, ie is a constant or
  * is loop invariant
  */
 static const_class_t get_const_class(ir_node *n)
@@ -258,6 +258,9 @@ static int reassoc_commutative(ir_node *n)
 }
 
 #define reassoc_Add  reassoc_commutative
+#define reassoc_And  reassoc_commutative
+#define reassoc_Or   reassoc_commutative
+#define reassoc_Eor  reassoc_commutative
 
 /**
  * reassociate using distibutive law for Mul and Add/Sub
@@ -310,6 +313,8 @@ static void do_reassociation(ir_node *n, void *env)
   walker_t *wenv = env;
   int res;
 
+  stat_reassociate(1);
+
   /* reassociation must run until fixpoint */
   do {
     ir_op   *op    = get_irn_op(n);
@@ -328,6 +333,8 @@ static void do_reassociation(ir_node *n, void *env)
       }
     }
   } while (res == 1);
+
+  stat_reassociate(0);
 }
 
 /*
@@ -364,5 +371,8 @@ void firm_init_reassociation(void)
   INIT(Mul);
   INIT(Add);
   INIT(Sub);
+  INIT(And);
+  INIT(Or);
+  INIT(Eor);
 #undef CASE
 }