This allows the user to pass precomputed q values to the allocator.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
get_reg_id(s->Input[i].Index, writemask));
}
- ra_set_finalize(regs);
+ ra_set_finalize(regs, NULL);
graph = ra_alloc_interference_graph(regs, node_count + s->NumInputs);
class_count++;
}
- ra_set_finalize(brw->wm.regs);
+ ra_set_finalize(brw->wm.regs, NULL);
}
bool
}
assert(reg == ra_reg_count);
- ra_set_finalize(brw->vs.regs);
+ ra_set_finalize(brw->vs.regs, NULL);
}
void
/**
* 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;
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.
*/
void ra_add_transitive_reg_conflict(struct ra_regs *regs,
unsigned int base_reg, unsigned int reg);
void ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int reg);
-void ra_set_finalize(struct ra_regs *regs);
+void ra_set_num_conflicts(struct ra_regs *regs, unsigned int class_a,
+ unsigned int class_b, unsigned int num_conflicts);
+void ra_set_finalize(struct ra_regs *regs, unsigned int **conflicts);
/** @} */
/** @{ Interference graph setup.