openfimg: compiler: Enforce non-temporary register access constraint

Non-temporary registers can be accessed only once per instruction per
register type, which means that for an instruction that has more than
one operand of particular non-temporary type, all but one of them must
be preloaded to temporary registers.

The pass doing the enforcement is very naive, inserting movs for
subsequent operands of given type after first, so there is room for
improvement.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
openfimg: compiler: Evaluate interferences only when var becomes live

This saves the CPU some work and prevents the variable becoming alive
from being marked as interfering with itself, which could cause issues
with coloring further in the code.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
openfimg: Enable -Werror flag to prevent warnings from sneaking in

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
openfimg: compiler: Add BIT() macro which returns bit mask of given bit

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
openfimg: compiler: Use num_srcs field of of_ir_instruction

No need to iterate through all possible sources...

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
openfimg: compiler: Add handling of register parity in 3-source ops

Each instruction can access registers of the same parity at most two
times, which means that there might not be three temporary operands of
the same parity in a 3-source instruction.

The code is still a bit too conservative as it simply semi-randomly
assigns parity constraint for each operand of 3-source instructions in
a globally round robin fashion. However in practice it should work fine.
The only case current code fails is obviously when all three operands
are the same variables, which is not very likely to be spotted in real
shaders, but needs to be fixed anyway.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
openfimg: compiler: Use available helpers wherever possible

Mostly about BIT() and reg_comp_used().

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
openfimg: compiler: Minor style fixes

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
openfimg: compiler: Fix component check in chunk coloring

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
openfimg: compiler: Add register parity check to chunk coloring

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>