Fix some -Wmissing-declarations warnings
[libfirm] / ir / be / bespillutil.c
index b6c31df..bdae78c 100644 (file)
@@ -118,8 +118,8 @@ struct spill_env_t {
  */
 static int cmp_spillinfo(const void *x, const void *y, size_t size)
 {
-       const spill_info_t *xx = x;
-       const spill_info_t *yy = y;
+       const spill_info_t *xx = (const spill_info_t*)x;
+       const spill_info_t *yy = (const spill_info_t*)y;
        (void) size;
 
        return xx->to_spill != yy->to_spill;
@@ -134,14 +134,14 @@ static spill_info_t *get_spillinfo(const spill_env_t *env, ir_node *value)
        int hash = hash_irn(value);
 
        info.to_spill = value;
-       res = set_find(env->spills, &info, sizeof(info), hash);
+       res = (spill_info_t*)set_find(env->spills, &info, sizeof(info), hash);
 
        if (res == NULL) {
                info.reloaders   = NULL;
                info.spills      = NULL;
                info.spill_costs = -1;
                info.reload_cls  = NULL;
-               res = set_insert(env->spills, &info, sizeof(info), hash);
+               res = (spill_info_t*)set_insert(env->spills, &info, sizeof(info), hash);
        }
 
        return res;
@@ -427,7 +427,8 @@ static void spill_irn(spill_env_t *env, spill_info_t *spillinfo)
         * and simply always available. */
        if (!sched_is_scheduled(insn)) {
                /* override spillinfos or create a new one */
-               spillinfo->spills->spill = new_NoMem();
+               ir_graph *irg = get_irn_irg(to_spill);
+               spillinfo->spills->spill = new_r_NoMem(irg);
                DB((dbg, LEVEL_1, "don't spill %+F use NoMem\n", to_spill));
                return;
        }
@@ -549,7 +550,7 @@ static void spill_node(spill_env_t *env, spill_info_t *spillinfo)
 static int is_value_available(spill_env_t *env, const ir_node *arg,
                               const ir_node *reloader)
 {
-       if (is_Unknown(arg) || arg == new_NoMem())
+       if (is_Unknown(arg) || is_NoMem(arg))
                return 1;
 
        if (be_is_Spill(skip_Proj_const(arg)))
@@ -773,11 +774,12 @@ static void determine_spill_costs(spill_env_t *env, spill_info_t *spillinfo)
         * predecessor (of a PhiM) but this test might match other things too...
         */
        if (!sched_is_scheduled(insn)) {
+               ir_graph *irg = get_irn_irg(to_spill);
                /* override spillinfos or create a new one */
                spill_t *spill = OALLOC(&env->obst, spill_t);
                spill->after = NULL;
                spill->next  = NULL;
-               spill->spill = new_NoMem();
+               spill->spill = new_r_NoMem(irg);
 
                spillinfo->spills      = spill;
                spillinfo->spill_costs = 0;
@@ -884,7 +886,7 @@ void be_insert_spills_reloads(spill_env_t *env)
        }
 
        /* process each spilled node */
-       for (si = set_first(env->spills); si; si = set_next(env->spills)) {
+       foreach_set(env->spills, spill_info_t*, si) {
                reloader_t *rld;
                ir_node  *to_spill        = si->to_spill;
                ir_mode  *mode            = get_irn_mode(to_spill);