beinsn: Do not store, whether an insn has constraints.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sun, 25 Nov 2012 14:02:47 +0000 (15:02 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sun, 25 Nov 2012 14:02:47 +0000 (15:02 +0100)
Simply return no insn, if it has no constraints.

ir/be/bechordal.c
ir/be/bechordal_common.c
ir/be/beinsn.c
ir/be/beinsn_t.h
ir/be/bepbqpcoloring.c

index 25e3a14..831a427 100644 (file)
@@ -118,7 +118,7 @@ static void handle_constraints(be_chordal_env_t *const env, ir_node *const irn)
 
        /* Perms inserted before the constraint handling phase are considered to be
         * correctly precolored. These Perms arise during the ABI handling phase. */
-       if (!insn->has_constraints || is_Phi(irn))
+       if (!insn || is_Phi(irn))
                goto end;
 
        /* Prepare the constraint handling of this node.
index 914a228..2000a06 100644 (file)
@@ -209,7 +209,6 @@ void create_borders(ir_node *block, void *env_ptr)
 ir_node *pre_process_constraints(be_chordal_env_t *env, be_insn_t **the_insn)
 {
        be_insn_t *insn = *the_insn;
-       assert(insn->has_constraints && "only do this for constrained nodes");
 
        /*
         * Make the Perm, recompute liveness and re-scan the insn since the
index 0ca1281..4a52deb 100644 (file)
@@ -43,6 +43,8 @@ be_insn_t *be_scan_insn(be_chordal_env_t const *const env, ir_node *const irn)
 
        be_insn_t *insn = OALLOCZ(obst, be_insn_t);
 
+       bool has_constraints = false;
+
        insn->irn = irn;
        if (get_irn_mode(irn) == mode_T) {
                ir_node *p;
@@ -64,7 +66,7 @@ be_insn_t *be_scan_insn(be_chordal_env_t const *const env, ir_node *const irn)
                                o.partner         = NULL;
                                obstack_grow(obst, &o, sizeof(o));
                                insn->n_ops++;
-                               insn->has_constraints |= arch_register_req_is(o.req, limited) | (o.req->width > 1);
+                               has_constraints |= arch_register_req_is(o.req, limited) | (o.req->width > 1);
                        }
                }
        } else if (arch_irn_consider_in_reg_alloc(env->cls, irn)) {
@@ -75,7 +77,7 @@ be_insn_t *be_scan_insn(be_chordal_env_t const *const env, ir_node *const irn)
                o.partner = NULL;
                obstack_grow(obst, &o, sizeof(o));
                insn->n_ops++;
-               insn->has_constraints |= arch_register_req_is(o.req, limited) | (o.req->width > 1);
+               has_constraints |= arch_register_req_is(o.req, limited) | (o.req->width > 1);
        }
 
        insn->use_start = insn->n_ops;
@@ -92,10 +94,13 @@ be_insn_t *be_scan_insn(be_chordal_env_t const *const env, ir_node *const irn)
                        o.partner = NULL;
                        obstack_grow(obst, &o, sizeof(o));
                        insn->n_ops++;
-                       insn->has_constraints |= arch_register_req_is(o.req, limited);
+                       has_constraints |= arch_register_req_is(o.req, limited);
                }
        }
 
+       if (!has_constraints)
+               return NULL;
+
        insn->ops = (be_operand_t*)obstack_finish(obst);
 
        /* Compute the admissible registers bitsets. */
index 7f3de18..43525ae 100644 (file)
@@ -44,12 +44,11 @@ struct be_operand_t {
 };
 
 struct be_insn_t {
-       be_operand_t *ops;             /**< the values used and defined by the insn */
-       int n_ops;                     /**< length of the ops array */
-       int use_start;                 /**< entries [0-use_start) in ops are defs,
-                                           [use_start-n_ops) uses */
-       ir_node *irn;                  /**< ir_node of the instruction */
-       unsigned has_constraints : 1;  /**< in_constraints or out_constraints true */
+       be_operand_t *ops;       /**< the values used and defined by the insn */
+       int           n_ops;     /**< length of the ops array */
+       int           use_start; /**< entries [0-use_start) in ops are defs,
+                                     [use_start-n_ops) uses */
+       ir_node      *irn;       /**< ir_node of the instruction */
 };
 
 /**
index b5ddcae..114a6d5 100644 (file)
@@ -597,7 +597,7 @@ static void insert_perms(ir_node *block, void *data)
        for (irn = sched_first(block); !sched_is_end(irn);) {
                ir_node   *const next = sched_next(irn);
                be_insn_t *      insn = be_scan_insn(env, irn);
-               if (insn->has_constraints)
+               if (insn)
                        pre_process_constraints(env, &insn);
 
                irn = next;