Use foreach_set() instead of reimplementing it.
[libfirm] / ir / be / beloopana.c
index 8c9b613..9d2f812 100644 (file)
  * @brief       Compute register pressure in loops.
  * @author      Christian Wuerdig
  * @date        19.02.2007
- * @version     $Id$
  */
 #include "config.h"
 
 #include "set.h"
 #include "pset.h"
 #include "irnode.h"
-#include "irtools.h"
+#include "util.h"
 #include "irloop_t.h"
 #include "error.h"
 #include "debug.h"
@@ -42,7 +41,7 @@
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
-#define HASH_LOOP_INFO(info) (HASH_PTR((info)->loop) ^ HASH_PTR((info)->cls))
+#define HASH_LOOP_INFO(info) (hash_ptr((info)->loop) ^ hash_ptr((info)->cls))
 
 typedef struct be_loop_info_t {
        ir_loop                     *loop;
@@ -166,10 +165,7 @@ be_loopana_t *be_new_loop_pressure_cls(ir_graph *irg,
        DBG((dbg, LEVEL_1, " Computing register pressure for class %s:\n", cls->name));
        DBG((dbg, LEVEL_1, "=====================================================\n", cls->name));
 
-       /* construct control flow loop tree */
-       if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
-               construct_cf_backedges(irg);
-       }
+       assure_loopinfo(irg);
 
        be_compute_loop_pressure(loop_ana, get_irg_loop(irg), cls);
 
@@ -192,10 +188,7 @@ be_loopana_t *be_new_loop_pressure(ir_graph *irg,
        loop_ana->data = new_set(cmp_loop_info, 16);
        loop_ana->irg  = irg;
 
-       /* construct control flow loop tree */
-       if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
-               construct_cf_backedges(irg);
-       }
+       assure_loopinfo(irg);
 
        if (cls != NULL) {
                be_compute_loop_pressure(loop_ana, irg_loop, cls);