The new compiler generates a dependency graph of instructions, including a few meta-instructions to handle PHI and preserve some extra information needed for register assignment, etc.
The depth pass assigned a weight/depth to each node (based on sum of instruction cycles of a given node and all it's dependent nodes), which is used to schedule instructions. The scheduling takes into account the minimum number of cycles/slots between dependent instructions, etc. Which was something that could not be handled properly with the original compiler (which was more of a naive TGSI translator than an actual compiler).
The register assignment is currently split out as a standalone pass. I expect that it will be replaced at some point, once I figure out what to do about relative addressing (which is currently the only thing that should cause fallback to old compiler).
There are a couple new debug options for FD_MESA_DEBUG env var:
optmsgs - enable debug prints in optimizer optdump - dump instruction graph in .dot format, for example:
At this point, thanks to proper handling of instruction scheduling, the new compiler fixes a lot of things that were broken before, and does not appear to break anything that was working before. So even though it is not finished, it seems useful to merge it in it's current state.
 Not merged in this commit, because I'm not sure if it really belongs in mesa tree, but the following commit implements a simple shader emulator, which I've used to compare the output of the new compiler to the original compiler (ie. run it on all the TGSI shaders dumped out via ST_DEBUG=tgsi with various games/apps):
554f1ac freedreno/a3xx/compiler: new compiler
src/gallium/drivers/freedreno/Makefile.sources | 6 +
src/gallium/drivers/freedreno/a3xx/disasm-a3xx.c | 8 +
src/gallium/drivers/freedreno/a3xx/fd3_compiler.c | 912 ++++++++++++++++----
.../drivers/freedreno/a3xx/fd3_compiler_old.c | 17 -
src/gallium/drivers/freedreno/a3xx/fd3_program.c | 4 +-
src/gallium/drivers/freedreno/a3xx/instr-a3xx.h | 33 +
src/gallium/drivers/freedreno/a3xx/ir3.c | 2 +-
src/gallium/drivers/freedreno/a3xx/ir3.h | 110 ++-
src/gallium/drivers/freedreno/a3xx/ir3_cp.c | 155 ++++
src/gallium/drivers/freedreno/a3xx/ir3_depth.c | 156 ++++
src/gallium/drivers/freedreno/a3xx/ir3_dump.c | 416 +++++++++
src/gallium/drivers/freedreno/a3xx/ir3_flatten.c | 140 +++
src/gallium/drivers/freedreno/a3xx/ir3_ra.c | 580 +++++++++++++
src/gallium/drivers/freedreno/a3xx/ir3_sched.c | 289 +++++++
src/gallium/drivers/freedreno/a3xx/ir3_visitor.h | 154 ++++
src/gallium/drivers/freedreno/freedreno_screen.c | 2 +
src/gallium/drivers/freedreno/freedreno_util.h | 2 +
17 files changed, 2777 insertions(+), 209 deletions(-)