cleanup backend: make pre_spill_prepare_constraint independent of chordal allocator...
[libfirm] / ir / be / bespillbelady.c
index 4a29ff0..768ece1 100644 (file)
@@ -24,9 +24,7 @@
  * @date        20.09.2005
  * @version     $Id$
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdbool.h>
 
@@ -216,7 +214,7 @@ static void workset_clear(workset_t *workset)
 /**
  * Removes the value @p val from the workset if present.
  */
-static INLINE void workset_remove(workset_t *workset, ir_node *val)
+static inline void workset_remove(workset_t *workset, ir_node *val)
 {
        int i;
        for(i = 0; i < workset->len; ++i) {
@@ -227,7 +225,7 @@ static INLINE void workset_remove(workset_t *workset, ir_node *val)
        }
 }
 
-static INLINE const loc_t *workset_contains(const workset_t *ws,
+static inline const loc_t *workset_contains(const workset_t *ws,
                                             const ir_node *val)
 {
        int i;
@@ -278,15 +276,14 @@ static void *new_block_info(void)
 /**
  * @return The distance to the next use or 0 if irn has dont_spill flag set
  */
-static INLINE unsigned get_distance(ir_node *from, unsigned from_step,
+static inline unsigned get_distance(ir_node *from, unsigned from_step,
                                     const ir_node *def, int skip_from_uses)
 {
        be_next_use_t use;
-       int           flags = arch_irn_get_flags(def);
        unsigned      costs;
        unsigned      time;
 
-       assert(! (flags & arch_irn_flags_ignore));
+       assert(!arch_irn_is_ignore(def));
 
        use  = be_get_next_use(uses, from, from_step, def, skip_from_uses);
        time = use.time;
@@ -294,7 +291,7 @@ static INLINE unsigned get_distance(ir_node *from, unsigned from_step,
                return USES_INFINITY;
 
        /* We have to keep nonspillable nodes in the workingset */
-       if (flags & arch_irn_flags_dont_spill)
+       if (arch_irn_get_flags(def) & arch_irn_flags_dont_spill)
                return 0;
 
        /* give some bonus to rematerialisable nodes */
@@ -318,8 +315,8 @@ static INLINE unsigned get_distance(ir_node *from, unsigned from_step,
  */
 static void displace(workset_t *new_vals, int is_usage)
 {
-       ir_node **to_insert = alloca(n_regs * sizeof(to_insert[0]));
-       bool     *spilled   = alloca(n_regs * sizeof(spilled[0]));
+       ir_node **to_insert = ALLOCAN(ir_node*, n_regs);
+       bool     *spilled   = ALLOCAN(bool,     n_regs);
        ir_node  *val;
        int       i;
        int       len;
@@ -553,7 +550,7 @@ static void decide_start_workset(const ir_node *block)
 
        /* check predecessors */
        arity           = get_irn_arity(block);
-       pred_worksets   = alloca(sizeof(pred_worksets[0]) * arity);
+       pred_worksets   = ALLOCAN(workset_t*, arity);
        all_preds_known = true;
        for(i = 0; i < arity; ++i) {
                ir_node      *pred_block = get_Block_cfgpred_block(block, i);