removed wrong instructions with traps on overflow
[libfirm] / ir / be / benode.c
index f4731f7..96bdd0b 100644 (file)
@@ -335,6 +335,10 @@ ir_node *be_new_Copy(const arch_register_class_t *cls, ir_graph *irg, ir_node *b
        return res;
 }
 
+ir_node *be_get_Copy_op(const ir_node *cpy) {
+       return get_irn_n(cpy, be_pos_Copy_op);
+}
+
 ir_node *be_new_Keep(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, int n, ir_node *in[])
 {
        int i;
@@ -611,9 +615,9 @@ int be_has_frame_entity(const ir_node *irn)
        case beo_FrameLoad:
        case beo_FrameAddr:
                return 1;
+       default:
+               return 0;
        }
-
-       return 0;
 }
 
 entity *be_get_frame_entity(const ir_node *irn)
@@ -705,6 +709,11 @@ void be_node_set_req_type(ir_node *irn, int pos, arch_register_req_type_t type)
        r->req.type = type;
 }
 
+ir_node *be_get_IncSP_pred(ir_node *irn) {
+       assert(be_is_IncSP(irn));
+       return get_irn_n(irn, 0);
+}
+
 void be_set_IncSP_offset(ir_node *irn, unsigned offset)
 {
        be_stack_attr_t *a = get_irn_attr(irn);
@@ -787,8 +796,6 @@ static INLINE ir_node *find_a_spill(const ir_node *irn)
 
 entity *be_get_spill_entity(const ir_node *irn)
 {
-       int opc           = get_irn_opcode(irn);
-
        switch(be_get_irn_opcode(irn)) {
        case beo_Reload:
                {
@@ -856,7 +863,7 @@ ir_node *be_spill(const arch_env_t *arch_env, ir_node *irn, ir_node *ctx)
         */
 
        insert = sched_next(irn);
-       if(bl == get_irg_start_block(irg) && insert != bl && sched_get_time_step(frame) >= sched_get_time_step(insert))
+       if(insert != bl && bl == get_irg_start_block(irg) && sched_get_time_step(frame) >= sched_get_time_step(insert))
                insert = sched_next(frame);
 
        while((is_Phi(insert) || is_Proj(insert)) && !sched_is_end(insert))
@@ -910,7 +917,7 @@ static void *put_out_reg_req(arch_register_req_t *req, const ir_node *irn, int o
 
                if(be_is_Copy(irn)) {
                        req->type |= arch_register_req_type_should_be_same;
-                       req->other_same = get_irn_n(irn, be_pos_Copy_orig);
+                       req->other_same = be_get_Copy_op(irn);
                }
        }
        else {
@@ -924,7 +931,6 @@ static void *put_out_reg_req(arch_register_req_t *req, const ir_node *irn, int o
 static void *put_in_reg_req(arch_register_req_t *req, const ir_node *irn, int pos)
 {
        const be_node_attr_t *a = get_irn_attr(irn);
-       int n                   = get_irn_arity(irn);
 
        if(pos < get_irn_arity(irn) && pos < a->max_reg_data)
                memcpy(req, &a->reg_data[pos].in_req, sizeof(req[0]));
@@ -977,11 +983,12 @@ static arch_irn_class_t be_node_classify(const void *_self, const ir_node *irn)
        redir_proj((const ir_node **) &irn, -1);
 
        switch(be_get_irn_opcode(irn)) {
-#define XXX(a,b) case beo_ ## a: return arch_irn_class_ ## b;
-               XXX(Spill, spill)
-               XXX(Reload, reload)
-               XXX(Perm, perm)
-               XXX(Copy, copy)
+#define XXX(a,b) case beo_ ## a: return arch_irn_class_ ## b
+               XXX(Spill, spill);
+               XXX(Reload, reload);
+               XXX(Perm, perm);
+               XXX(Copy, copy);
+               XXX(Return, branch);
 #undef XXX
                default:
                return 0;
@@ -1083,7 +1090,6 @@ static const arch_register_req_t *get_Phi_reg_req_recursive(const phi_handler_t
 {
        int n = get_irn_arity(phi);
        ir_node *op;
-       int done = 0;
        int i;
 
        if(*visited && pset_find_ptr(*visited, phi))
@@ -1299,8 +1305,11 @@ static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
 
                        if(be_has_frame_entity(irn)) {
                                be_frame_attr_t *a = (be_frame_attr_t *) at;
-                               if (a->ent)
-                                       ir_fprintf(f, "frame entity: %+F offset %x (%d)\n", a->ent, a->offset, a->offset);
+                               if (a->ent) {
+                                       int bits = get_type_size_bits(get_entity_type(a->ent));
+                                       ir_fprintf(f, "frame entity: %+F offset 0x%x (%d) size 0x%x %d\n",
+                                         a->ent, a->offset, a->offset, bits, bits);
+                               }
 
                        }
 
@@ -1319,6 +1328,8 @@ static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
                                        fprintf(f, "direction: %s\n", a->dir == be_stack_dir_expand ? "expand" : "shrink");
                                }
                                break;
+                       default:
+                               break;
                        }
        }