struct gl_shader_program *shader_prog,
struct brw_shader *shader,
void *mem_ctx,
- bool debug_flag);
+ bool debug_flag,
+ bool no_spills);
~vec4_visitor();
dst_reg dst_null_f()
virtual int compute_array_stride(ir_dereference_array *ir);
const bool debug_flag;
+
+private:
+ /**
+ * If true, then register allocation should fail instead of spilling.
+ */
+ const bool no_spills;
};
struct brw_gs_compile *c,
struct gl_shader_program *prog,
struct brw_shader *shader,
- void *mem_ctx)
+ void *mem_ctx,
+ bool no_spills)
: vec4_visitor(brw, &c->base, &c->gp->program.Base, &c->key.base,
&c->prog_data.base, prog, shader, mem_ctx,
- INTEL_DEBUG & DEBUG_GS),
+ INTEL_DEBUG & DEBUG_GS, no_spills),
c(c)
{
}
printf("\n\n");
}
- vec4_gs_visitor v(brw, c, prog, shader, mem_ctx);
+ vec4_gs_visitor v(brw, c, prog, shader, mem_ctx, false /* no_spills */);
if (!v.run()) {
prog->LinkStatus = false;
ralloc_strcat(&prog->InfoLog, v.fail_msg);
struct brw_gs_compile *c,
struct gl_shader_program *prog,
struct brw_shader *shader,
- void *mem_ctx);
+ void *mem_ctx,
+ bool no_spills);
protected:
virtual dst_reg *make_reg_for_system_value(ir_variable *ir);
* loop back into here to try again.
*/
int reg = choose_spill_reg(g);
- if (reg == -1) {
+ if (this->no_spills) {
+ fail("Failure to register allocate. Reduce number of live "
+ "values to avoid this.");
+ } else if (reg == -1) {
fail("no register to spill\n");
} else {
spill_reg(reg);
struct gl_shader_program *shader_prog,
struct brw_shader *shader,
void *mem_ctx,
- bool debug_flag)
- : debug_flag(debug_flag)
+ bool debug_flag,
+ bool no_spills)
+ : debug_flag(debug_flag), no_spills(no_spills)
{
this->brw = brw;
this->ctx = &brw->ctx;
void *mem_ctx)
: vec4_visitor(brw, &vs_compile->base, &vs_compile->vp->program.Base,
&vs_compile->key.base, &vs_prog_data->base, prog, shader,
- mem_ctx, INTEL_DEBUG & DEBUG_VS),
+ mem_ctx, INTEL_DEBUG & DEBUG_VS, false /* no_spills */),
vs_compile(vs_compile),
vs_prog_data(vs_prog_data)
{
register_coalesce_vec4_visitor(struct brw_context *brw,
struct gl_shader_program *shader_prog)
: vec4_visitor(brw, NULL, NULL, NULL, NULL, shader_prog, NULL, NULL,
- false)
+ false, false /* no_spills */)
{
}