mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 10:50:16 +01:00
nak/from_nir: Clean up phi annotations
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
This commit is contained in:
parent
b013d54e4f
commit
ab8a4d1940
1 changed files with 36 additions and 14 deletions
|
|
@ -3106,17 +3106,28 @@ impl<'a> ShaderFromNir<'a> {
|
|||
|
||||
let mut phi = OpPhiDsts::new();
|
||||
for ni in nb.iter_instr_list() {
|
||||
if ni.type_ == nir_instr_type_phi {
|
||||
let np = ni.as_phi().unwrap();
|
||||
let dst = alloc_ssa_for_nir(&mut b, np.def.as_def());
|
||||
for (i, dst) in dst.iter().enumerate() {
|
||||
let phi_id = phi_map.get_phi_id(np, i.try_into().unwrap());
|
||||
phi.dsts.push(phi_id, (*dst).into());
|
||||
}
|
||||
self.set_ssa(np.def.as_def(), dst);
|
||||
} else {
|
||||
let Some(np) = ni.as_phi() else {
|
||||
break;
|
||||
};
|
||||
|
||||
if DEBUG.annotate() {
|
||||
let annotation = self
|
||||
.nir_instr_printer
|
||||
.instr_to_string(ni)
|
||||
.split_whitespace()
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
b.push_op(OpAnnotate {
|
||||
annotation: format!("generated by \"{}\"", annotation,),
|
||||
});
|
||||
}
|
||||
|
||||
let dst = alloc_ssa_for_nir(&mut b, np.def.as_def());
|
||||
for (i, dst) in dst.iter().enumerate() {
|
||||
let phi_id = phi_map.get_phi_id(np, i.try_into().unwrap());
|
||||
phi.dsts.push(phi_id, (*dst).into());
|
||||
}
|
||||
self.set_ssa(np.def.as_def(), dst);
|
||||
}
|
||||
|
||||
if !phi.dsts.is_empty() {
|
||||
|
|
@ -3125,7 +3136,7 @@ impl<'a> ShaderFromNir<'a> {
|
|||
|
||||
let mut goto = None;
|
||||
for ni in nb.iter_instr_list() {
|
||||
if DEBUG.annotate() {
|
||||
if DEBUG.annotate() && ni.type_ != nir_instr_type_phi {
|
||||
let annotation = self
|
||||
.nir_instr_printer
|
||||
.instr_to_string(ni)
|
||||
|
|
@ -3175,12 +3186,23 @@ impl<'a> ShaderFromNir<'a> {
|
|||
|
||||
let mut phi = OpPhiSrcs::new();
|
||||
|
||||
for i in sb.iter_instr_list() {
|
||||
let np = match i.as_phi() {
|
||||
Some(phi) => phi,
|
||||
None => break,
|
||||
for ni in sb.iter_instr_list() {
|
||||
let Some(np) = ni.as_phi() else {
|
||||
break;
|
||||
};
|
||||
|
||||
if DEBUG.annotate() {
|
||||
let annotation = self
|
||||
.nir_instr_printer
|
||||
.instr_to_string(ni)
|
||||
.split_whitespace()
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
b.push_op(OpAnnotate {
|
||||
annotation: format!("generated by \"{}\"", annotation,),
|
||||
});
|
||||
}
|
||||
|
||||
for ps in np.iter_srcs() {
|
||||
if ps.pred().index == nb.index {
|
||||
let src = *self.get_src(&ps.src).as_ssa().unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue