fix a bunch of warnings reported by clang analyzer
[libfirm] / ir / be / ia32 / ia32_x87.c
index 5723f3d..32a2c06 100644 (file)
@@ -772,14 +772,12 @@ static vfp_liveness vfp_liveness_transfer(ir_node *irn, vfp_liveness live)
  */
 static vfp_liveness vfp_liveness_end_of_block(x87_simulator *sim, const ir_node *block)
 {
-       int i;
        vfp_liveness live = 0;
        const arch_register_class_t *cls = &ia32_reg_classes[CLASS_ia32_vfp];
        const be_lv_t *lv = sim->lv;
 
-       be_lv_foreach(lv, block, be_lv_state_end, i) {
+       be_lv_foreach(lv, block, be_lv_state_end, node) {
                const arch_register_t *reg;
-               const ir_node *node = be_lv_get_irn(lv, block, i);
                if (!arch_irn_consider_in_reg_alloc(cls, node))
                        continue;
 
@@ -821,7 +819,6 @@ static void update_liveness(x87_simulator *sim, ir_node *block)
 {
        vfp_liveness live = vfp_liveness_end_of_block(sim, block);
        unsigned idx;
-       ir_node *irn;
 
        /* now iterate through the block backward and cache the results */
        sched_foreach_reverse(block, irn) {
@@ -1053,7 +1050,6 @@ static int sim_binop(x87_state *state, ir_node *n, const exchange_tmpl *tmpl)
  */
 static int sim_unop(x87_state *state, ir_node *n, ir_op *op)
 {
-       int op1_idx;
        x87_simulator         *sim = state->sim;
        const arch_register_t *op1 = x87_get_irn_register(get_irn_n(n, 0));
        const arch_register_t *out = x87_get_irn_register(n);
@@ -1063,18 +1059,16 @@ static int sim_unop(x87_state *state, ir_node *n, ir_op *op)
        DB((dbg, LEVEL_1, ">>> %+F -> %s\n", n, out->name));
        DEBUG_ONLY(vfp_dump_live(live);)
 
-       op1_idx = x87_on_stack(state, arch_register_get_index(op1));
+       int op1_idx = x87_on_stack(state, arch_register_get_index(op1));
 
        if (is_vfp_live(arch_register_get_index(op1), live)) {
                /* push the operand here */
                x87_create_fpush(state, n, op1_idx, 0);
                op1_idx = 0;
-       }
-       else {
+       } else {
                /* operand is dead, bring it to tos */
                if (op1_idx != 0) {
                        x87_create_fxch(state, n, op1_idx);
-                       op1_idx = 0;
                }
        }
 
@@ -1561,7 +1555,7 @@ static int sim_Fucom(x87_state *state, ir_node *n)
                case 0: dst = op_ia32_FucomFnstsw;   break;
                case 1: dst = op_ia32_FucompFnstsw;  break;
                case 2: dst = op_ia32_FucomppFnstsw; break;
-               default: panic("invalid popcount in sim_Fucom");
+               default: panic("invalid popcount");
                }
 
                for (i = 0; i < pops; ++i) {
@@ -1576,10 +1570,10 @@ static int sim_Fucom(x87_state *state, ir_node *n)
                        x87_pop(state);
                        x87_create_fpop(state, sched_next(n), 1);
                        break;
-               default: panic("invalid popcount in sim_Fucom");
+               default: panic("invalid popcount");
                }
        } else {
-               panic("invalid operation %+F in sim_FucomFnstsw", n);
+               panic("invalid operation %+F", n);
        }
 
        x87_patch_insn(n, dst);
@@ -1796,7 +1790,7 @@ static int sim_Copy(x87_state *state, ir_node *n)
 
                if (out_idx >= 0 && out_idx != op1_idx) {
                        /* Matze: out already on stack? how can this happen? */
-                       panic("invalid stack state in x87 simulator");
+                       panic("invalid stack state");
 
 #if 0
                        /* op1 must be killed and placed where out is */