aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/program/register_allocate.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-03-18 16:34:52 +0100
committermarha <marha@users.sourceforge.net>2013-03-18 16:34:52 +0100
commit1923199a967ec1add54ad8c0e5d48ee320efdb9f (patch)
treeb8c3af0c9f15576a65d85bb80f94546d7c0d0542 /mesalib/src/mesa/program/register_allocate.c
parentb5acb643ab1a86b31409900a7c03281fcc48c8e3 (diff)
parent9c17f511266fff48a936633de280f271f0ce0c11 (diff)
downloadvcxsrv-1923199a967ec1add54ad8c0e5d48ee320efdb9f.tar.gz
vcxsrv-1923199a967ec1add54ad8c0e5d48ee320efdb9f.tar.bz2
vcxsrv-1923199a967ec1add54ad8c0e5d48ee320efdb9f.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libX11 mesa git update 18 Mar 2013 fontconfig libX11 mesa pixman xserver xkeyboard-config git update 11 Mar 2013
Diffstat (limited to 'mesalib/src/mesa/program/register_allocate.c')
-rw-r--r--mesalib/src/mesa/program/register_allocate.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c
index 88793dbdc..a9064c38c 100644
--- a/mesalib/src/mesa/program/register_allocate.c
+++ b/mesalib/src/mesa/program/register_allocate.c
@@ -75,6 +75,7 @@
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
+#include "main/bitset.h"
#include "register_allocate.h"
#define NO_REG ~0
@@ -118,8 +119,9 @@ struct ra_node {
* List of which nodes this node interferes with. This should be
* symmetric with the other node.
*/
- GLboolean *adjacency;
+ BITSET_WORD *adjacency;
unsigned int *adjacency_list;
+ unsigned int adjacency_list_size;
unsigned int adjacency_count;
/** @} */
@@ -306,7 +308,16 @@ ra_set_finalize(struct ra_regs *regs, unsigned int **q_values)
static void
ra_add_node_adjacency(struct ra_graph *g, unsigned int n1, unsigned int n2)
{
- g->nodes[n1].adjacency[n2] = GL_TRUE;
+ BITSET_SET(g->nodes[n1].adjacency, n2);
+
+ if (g->nodes[n1].adjacency_count >=
+ g->nodes[n1].adjacency_list_size) {
+ g->nodes[n1].adjacency_list_size *= 2;
+ g->nodes[n1].adjacency_list = reralloc(g, g->nodes[n1].adjacency_list,
+ unsigned int,
+ g->nodes[n1].adjacency_list_size);
+ }
+
g->nodes[n1].adjacency_list[g->nodes[n1].adjacency_count] = n2;
g->nodes[n1].adjacency_count++;
}
@@ -325,9 +336,14 @@ ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count)
g->stack = rzalloc_array(g, unsigned int, count);
for (i = 0; i < count; i++) {
- g->nodes[i].adjacency = rzalloc_array(g, GLboolean, count);
- g->nodes[i].adjacency_list = ralloc_array(g, unsigned int, count);
+ int bitset_count = ALIGN(count, BITSET_WORDBITS) / BITSET_WORDBITS;
+ g->nodes[i].adjacency = rzalloc_array(g, BITSET_WORD, bitset_count);
+
+ g->nodes[i].adjacency_list_size = 4;
+ g->nodes[i].adjacency_list =
+ ralloc_array(g, unsigned int, g->nodes[i].adjacency_list_size);
g->nodes[i].adjacency_count = 0;
+
ra_add_node_adjacency(g, i, i);
g->nodes[i].reg = NO_REG;
}
@@ -346,7 +362,7 @@ void
ra_add_node_interference(struct ra_graph *g,
unsigned int n1, unsigned int n2)
{
- if (!g->nodes[n1].adjacency[n2]) {
+ if (!BITSET_TEST(g->nodes[n1].adjacency, n2)) {
ra_add_node_adjacency(g, n1, n2);
ra_add_node_adjacency(g, n2, n1);
}