summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMaximilian Stemmer-Grabow <mail@mxsg.de>2021-06-03 14:14:36 +0200
committerAndreas Fried <andreas.fried@kit.edu>2021-12-02 12:57:28 +0100
commit015760827b86118102326eda84db2d5e782525da (patch)
treefc5dec4da952b57e56d098da465c1a1d84675d5b
parent2d38dcf780dc5902f15687781953a256cab64517 (diff)
Adjust affinity costs in weight recalculation
-rw-r--r--ir/be/becopyheur4.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ir/be/becopyheur4.c b/ir/be/becopyheur4.c
index c9d864f..79f5f39 100644
--- a/ir/be/becopyheur4.c
+++ b/ir/be/becopyheur4.c
@@ -585,9 +585,18 @@ static void aff_chunk_assure_weight(co_mst_env_t *env, aff_chunk_t *c)
}
}
- for (unsigned i = 0, n = env->n_regs; i < n; ++i)
+ 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));
+ // 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;
+ }
+ }
+
c->comp_reg_restr_count = register_restr_count;
c->weight = w;