From ce74d361db4be3e5628d84d9e01ff093f88f83a3 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 25 Nov 2012 09:20:55 +0100 Subject: [PATCH] beinsn: Do not store, whether an insn is pre-coloured. The only user of this information (bechordal) can just check, whether a register is assigned. --- ir/be/bechordal.c | 26 +++++--------------------- ir/be/beinsn.c | 9 +-------- ir/be/beinsn_t.h | 1 - 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/ir/be/bechordal.c b/ir/be/bechordal.c index d2b414cb1..ba1eb51ff 100644 --- a/ir/be/bechordal.c +++ b/ir/be/bechordal.c @@ -69,7 +69,6 @@ DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;) typedef struct be_chordal_alloc_env_t { be_chordal_env_t *chordal_env; - pset *pre_colored; /**< Set of precolored nodes. */ bitset_t *live; /**< A liveness bitset. */ bitset_t *tmp_colors; /**< An auxiliary bitset which is as long as the number of colors in the class. */ bitset_t *colors; /**< The color mask. */ @@ -164,12 +163,6 @@ static void handle_constraints(be_chordal_alloc_env_t *alloc_env, be_insn_t *insn = be_scan_insn(env, irn); bipartite_t *bp; - if (insn->pre_colored) { - int i; - for (i = 0; i < insn->use_start; ++i) - pset_insert_ptr(alloc_env->pre_colored, insn->ops[i].carrier); - } - /* * Perms inserted before the constraint handling phase are considered to be * correctly precolored. These Perms arise during the ABI handling phase. @@ -306,14 +299,12 @@ static void handle_constraints(be_chordal_alloc_env_t *alloc_env, irn = alloc_nodes[i]; if (irn != NULL) { arch_set_irn_register(irn, reg); - (void) pset_hinsert_ptr(alloc_env->pre_colored, irn); DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", irn, reg->name)); } irn = pmap_get(ir_node, partners, alloc_nodes[i]); if (irn != NULL) { arch_set_irn_register(irn, reg); - (void) pset_hinsert_ptr(alloc_env->pre_colored, irn); DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", irn, reg->name)); } } @@ -342,7 +333,6 @@ static void handle_constraints(be_chordal_alloc_env_t *alloc_env, reg = arch_register_for_index(env->cls, col); bitset_set(bs, reg->index); arch_set_irn_register(proj, reg); - pset_insert_ptr(alloc_env->pre_colored, proj); DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", proj, reg->name)); } } @@ -423,28 +413,24 @@ static void assign(ir_node *block, void *env_ptr) foreach_border_head(head, b) { ir_node *irn = b->irn; int nr = get_irn_idx(irn); - int ignore = arch_irn_is_ignore(irn); /* * Assign a color, if it is a local def. Global defs already have a * color. */ if (b->is_def && !be_is_live_in(lv, block, irn)) { - const arch_register_t *reg; - int col; - - if (ignore || pset_find_ptr(alloc_env->pre_colored, irn)) { - reg = arch_get_irn_register(irn); + int col; + arch_register_t const *reg = arch_get_irn_register(irn); + if (reg) { col = reg->index; assert(!bitset_is_set(colors, col) && "pre-colored register must be free"); } else { + assert(!arch_irn_is_ignore(irn)); col = get_next_free_reg(alloc_env, colors); reg = arch_register_for_index(env->cls, col); - assert(arch_get_irn_register(irn) == NULL && "This node must not have been assigned a register yet"); + arch_set_irn_register(irn, reg); } - bitset_set(colors, col); - arch_set_irn_register(irn, reg); DBG((dbg, LEVEL_1, "\tassigning register %s(%d) to %+F\n", reg->name, col, irn)); @@ -477,7 +463,6 @@ static void be_ra_chordal_color(be_chordal_env_t *const chordal_env) env.chordal_env = chordal_env; env.colors = bitset_alloca(colors_n); env.tmp_colors = bitset_alloca(colors_n); - env.pre_colored = pset_new_ptr_default(); be_timer_push(T_SPLIT); @@ -517,7 +502,6 @@ static void be_ra_chordal_color(be_chordal_env_t *const chordal_env) } bitset_free(env.live); - del_pset(env.pre_colored); } BE_REGISTER_MODULE_CONSTRUCTOR(be_init_chordal) diff --git a/ir/be/beinsn.c b/ir/be/beinsn.c index e72fd8927..a3f305da8 100644 --- a/ir/be/beinsn.c +++ b/ir/be/beinsn.c @@ -41,7 +41,6 @@ be_insn_t *be_scan_insn(be_chordal_env_t const *const env, ir_node *const irn) struct obstack *obst = env->obst; be_operand_t o; int i, n; - int pre_colored = 0; be_insn_t *insn = OALLOCZ(obst, be_insn_t); @@ -69,7 +68,6 @@ be_insn_t *be_scan_insn(be_chordal_env_t const *const env, ir_node *const irn) obstack_grow(obst, &o, sizeof(o)); insn->n_ops++; insn->has_constraints |= o.has_constraints; - pre_colored += arch_get_irn_register(p) != NULL; } } } else if (arch_irn_consider_in_reg_alloc(env->cls, irn)) { @@ -83,14 +81,9 @@ be_insn_t *be_scan_insn(be_chordal_env_t const *const env, ir_node *const irn) obstack_grow(obst, &o, sizeof(o)); insn->n_ops++; insn->has_constraints |= o.has_constraints; - pre_colored += arch_get_irn_register(irn) != NULL; } - if (pre_colored > 0) { - assert(pre_colored == insn->n_ops && "partly pre-colored nodes not supported"); - insn->pre_colored = 1; - } - insn->use_start = insn->n_ops; + insn->use_start = insn->n_ops; /* now collect the uses for this node */ for (i = 0, n = get_irn_arity(irn); i < n; ++i) { diff --git a/ir/be/beinsn_t.h b/ir/be/beinsn_t.h index 5e7db184f..1c9ab1ba2 100644 --- a/ir/be/beinsn_t.h +++ b/ir/be/beinsn_t.h @@ -53,7 +53,6 @@ struct be_insn_t { [use_start-n_ops) uses */ ir_node *irn; /**< ir_node of the instruction */ unsigned has_constraints : 1; /**< in_constraints or out_constraints true */ - unsigned pre_colored : 1; /**< all defined values already have a register assigned */ }; /** -- 2.20.1