agx/lower_address: Use intrinsics_pass

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25052>
This commit is contained in:
Christian Gmeiner 2023-08-24 11:01:10 +02:00 committed by Marge Bot
parent 251008c1bf
commit d97a79a85e

View file

@ -253,12 +253,8 @@ format_for_bitsize(unsigned bitsize)
}
static bool
pass(struct nir_builder *b, nir_instr *instr, UNUSED void *data)
pass(struct nir_builder *b, nir_intrinsic_instr *intr, void *data)
{
if (instr->type != nir_instr_type_intrinsic)
return false;
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
if (intr->intrinsic != nir_intrinsic_load_global &&
intr->intrinsic != nir_intrinsic_load_global_constant &&
intr->intrinsic != nir_intrinsic_global_atomic &&
@ -266,7 +262,7 @@ pass(struct nir_builder *b, nir_instr *instr, UNUSED void *data)
intr->intrinsic != nir_intrinsic_store_global)
return false;
b->cursor = nir_before_instr(instr);
b->cursor = nir_before_instr(&intr->instr);
unsigned bitsize = intr->intrinsic == nir_intrinsic_store_global
? nir_src_bit_size(intr->src[0])
@ -346,13 +342,13 @@ pass(struct nir_builder *b, nir_instr *instr, UNUSED void *data)
if (repl)
nir_def_rewrite_uses(&intr->def, repl);
nir_instr_remove(instr);
nir_instr_remove(&intr->instr);
return true;
}
bool
agx_nir_lower_address(nir_shader *shader)
{
return nir_shader_instructions_pass(
return nir_shader_intrinsics_pass(
shader, pass, nir_metadata_block_index | nir_metadata_dominance, NULL);
}