never set the startblock to bad (even without the self-referencing loop)
[libfirm] / ir / ir / irphase.c
index e934a30..60a8ecf 100644 (file)
@@ -10,7 +10,7 @@
  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 
-#ifdef _HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
@@ -20,7 +20,7 @@
 
 phase_t *phase_init(phase_t *ph, const char *name, ir_graph *irg, unsigned growth_factor, phase_irn_data_init_t *data_init)
 {
-       assert(growth_factor >= 1.0 && "growth factor must greater or equal to 1.0");
+       assert(growth_factor >= 256 && "growth factor must greater or equal to 256/256");
        assert(data_init && "You must provide a data constructor");
 
        obstack_init(&ph->obst);
@@ -71,16 +71,20 @@ void phase_reinit_irn_data(phase_t *phase)
        }
 }
 
-void phase_reinit_single_irn_data(phase_t *phase, ir_node *irn)
+void phase_reinit_block_irn_data(phase_t *phase, ir_node *block)
 {
-       int idx;
+       int i, n;
 
        if (! phase->data_init)
                return;
 
-       idx = get_irn_idx(irn);
-       if (phase->data_ptr[idx])
-               phase->data_init(phase, irn, phase->data_ptr[idx]);
+       for (i = 0, n = phase->n_data_ptr; i < n; ++i) {
+               if (phase->data_ptr[i]) {
+                       ir_node *irn = get_idx_irn(phase->irg, i);
+                       if (! is_Block(irn) && get_nodes_block(irn) == block)
+                               phase->data_init(phase, irn, phase->data_ptr[i]);
+               }
+       }
 }
 
 ir_node *phase_get_first_node(phase_t *phase) {