mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
nak: Pass an SSAValueAllocator through to map methods
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
parent
9704772021
commit
df07dd4996
2 changed files with 17 additions and 7 deletions
|
|
@ -1872,10 +1872,14 @@ impl BasicBlock {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn map_instrs<F: Fn(Instr) -> Vec<Instr>>(&mut self, map: &F) {
|
||||
pub fn map_instrs<F: Fn(Instr, &mut SSAValueAllocator) -> Vec<Instr>>(
|
||||
&mut self,
|
||||
map: &F,
|
||||
ssa_alloc: &mut SSAValueAllocator,
|
||||
) {
|
||||
let mut instrs = Vec::new();
|
||||
for i in self.instrs.drain(..) {
|
||||
instrs.append(&mut map(i));
|
||||
instrs.append(&mut map(i, ssa_alloc));
|
||||
}
|
||||
self.instrs = instrs;
|
||||
}
|
||||
|
|
@ -1918,9 +1922,12 @@ impl Function {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn map_instrs<F: Fn(Instr) -> Vec<Instr>>(&mut self, map: &F) {
|
||||
pub fn map_instrs<F: Fn(Instr, &mut SSAValueAllocator) -> Vec<Instr>>(
|
||||
&mut self,
|
||||
map: &F,
|
||||
) {
|
||||
for b in &mut self.blocks {
|
||||
b.map_instrs(map);
|
||||
b.map_instrs(map, &mut self.ssa_alloc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1947,14 +1954,17 @@ impl Shader {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn map_instrs<F: Fn(Instr) -> Vec<Instr>>(&mut self, map: &F) {
|
||||
pub fn map_instrs<F: Fn(Instr, &mut SSAValueAllocator) -> Vec<Instr>>(
|
||||
&mut self,
|
||||
map: &F,
|
||||
) {
|
||||
for f in &mut self.functions {
|
||||
f.map_instrs(map);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn lower_vec_split(&mut self) {
|
||||
self.map_instrs(&|instr: Instr| -> Vec<Instr> {
|
||||
self.map_instrs(&|instr: Instr, _| -> Vec<Instr> {
|
||||
match instr.op {
|
||||
Op::FMov(mov) => {
|
||||
vec![Instr::new(Op::FAdd(OpFAdd {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ impl DeadCodePass {
|
|||
}
|
||||
|
||||
if has_any_dead {
|
||||
f.map_instrs(&|instr: Instr| -> Vec<Instr> {
|
||||
f.map_instrs(&|instr: Instr, _| -> Vec<Instr> {
|
||||
if self.is_instr_live(&instr) {
|
||||
vec![instr]
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue