From a8a9d7d926202450645deae872d4d9dc11d63215 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Sun, 2 Aug 2026 03:37:46 +0800 Subject: [CodeGen] Model machine debug metadata Replace marker-based metadata operands with scoped references and inline DIExpression values. Add structured DILocation chains, instruction debug attachments, stack variable records, and entry values with unified verification, builder support, and deterministic cloning. --- backend/unittests/CodeGen/MachineFrameInfoTest.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'backend/unittests/CodeGen/MachineFrameInfoTest.cpp') diff --git a/backend/unittests/CodeGen/MachineFrameInfoTest.cpp b/backend/unittests/CodeGen/MachineFrameInfoTest.cpp index 7368815..c9289c7 100644 --- a/backend/unittests/CodeGen/MachineFrameInfoTest.cpp +++ b/backend/unittests/CodeGen/MachineFrameInfoTest.cpp @@ -2,8 +2,11 @@ #include "rcc/CodeGen/MachineFrameInfo.h" +#include "rcc/CodeGen/MachineDebugInfo.h" + #include #include +#include #include namespace { @@ -130,6 +133,22 @@ void testInvalidDescriptions(TestContext &Context) { Context.expect(!Frame.createObject(InvalidLifetime), "stack object lifetime must reject equal boundaries"); + auto InvalidDebugInfo = fixedObject(8, 8); + InvalidDebugInfo.DebugInfo.emplace(); + Context.expect(!Frame.createObject(InvalidDebugInfo), + "stack object debug information must not be structurally empty"); + + auto DebugObject = fixedObject(8, 8); + DebugObject.DebugInfo = rcc::MachineVariableDebugInfo{ + .Variable = rcc::MachineMetadataReference::embeddedIR(1), + .Expression = rcc::MachineMetadataValue::expression(rcc::MachineDIExpression{}), + .Location = std::nullopt, + }; + auto DebugIndex = Frame.createObject(DebugObject); + Context.expect(DebugIndex.has_value() && + Frame.object(*DebugIndex)->description()->DebugInfo == DebugObject.DebugInfo, + "stack object debug information must remain structured"); + Context.expect(!rcc::StackID::targetStack(4), "target stack IDs must not overlap built-in IDs"); auto TargetStack = rcc::StackID::targetStack(256); auto Target = fixedObject(8, 8); -- cgit v1.2.3