summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMaximilian Stemmer-Grabow <mail@mxsg.de>2021-06-03 17:13:59 +0200
committerAndreas Fried <andreas.fried@kit.edu>2021-12-02 12:57:28 +0100
commit498a3dc16579340972e6958e4bd6ce7c7caeedc0 (patch)
treee31a338adc0d90518492631eef376b2d7ae9030f
parente602d07ae366f8b22b4e812c9a4210d837459c73 (diff)
Output more verbose debugging information for color cost adjustments
-rw-r--r--ir/be/becopyheur4.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/ir/be/becopyheur4.c b/ir/be/becopyheur4.c
index 33079ad..e623a8c 100644
--- a/ir/be/becopyheur4.c
+++ b/ir/be/becopyheur4.c
@@ -585,18 +585,27 @@ static void aff_chunk_assure_weight(co_mst_env_t *env, aff_chunk_t *c)
}
}
+ DB((dbg, LEVEL_1, "Recalculate weight for chunk #%u, (col: adjusted from -> to): ", c->id));
+
double compressibility_factor = c->comp_reg_restr_count / (double)ARR_LEN(c->n);
for (unsigned i = 0, n = env->n_regs; i < n; ++i) {
- c->color_affinity[i].cost *= (1.0 / ARR_LEN(c->n));
+ double prior_cost = c->color_affinity[i].cost * (1.0 / ARR_LEN(c->n));
+ double adjusted_cost = prior_cost;
// If the register is not compressible, adjust the cost upwards according to the compressibility factor,
// up to a maximum set by the compressibility influence parameter.
if (!bitset_is_set(env->compressible_regs, i)) {
- c->color_affinity[i].cost *= compressibility_factor * compressibility_influence;
+ adjusted_cost = prior_cost * compressibility_factor * compressibility_influence;
}
+
+ c->color_affinity[i].cost = adjusted_cost;
+
+ DB((dbg, LEVEL_1, "(%u: %d -> %d)", i, prior_cost, adjusted_cost));
}
+ DB((dbg, LEVEL_1, "\n"));
+
c->comp_reg_restr_count = register_restr_count;
c->weight = w;
@@ -1111,18 +1120,28 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c)
double compressibility_factor = c->comp_reg_restr_count / (double)ARR_LEN(c->n);
+ DB((dbg, LEVEL_1, "Coloring chunk #%u, costs are (col: adjusted from -> to): ", c->id));
+
for (unsigned i = 0, n = env->n_regs; i < n; ++i) {
double dislike = n_int_chunks > 0 ? 1.0 - order[i].cost / n_int_chunks : 0.0;
- order[i].col = i;
- order[i].cost = (1.0 - dislike_influence) * c->color_affinity[i].cost + dislike_influence * dislike;
+
+ double prior_cost = (1.0 - dislike_influence) * c->color_affinity[i].cost + dislike_influence * dislike;
+ double adjusted_cost = prior_cost;
// If the register is not compressible, adjust the cost upwards according to the compressibility factor,
// up to a maximum set by the compressibility influence parameter.
if (!bitset_is_set(env->compressible_regs, i)) {
- order[i].cost *= compressibility_factor * compressibility_influence;
+ adjusted_cost = prior_cost * compressibility_factor * compressibility_influence;
}
+
+ order[i].col = i;
+ order[i].cost = adjusted_cost;
+
+ DB((dbg, LEVEL_1, "(%u: %d -> %d)", i, prior_cost, adjusted_cost));
}
+ DB((dbg, LEVEL_1, "\n"));
+
QSORT(order, env->n_regs, cmp_col_cost_gt);
DBG_COL_COST(env, LEVEL_2, order);