diff options
author | Paul Berry <[email protected]> | 2012-09-28 14:21:38 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2012-10-03 12:54:42 -0700 |
commit | 551c991606e543c3a264a762026f11348b37947e (patch) | |
tree | 6c689e266ac9f290a89817e69e22d62f1bc4926d /src | |
parent | 53d06ecdd02d36769cfd3da55d99a569c00b7878 (diff) |
register_allocate: don't consider trivially colorable registers for spilling.
Previously, we considered all registers as candidates for spilling.
This was counterproductive--for any registers that have already been
removed from the interference graph, there is no benefit to spilling
them, since they don't contribute to register pressure.
This patch ensures that we will only try to spill registers that are
still in the interference graph after register allocation has failed.
This is consistent with the recommendations of the paper "Retargetable
Graph-Coloring Register Allocation for Irregular Architectures", on
which our register allocator is based.
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/program/register_allocate.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/program/register_allocate.c b/src/mesa/program/register_allocate.c index 97d4e331c91..88793dbdc1e 100644 --- a/src/mesa/program/register_allocate.c +++ b/src/mesa/program/register_allocate.c @@ -555,6 +555,13 @@ ra_get_best_spill_node(struct ra_graph *g) if (cost <= 0.0) continue; + /* Only consider registers for spilling if they are still in the + * interference graph (those on the stack have already been proven to be + * allocatable without spilling). + */ + if (g->nodes[n].in_stack) + continue; + benefit = ra_get_spill_benefit(g, n); if (benefit / cost > best_benefit) { |