i965/fs: Make register spill/unspill only do the regs for that instruction.
authorEric Anholt <eric@anholt.net>
Sat, 7 Jul 2012 00:18:35 +0000 (17:18 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 18 Jul 2012 19:30:06 +0000 (12:30 -0700)
commita40c1f95229915214be061fbbf9a02e5225fbf01
tree2797b0d558c8f00054c47cf3e3c74ed24d0b3aa7
parenta454f8ec6df9334df42249be910cc2d57d913bff
i965/fs: Make register spill/unspill only do the regs for that instruction.

Previously, if we were spilling the result of a texture call, we would store
all 4 regs, then for each use of one of those regs as the source of an
instruction, we would unspill all 4 regs even though only one was needed.

In both lightsmark and l4d2 with my current graphics config, the shaders that
produce spilling do so on split GRFs, so this doesn't help them out.  However,
in a capture of the l4d2 shaders with a different snapshot and playing the
game instead of using a demo, it reduced one shader from 2817 instructions to
2179, due to choosing a now-cheaper texture result to spill instead of piles
of texcoords.

v2: Fix comment noted by Ken, and fix the if condition associated with it for
    the current state of what constitutes a partial write of the destination.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp