fix bad input register requirements
[libfirm] / ir / be / bestate.c
index eaae654..4cf17d1 100644 (file)
@@ -23,7 +23,6 @@
  *              algorithm optimized for the 1-register case.
  * @author      Matthias Braun
  * @date        26.03.2007
- * @version     $Id$
  */
 #include "config.h"
 
@@ -39,7 +38,7 @@
 #include "irgmod.h"
 #include "irnodeset.h"
 #include "irnodehashmap.h"
-#include "adt/cpset.h"
+#include "cpset.h"
 
 #include "bearch.h"
 #include "beuses.h"
@@ -111,8 +110,7 @@ static inline spill_info_t *create_spill_info(minibelady_env_t *env, ir_node *st
 
 static inline spill_info_t *get_spill_info(minibelady_env_t *env, const ir_node *node)
 {
-       spill_info_t *spill_info
-               = (spill_info_t*) ir_nodehashmap_get(&env->spill_infos, node);
+       spill_info_t *spill_info = ir_nodehashmap_get(spill_info_t, &env->spill_infos, node);
        //ir_fprintf(stderr, "Get %+F -> %p\n", node, spill_info);
        return spill_info;
 }
@@ -183,7 +181,8 @@ static void spill_phi(minibelady_env_t *env, ir_node *phi)
        DBG((dbg, LEVEL_2, "\tcreate Phi-M for %+F\n", phi));
 
        /* create a Phi-M */
-       spill_info->spill = be_new_Phi(block, arity, phi_in, mode_M, NULL);
+       spill_info->spill = be_new_Phi(block, arity, phi_in, mode_M,
+                                      arch_no_register_req);
        sched_add_after(block, spill_info->spill);
 
        if (spill_to_kill != NULL) {
@@ -215,11 +214,9 @@ static block_info_t *compute_block_start_state(minibelady_env_t *env, ir_node *b
        be_next_use_t  next_use;
        ir_loop       *loop;
        ir_node       *best_starter, *first;
-       ir_node       *node;
        int            n_cfgpreds;
        unsigned       best_time;
        int            outer_loop_allowed;
-       int            i;
 
        /* Create the block info for this block. */
        block_info = new_block_info(&env->obst, block);
@@ -302,9 +299,7 @@ static block_info_t *compute_block_start_state(minibelady_env_t *env, ir_node *b
        }
 
        /* check all Live-Ins */
-       be_lv_foreach(env->lv, block, be_lv_state_in, i) {
-               node = be_lv_get_irn(env->lv, block, i);
-
+       be_lv_foreach(env->lv, block, be_lv_state_in, node) {
                if (!mode_is_data(get_irn_mode(node)))
                        continue;
 
@@ -359,7 +354,6 @@ static block_info_t *compute_block_start_state(minibelady_env_t *env, ir_node *b
 static void belady(minibelady_env_t *env, ir_node *block)
 {
        ir_node *current_state;
-       ir_node *node;
        block_info_t *block_info;
 
        /* Don't do a block twice */
@@ -417,8 +411,6 @@ static void belady(minibelady_env_t *env, ir_node *block)
 
                /* record state changes by the node */
                if (get_irn_mode(node) == mode_T) {
-                       const ir_edge_t *edge;
-
                        foreach_out_edge(node, edge) {
                                const arch_register_t *reg;
                                ir_node *proj = get_edge_src_irn(edge);
@@ -526,9 +518,9 @@ void be_assure_state(ir_graph *irg, const arch_register_t *reg, void *func_env,
 {
        minibelady_env_t env;
        spill_info_t *info;
-       be_lv_t *lv = be_assure_liveness(irg);
+       be_lv_t *lv = be_get_irg_liveness(irg);
 
-       be_liveness_assure_sets(lv);
+       be_assure_live_sets(irg);
        assure_loopinfo(irg);
 
        obstack_init(&env.obst);