mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 16:00:08 +01:00
nak: impl fmt::Debug for SSAValue
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38807>
This commit is contained in:
parent
9f830f622f
commit
f48fcfe552
1 changed files with 18 additions and 0 deletions
|
|
@ -67,6 +67,12 @@ impl fmt::Display for SSAValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for SSAValue {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
fmt::Display::fmt(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Eq, Hash, PartialEq)]
|
#[derive(Clone, Eq, Hash, PartialEq)]
|
||||||
struct SSAValueArray<const SIZE: usize> {
|
struct SSAValueArray<const SIZE: usize> {
|
||||||
v: [SSAValue; SIZE],
|
v: [SSAValue; SIZE],
|
||||||
|
|
@ -343,3 +349,15 @@ impl SSAValueAllocator {
|
||||||
SSARef::from_iter((0..comps).map(|_| self.alloc(file)))
|
SSARef::from_iter((0..comps).map(|_| self.alloc(file)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_ssa_value_print() {
|
||||||
|
let ssa = SSAValue::new(RegFile::UPred, 42);
|
||||||
|
assert_eq!(format!("{}", ssa), "%up42");
|
||||||
|
assert_eq!(format!("{:?}", ssa), "%up42");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue