pan/bi: Add side_effects helper

DCE needs to be tuned for this.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8848>
This commit is contained in:
Alyssa Rosenzweig 2021-02-03 14:33:48 -05:00 committed by Marge Bot
parent 836c1c6fb1
commit f5709f17a2
2 changed files with 34 additions and 0 deletions

View file

@ -152,3 +152,36 @@ bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause)
return NULL;
}
/* Does an instruction have a side effect not captured by its register
* destination? Applies to certain message-passing instructions only, used in
* dead code elimation */
bool
bi_side_effects(enum bi_opcode op)
{
switch (bi_opcode_props[op].message) {
case BIFROST_MESSAGE_NONE:
case BIFROST_MESSAGE_VARYING:
case BIFROST_MESSAGE_ATTRIBUTE:
case BIFROST_MESSAGE_TEX:
case BIFROST_MESSAGE_VARTEX:
case BIFROST_MESSAGE_LOAD:
case BIFROST_MESSAGE_64BIT:
return false;
case BIFROST_MESSAGE_STORE:
case BIFROST_MESSAGE_ATOMIC:
case BIFROST_MESSAGE_BARRIER:
case BIFROST_MESSAGE_BLEND:
case BIFROST_MESSAGE_Z_STENCIL:
case BIFROST_MESSAGE_ATEST:
case BIFROST_MESSAGE_JOB:
return true;
case BIFROST_MESSAGE_TILE:
return (op != BI_OPCODE_LD_TILE);
}
unreachable("Invalid message type");
}

View file

@ -708,6 +708,7 @@ unsigned bi_count_read_registers(bi_instr *ins, unsigned src);
uint16_t bi_bytemask_of_read_components(bi_instr *ins, bi_index node);
unsigned bi_writemask(bi_instr *ins);
bi_clause * bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause);
bool bi_side_effects(enum bi_opcode op);
void bi_print_instr(bi_instr *I, FILE *fp);
void bi_print_slots(bi_registers *regs, FILE *fp);