gallium/tgsi: Introduce the "LOCAL" register declaration modifier.

This change will be useful to implement function parameter passing on
top of TGSI.  As we don't have a proper stack, a register-based
calling convention will be used instead, which isn't necessarily a bad
thing given that GPUs often have plenty of registers to spare.

Using the same register space for local temporaries and
inter-procedural communication caused some inefficiencies, because in
some cases the register allocator would lose the freedom to merge
temporary values together into the same physical register, leading to
suboptimal register (and sometimes, as a side effect, instruction)
usage.

The LOCAL declaration modifier specifies that the value isn't intended
for parameter passing and as a result the compiler doesn't have to
give any guarantees of it being preserved across function boundaries.

Ignoring the LOCAL flag doesn't change the semantics of a valid
program in any way, because local variables are just supposed to get a
more relaxed treatment.  IOW, this should be a backwards-compatible
change.
This commit is contained in:
Francisco Jerez
2012-03-18 19:21:36 +01:00
parent c2d31a83a8
commit 2644952bd4
5 changed files with 55 additions and 28 deletions

View File

@@ -1795,6 +1795,12 @@ of TGSI_FILE.
UsageMask field specifies which of the register components can be accessed
and is one of TGSI_WRITEMASK.
The Local flag specifies that a given value isn't intended for
subroutine parameter passing and, as a result, the implementation
isn't required to give any guarantees of it being preserved across
subroutine boundaries. As it's merely a compiler hint, the
implementation is free to ignore it.
If Dimension flag is set to 1, a Declaration Dimension token follows.
If Semantic flag is set to 1, a Declaration Semantic token follows.