becopyheur: Avoid unnecessary bitset copying.
[libfirm] / ir / be / becopyheur.c
index 7243c8a..be20305 100644 (file)
@@ -57,8 +57,8 @@ typedef struct conflict_t {
  */
 typedef struct node_stat_t {
        ir_node *irn;
-       int     new_color;
-       int     pinned_local :1;
+       int      new_color;
+       unsigned pinned_local :1;
 } node_stat_t;
 
 /**
@@ -66,7 +66,6 @@ typedef struct node_stat_t {
  */
 typedef struct qnode_t {
        struct list_head queue;            /**< chaining of unit_t->queue */
-       const unit_t     *ou;              /**< the opt unit this node belongs to */
        int              color;            /**< target color */
        set              *conflicts;       /**< contains conflict_t's. All internal conflicts */
        int              mis_costs;        /**< costs of nodes/copies in the mis. */
@@ -263,11 +262,8 @@ static ir_node *qnode_color_irn(qnode_t const *const qn, ir_node *const irn, int
                bitset_copy(free_cols, allocatable_regs);
 
                /* Exclude colors not assignable to the irn */
-               if (arch_register_req_is(req, limited)) {
-                       bitset_t *limited = bitset_alloca(cls->n_regs);
-                       rbitset_copy_to_bitset(req->limited, limited);
-                       bitset_and(free_cols, limited);
-               }
+               if (arch_register_req_is(req, limited))
+                       rbitset_and(free_cols->data, req->limited, free_cols->size);
 
                /* Exclude the color of the irn, because it must _change_ its color */
                bitset_clear(free_cols, irn_col);
@@ -341,7 +337,7 @@ static int qnode_try_color(qnode_t const *const qn, bitset_t const *const alloca
                } else {
                        if (qnode_is_pinned_local(qn, confl_node)) {
                                /* changing test_node would change back a node of current ou */
-                               if (confl_node == qn->ou->nodes[0]) {
+                               if (confl_node == qn->mis[0]) {
                                        /* Adding a conflict edge between testnode and conflnode
                                         * would introduce a root -- arg interference.
                                         * So remove the arg of the qn */
@@ -467,7 +463,6 @@ no_stable_set:
 static inline qnode_t *new_qnode(const unit_t *ou, int color)
 {
        qnode_t *qn = XMALLOC(qnode_t);
-       qn->ou            = ou;
        qn->color         = color;
        qn->mis           = XMALLOCN(ir_node*, ou->node_count);
        qn->conflicts     = new_set(set_cmp_conflict_t, SLOTS_CONFLICTS);