Let the length of tarval be of type size_t.
[libfirm] / ir / be / bespillbelady.c
index 565af05..f1945d8 100644 (file)
@@ -75,7 +75,7 @@ typedef struct loc_t {
        bool              spilled;  /**< value was already spilled on this path */
 } loc_t;
 
-typedef struct _workset_t {
+typedef struct workset_t {
        unsigned len;     /**< current length */
        loc_t    vals[0]; /**< array of the values/distances in this working set */
 } workset_t;
@@ -213,8 +213,8 @@ static const loc_t *workset_contains(const workset_t *ws, const ir_node *val)
 
 static int loc_compare(const void *a, const void *b)
 {
-       const loc_t *p = a;
-       const loc_t *q = b;
+       const loc_t *p = (const loc_t*)a;
+       const loc_t *q = (const loc_t*)b;
        return p->time - q->time;
 }
 
@@ -255,11 +255,10 @@ static inline ir_node *workset_get_val(const workset_t *workset, unsigned idx)
  * @p v  A variable to put the current value in
  * @p i  An integer for internal use
  */
-#define workset_foreach(ws, v, i)      \
+#define workset_foreach(ws, v, i) \
        for (i=0; v=(i < ws->len) ? ws->vals[i].node : NULL, i < ws->len; ++i)
 
-typedef struct _block_info_t
-{
+typedef struct block_info_t {
        workset_t *start_workset;
        workset_t *end_workset;
 } block_info_t;
@@ -271,7 +270,7 @@ static block_info_t *new_block_info(void)
 
 static inline block_info_t *get_block_info(const ir_node *block)
 {
-       return get_irn_link(block);
+       return (block_info_t*)get_irn_link(block);
 }
 
 static inline void set_block_info(ir_node *block, block_info_t *info)
@@ -543,7 +542,7 @@ static void decide_start_workset(const ir_node *block)
        unsigned    i;
        int         in;
        unsigned    ws_count;
-       int             free_slots, free_pressure_slots;
+       int         free_slots, free_pressure_slots;
        unsigned    pressure;
        int         arity;
        workset_t **pred_worksets;
@@ -971,7 +970,7 @@ static void be_spill_belady(ir_graph *irg, const arch_register_class_t *rcls)
        obstack_init(&obst);
        cls       = rcls;
        lv        = be_get_irg_liveness(irg);
-       n_regs    = cls->n_regs - be_put_ignore_regs(irg, cls, NULL);
+       n_regs    = be_get_n_allocatable_regs(irg, cls);
        ws        = new_workset();
        uses      = be_begin_uses(irg, lv);
        loop_ana  = be_new_loop_pressure(irg, cls);