From f48fcfe55280a6ff2672588581d44711cb840cc4 Mon Sep 17 00:00:00 2001 From: Mel Henning Date: Fri, 5 Dec 2025 15:17:52 -0500 Subject: [PATCH] nak: impl fmt::Debug for SSAValue Part-of: --- src/nouveau/compiler/nak/ssa_value.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/nouveau/compiler/nak/ssa_value.rs b/src/nouveau/compiler/nak/ssa_value.rs index c01191234fa..6f055aa3943 100644 --- a/src/nouveau/compiler/nak/ssa_value.rs +++ b/src/nouveau/compiler/nak/ssa_value.rs @@ -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)] struct SSAValueArray { v: [SSAValue; SIZE], @@ -343,3 +349,15 @@ impl SSAValueAllocator { 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"); + } +}