agx: Mark sources that kill

Trivially computed during liveness analysis (already a byproduct!) and required
for efficient register allocation.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11718>
This commit is contained in:
Alyssa Rosenzweig 2021-06-19 13:56:28 -04:00 committed by Marge Bot
parent 7972e74f40
commit 0ef93554e1
3 changed files with 14 additions and 2 deletions

View file

@ -59,7 +59,12 @@ enum agx_size {
typedef struct {
/* Sufficient for as many SSA values as we need. Immediates and uniforms fit in 16-bits */
unsigned value : 23;
unsigned value : 22;
/* Indicates that this source kills the referenced value (because it is the
* last use in a block and the source is not live after the block). Set by
* liveness analysis. */
bool kill : 1;
/* Cache hints */
bool cache : 1;

View file

@ -42,8 +42,12 @@ agx_liveness_ins_update(BITSET_WORD *live, agx_instr *I)
}
agx_foreach_src(I, s) {
if (I->src[s].type == AGX_INDEX_NORMAL)
if (I->src[s].type == AGX_INDEX_NORMAL) {
/* If the source is not live after this instruction, but becomes live
* at this instruction, this is the use that kills the source */
I->src[s].kill = !BITSET_TEST(live, I->src[s].value);
BITSET_SET(live, I->src[s].value);
}
}
}

View file

@ -60,6 +60,9 @@ agx_print_index(agx_index index, FILE *fp)
if (index.discard)
fprintf(fp, "`");
if (index.kill)
fprintf(fp, "*");
fprintf(fp, "%u", index.value);
break;