nak: Add for_each_instr in Shader

Allows to visit each instructions without remapping every functions.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
Mary Guillemard 2023-09-15 14:45:59 +02:00 committed by Marge Bot
parent e9bad677af
commit 0afc6fa880

View file

@ -4484,6 +4484,16 @@ pub struct Shader {
}
impl Shader {
pub fn for_each_instr(&self, f: &mut impl FnMut(&Instr)) {
for func in &self.functions {
for b in &func.blocks {
for i in &b.instrs {
f(i);
}
}
}
}
pub fn map_instrs(
&mut self,
mut map: impl FnMut(Box<Instr>, &mut SSAValueAllocator) -> MappedInstrs,