allow several odd weak combinations
[libfirm] / ir / be / bespilldaemel.c
index 3f76f2d..2950f69 100644 (file)
 
 /**
  * @file
- * @brief       Naiv spilling algorithm
+ * @brief       Naive spilling algorithm
  * @author      Matthias Braun
  * @date        20.09.2005
  * @version     $Id: bespillbelady.c 13913 2007-05-18 12:48:56Z matze $
- * @summary
- *   This implements a naiv spilling algorithm. It is design to produce similar
+ * @brief
+ *   This implements a naive spilling algorithm. It is designed to produce similar
  *   effects to the spill decisions produced by traditional graph coloring
  *   register allocators that spill while they are coloring the graph.
  *
 #include "error.h"
 
 #include "beirg.h"
-#include "bespilloptions.h"
 #include "bespill.h"
+#include "bespillutil.h"
 #include "bemodule.h"
 #include "besched.h"
-#include "bearch_t.h"
+#include "bearch.h"
 #include "be_t.h"
-#include "benode_t.h"
+#include "benode.h"
 #include "beirg.h"
+#include "belive.h"
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
@@ -185,7 +186,7 @@ static void do_spilling(ir_nodeset_t *live_nodes, ir_node *node)
                return;
        DBG((dbg, LEVEL_2, "\tspills needed after %+F: %d\n", node, spills_needed));
 
-       candidates = alloca(n_live_nodes * sizeof(candidates[0]));
+       candidates = ALLOCAN(spill_candidate_t, n_live_nodes);
 
        /* construct array with spill candidates and calculate their costs */
        i = 0;
@@ -220,7 +221,7 @@ static void do_spilling(ir_nodeset_t *live_nodes, ir_node *node)
                cand_node = candidate->node;
                ++cand_idx;
 
-               if (arch_irn_is(cand_node, dont_spill))
+               if (arch_irn_is(skip_Proj_const(cand_node), dont_spill))
                        continue;
 
                /* make sure the node is not an argument of the instruction */