mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
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:
parent
e9bad677af
commit
0afc6fa880
1 changed files with 10 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue