pan/bi: Inline bytemask of read components

Only used in one place (and should never be used elsewhere -- even this
use is questionable). By inlining we avoid O(N^2) behaviour on the
number of sources in liveness updates.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9164>
This commit is contained in:
Alyssa Rosenzweig 2021-02-18 16:26:02 -05:00 committed by Marge Bot
parent 9882a59a2f
commit 11fbe5aeb5
3 changed files with 5 additions and 20 deletions

View file

@ -32,10 +32,12 @@ bi_liveness_ins_update(uint16_t *live, bi_instr *ins, unsigned max)
pan_liveness_kill(live, bi_get_node(ins->dest[0]), max, bi_writemask(ins));
bi_foreach_src(ins, src) {
unsigned node = bi_get_node(ins->src[src]);
unsigned bytemask = bi_bytemask_of_read_components(ins, ins->src[src]);
unsigned count = bi_count_read_registers(ins, src);
unsigned rmask = (1 << (4 * count)) - 1;
uint16_t mask = (rmask << (4 * ins->src[src].offset));
pan_liveness_gen(live, node, max, bytemask);
unsigned node = bi_get_node(ins->src[src]);
pan_liveness_gen(live, node, max, mask);
}
}

View file

@ -92,22 +92,6 @@ bi_count_read_registers(bi_instr *ins, unsigned s)
return 1;
}
uint16_t
bi_bytemask_of_read_components(bi_instr *ins, bi_index node)
{
uint16_t mask = 0x0;
bi_foreach_src(ins, s) {
if (!bi_is_equiv(ins->src[s], node)) continue;
unsigned count = bi_count_read_registers(ins, s);
unsigned rmask = (1 << (4 * count)) - 1;
mask |= (rmask << (4 * node.offset));
}
return mask;
}
unsigned
bi_writemask(bi_instr *ins)
{

View file

@ -730,7 +730,6 @@ pan_next_block(pan_block *block)
bool bi_has_arg(bi_instr *ins, bi_index arg);
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);