From a69bd9a70a6ce66f80fa2ae20cc4a70d865ea451 Mon Sep 17 00:00:00 2001 From: Daniel Almeida Date: Mon, 15 Jan 2024 13:32:21 -0300 Subject: [PATCH] nak/sm50: add an annotate debug flag Add a flag so that users can enable debug annotations when printing the IR. This does nothing for now. A follow-up commit will actually implement annotations. Part-of: --- src/nouveau/compiler/nak/api.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/nouveau/compiler/nak/api.rs b/src/nouveau/compiler/nak/api.rs index 154e3af4058..865e001f47a 100644 --- a/src/nouveau/compiler/nak/api.rs +++ b/src/nouveau/compiler/nak/api.rs @@ -19,6 +19,7 @@ enum DebugFlags { Print, Serial, Spill, + Annotate, } pub struct Debug { @@ -41,6 +42,7 @@ impl Debug { "print" => flags |= 1 << DebugFlags::Print as u8, "serial" => flags |= 1 << DebugFlags::Serial as u8, "spill" => flags |= 1 << DebugFlags::Spill as u8, + "annotate" => flags |= 1 << DebugFlags::Annotate as u8, unk => eprintln!("Unknown NAK_DEBUG flag \"{}\"", unk), } } @@ -62,6 +64,10 @@ pub trait GetDebugFlags { fn spill(&self) -> bool { self.debug_flags() & (1 << DebugFlags::Spill as u8) != 0 } + + fn annotate(&self) -> bool { + self.debug_flags() & (1 << DebugFlags::Annotate as u8) != 0 + } } pub static DEBUG: OnceLock = OnceLock::new();