This means we're now overestimating liveliness of regs, but better than the other way around. It also makes fixing #18074 easier. --- src/mesa/drivers/dri/i915/i915_fragprog.c | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 4760906..46f1740 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -274,23 +274,28 @@ static void calc_live_regs( struct i915_fragment_program *p ) const struct gl_fragment_program *program = p->ctx->FragmentProgram._Current; GLuint regsUsed = 0xffff0000; GLint i; - + + /* Work from the front marking regs as live when they're written to. */ + for (i = 0; i < program->Base.NumInstructions; i++) { + struct prog_instruction *inst = &program->Base.Instructions[i]; + + if (inst->DstReg.File == PROGRAM_TEMPORARY) + regsUsed |= 1 << inst->DstReg.Index; + p->usedRegs[i] = regsUsed; + } + + /* Work from the back, turning off the live bit until it's read. */ + regsUsed = 0; for (i = program->Base.NumInstructions - 1; i >= 0; i--) { struct prog_instruction *inst = &program->Base.Instructions[i]; int opArgs = _mesa_num_inst_src_regs(inst->Opcode); int a; - /* Register is written to: unmark as live for this and preceeding ops */ - if (inst->DstReg.File == PROGRAM_TEMPORARY) - regsUsed &= ~(1 << inst->DstReg.Index); - for (a = 0; a < opArgs; a++) { - /* Register is read from: mark as live for this and preceeding ops */ if (inst->SrcReg[a].File == PROGRAM_TEMPORARY) regsUsed |= 1 << inst->SrcReg[a].Index; } - - p->usedRegs[i] = regsUsed; + p->usedRegs[i] &= regsUsed; } } @@ -302,7 +307,6 @@ static GLuint get_live_regs( struct i915_fragment_program *p, return p->usedRegs[nr]; } - /* Possible concerns: * -- 1.5.6.5 ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev