aboutsummaryrefslogtreecommitdiff
path: root/backend/unittests/CodeGen/MachineFrameInfoTest.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-02 03:37:46 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-02 03:37:46 +0800
commita8a9d7d926202450645deae872d4d9dc11d63215 (patch)
tree16a3640a93e3f567ff31045969c02a42e1f467e0 /backend/unittests/CodeGen/MachineFrameInfoTest.cpp
parent49d70380a6a95e4039f6b5e5ccce09671d5b4796 (diff)
downloadrcc-project-a8a9d7d926202450645deae872d4d9dc11d63215.tar.gz
rcc-project-a8a9d7d926202450645deae872d4d9dc11d63215.tar.xz
[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.
Diffstat (limited to 'backend/unittests/CodeGen/MachineFrameInfoTest.cpp')
-rw-r--r--backend/unittests/CodeGen/MachineFrameInfoTest.cpp19
1 files changed, 19 insertions, 0 deletions
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 <cstdint>
#include <iostream>
+#include <optional>
#include <string_view>
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);