aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/util/register_allocate.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-03-05 22:17:40 +0100
committermarha <marha@users.sourceforge.net>2015-03-05 22:17:40 +0100
commit8574eba804031f6b19713f0b02952280730bf62e (patch)
tree9afa4d6fe299d43ab7e580dc08a5547120274561 /mesalib/src/util/register_allocate.c
parenteef70231353a6103f47fcae88a6e89e765e5cd47 (diff)
downloadvcxsrv-8574eba804031f6b19713f0b02952280730bf62e.tar.gz
vcxsrv-8574eba804031f6b19713f0b02952280730bf62e.tar.bz2
vcxsrv-8574eba804031f6b19713f0b02952280730bf62e.zip
fontconfig mesa git update 5 Mar 2015
Diffstat (limited to 'mesalib/src/util/register_allocate.c')
-rw-r--r--mesalib/src/util/register_allocate.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/mesalib/src/util/register_allocate.c b/mesalib/src/util/register_allocate.c
index 684ee5d6c..2ad8c3ce1 100644
--- a/mesalib/src/util/register_allocate.c
+++ b/mesalib/src/util/register_allocate.c
@@ -168,6 +168,12 @@ struct ra_graph {
unsigned int *stack;
unsigned int stack_count;
+
+ /**
+ * Tracks the start of the set of optimistically-colored registers in the
+ * stack.
+ */
+ unsigned int stack_optimistic_start;
};
/**
@@ -454,6 +460,7 @@ static void
ra_simplify(struct ra_graph *g)
{
bool progress = true;
+ unsigned int stack_optimistic_start = UINT_MAX;
int i;
while (progress) {
@@ -482,6 +489,9 @@ ra_simplify(struct ra_graph *g)
}
if (!progress && best_optimistic_node != ~0U) {
+ if (stack_optimistic_start == UINT_MAX)
+ stack_optimistic_start = g->stack_count;
+
decrement_q(g, best_optimistic_node);
g->stack[g->stack_count] = best_optimistic_node;
g->stack_count++;
@@ -489,6 +499,8 @@ ra_simplify(struct ra_graph *g)
progress = true;
}
}
+
+ g->stack_optimistic_start = stack_optimistic_start;
}
/**
@@ -542,7 +554,17 @@ ra_select(struct ra_graph *g)
g->nodes[n].reg = r;
g->stack_count--;
- if (g->regs->round_robin)
+ /* Rotate the starting point except for any nodes above the lowest
+ * optimistically colorable node. The likelihood that we will succeed
+ * at allocating optimistically colorable nodes is highly dependent on
+ * the way that the previous nodes popped off the stack are laid out.
+ * The round-robin strategy increases the fragmentation of the register
+ * file and decreases the number of nearby nodes assigned to the same
+ * color, what increases the likelihood of spilling with respect to the
+ * dense packing strategy.
+ */
+ if (g->regs->round_robin &&
+ g->stack_count - 1 <= g->stack_optimistic_start)
start_search_reg = r + 1;
}