Fixed compile error in optimize build.
[libfirm] / ir / be / ia32 / ia32_x87.c
index bd3a7c9..218db36 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2010 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -343,7 +343,7 @@ static blk_state *x87_get_bl_state(x87_simulator *sim, ir_node *block)
        pmap_entry *entry = pmap_find(sim->blk_states, block);
 
        if (! entry) {
-               blk_state *bl_state = obstack_alloc(&sim->obst, sizeof(*bl_state));
+               blk_state *bl_state = OALLOC(&sim->obst, blk_state);
                bl_state->begin = NULL;
                bl_state->end   = NULL;
 
@@ -363,7 +363,7 @@ static blk_state *x87_get_bl_state(x87_simulator *sim, ir_node *block)
  */
 static x87_state *x87_alloc_state(x87_simulator *sim)
 {
-       x87_state *res = obstack_alloc(&sim->obst, sizeof(*res));
+       x87_state *res = OALLOC(&sim->obst, x87_state);
 
        res->sim = sim;
        return res;
@@ -707,7 +707,7 @@ static ir_node *x87_create_fpop(x87_state *state, ir_node *n, int num)
        ia32_x87_attr_t *attr;
 
        assert(num > 0);
-       while (num > 0) {
+       do {
                x87_pop(state);
                if (ia32_cg_config.use_ffreep)
                        fpop = new_bd_ia32_ffreep(NULL, get_nodes_block(n));
@@ -721,9 +721,7 @@ static ir_node *x87_create_fpop(x87_state *state, ir_node *n, int num)
                keep_alive(fpop);
                sched_add_before(n, fpop);
                DB((dbg, LEVEL_1, "<<< %s %s\n", get_irn_opname(fpop), attr->x87[0]->name));
-
-               --num;
-       }
+       } while (--num > 0);
        return fpop;
 }  /* x87_create_fpop */
 
@@ -2209,7 +2207,7 @@ static void x87_init_simulator(x87_simulator *sim, ir_graph *irg)
        obstack_init(&sim->obst);
        sim->blk_states = pmap_create();
        sim->n_idx      = get_irg_last_idx(irg);
-       sim->live       = obstack_alloc(&sim->obst, sizeof(*sim->live) * sim->n_idx);
+       sim->live       = OALLOCN(&sim->obst, vfp_liveness, sim->n_idx);
 
        DB((dbg, LEVEL_1, "--------------------------------\n"
                "x87 Simulator started for %+F\n", irg));
@@ -2259,7 +2257,7 @@ static void x87_destroy_simulator(x87_simulator *sim)
  */
 static void update_liveness_walker(ir_node *block, void *data)
 {
-       x87_simulator *sim = data;
+       x87_simulator *sim = (x87_simulator*)data;
        update_liveness(sim, block);
 }  /* update_liveness_walker */
 
@@ -2268,7 +2266,7 @@ static void update_liveness_walker(ir_node *block, void *data)
  * Replaces all virtual floating point instructions and registers
  * by real ones.
  */
-void x87_simulate_graph(ir_graph *irg)
+void ia32_x87_simulate_graph(ir_graph *irg)
 {
        /* TODO improve code quality (less executed fxch) by using execfreqs */
 
@@ -2303,14 +2301,14 @@ void x87_simulate_graph(ir_graph *irg)
 
        /* iterate */
        do {
-               block = waitq_get(sim.worklist);
+               block = (ir_node*)waitq_get(sim.worklist);
                x87_simulate_block(&sim, block);
        } while (! waitq_empty(sim.worklist));
 
        /* kill it */
        del_waitq(sim.worklist);
        x87_destroy_simulator(&sim);
-}  /* x87_simulate_graph */
+}  /* ia32_x87_simulate_graph */
 
 /* Initializes the x87 simulator. */
 void ia32_init_x87(void)