i965/fs: Prefer things we know reduce reg pressure when pre-scheduling.
authorEric Anholt <eric@anholt.net>
Mon, 14 Oct 2013 18:38:09 +0000 (11:38 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 12 Nov 2013 23:04:32 +0000 (15:04 -0800)
commitbc0e3bb4d05fbb5e8e2af8dce8170cb78cfe0e70
treecb0f38222e4eabc757c13601fa99d02a155b35e8
parent9b3e1592c26a183580342282e509d906d78bb6f6
i965/fs: Prefer things we know reduce reg pressure when pre-scheduling.

Previously, the best thing we had was to schedule the things unblocked by
the last chosen instruction, on the hope that it would be consuming two
values at the end of their live intervals while only producing one new
value.  But that's just a guess, and we can do counting of usage of
registers to know when an instruction would (almost surely) reduce
register pressure.

The only failure mode I know of in this new dominant heuristic is that
inside of a loop when scheduling the iterator (for example), choosing the
last use of the iterator doesn't actually reduce the live interval of the
iterator.  But it doesn't seem to matter in shader-db:

total instructions in shared programs: 1618700 -> 1618700 (0.00%)
instructions in affected programs:     0 -> 0
GAINED:                                13
LOST:                                  0

Note: The new functions are made virtual because I expect we'll soon lift
the pre-regalloc scheduling heuristic over to the vec4 backend.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp