pan/bi: Add Valhall-specific zero builder

When emitting code during or after register allocation, we need to be able to
emit constants without running the constant->{LUT, move, uniform} pass running
after. In particular, we need to access the constant 0 to implement spill code.
Add a Valhall-specific zero for this purpose.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15461>
This commit is contained in:
Alyssa Rosenzweig 2021-12-21 17:18:28 -05:00 committed by Marge Bot
parent 666b714a37
commit 38625af010

View file

@ -790,6 +790,31 @@ bi_fau(enum bir_fau value, bool hi)
};
}
/*
* Builder for Valhall LUT entries. Generally, constants are modeled with
* BI_INDEX_IMMEDIATE in the intermediate representation. This helper is only
* necessary for passes running after lowering constants, as well as when
* lowering constants.
*
*/
static inline bi_index
va_lut(unsigned index)
{
return bi_fau((enum bir_fau) (BIR_FAU_IMMEDIATE | (index >> 1)),
index & 1);
}
/*
* va_lut_zero is like bi_zero but only works on Valhall. It is intended for
* use by late passes that run after constants are lowered, specifically
* register allocation. bi_zero() is preferred where possible.
*/
static inline bi_index
va_zero_lut()
{
return va_lut(0);
}
static inline unsigned
bi_max_temp(bi_context *ctx)
{