diff options
author | Tom Stellard <[email protected]> | 2012-09-03 10:43:45 -0400 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2012-09-19 19:25:53 -0400 |
commit | e0f64a837f58d50b4eb7d3d38ad6f188e767c045 (patch) | |
tree | 8dfd6dce7b65d973e56a1874c2c539855c1ea09e /src/mesa/program/register_allocate.c | |
parent | cfeb99c7daa127f397ae970eba47a181dd02f5d8 (diff) |
ra: Add q_values parameter to ra_set_finalize()
This allows the user to pass precomputed q values to the allocator.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/program/register_allocate.c')
-rw-r--r-- | src/mesa/program/register_allocate.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mesa/program/register_allocate.c b/src/mesa/program/register_allocate.c index 07eb154954d..97d4e331c91 100644 --- a/src/mesa/program/register_allocate.c +++ b/src/mesa/program/register_allocate.c @@ -255,9 +255,11 @@ ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int r) /** * Must be called after all conflicts and register classes have been * set up and before the register set is used for allocation. + * To avoid costly q value computation, use the q_values paramater + * to pass precomputed q values to this function. */ void -ra_set_finalize(struct ra_regs *regs) +ra_set_finalize(struct ra_regs *regs, unsigned int **q_values) { unsigned int b, c; @@ -265,6 +267,15 @@ ra_set_finalize(struct ra_regs *regs) regs->classes[b]->q = ralloc_array(regs, unsigned int, regs->class_count); } + if (q_values) { + for (b = 0; b < regs->class_count; b++) { + for (c = 0; c < regs->class_count; c++) { + regs->classes[b]->q[c] = q_values[b][c]; + } + } + return; + } + /* Compute, for each class B and C, how many regs of B an * allocation to C could conflict with. */ |