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/include/rcc/CodeGen/MachineFunctionRecords.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'backend/include/rcc/CodeGen/MachineFunctionRecords.h') diff --git a/backend/include/rcc/CodeGen/MachineFunctionRecords.h b/backend/include/rcc/CodeGen/MachineFunctionRecords.h index 7929ed3..b792494 100644 --- a/backend/include/rcc/CodeGen/MachineFunctionRecords.h +++ b/backend/include/rcc/CodeGen/MachineFunctionRecords.h @@ -4,6 +4,7 @@ #define RCC_CODEGEN_MACHINEFUNCTIONRECORDS_H #include "rcc/CodeGen/MachineBasicBlockAttributes.h" +#include "rcc/CodeGen/MachineDebugInfo.h" #include "rcc/CodeGen/Register.h" #include "rcc/CodeGen/StableID.h" #include "rcc/Support/Error.h" @@ -37,6 +38,14 @@ struct MachineDebugValueSubstitution final { MachineDebugValueSubstitution Right) noexcept = default; }; +struct MachineEntryValueInfo final { + PhysicalRegister Reg; + MachineVariableDebugInfo DebugInfo; + + friend bool operator==(const MachineEntryValueInfo &Left, + const MachineEntryValueInfo &Right) = default; +}; + struct MachineCallSiteArgument final { PhysicalRegister Reg; std::uint16_t ArgumentNumber = 0; @@ -122,6 +131,12 @@ public: [[nodiscard]] Expected addDebugValueSubstitution(MachineDebugValueSubstitution Substitution); + [[nodiscard]] std::span entryValues() const noexcept { + return EntryValues; + } + + [[nodiscard]] Expected addEntryValue(MachineEntryValueInfo EntryValue); + [[nodiscard]] Expected verify() const; [[nodiscard]] Expected clone(const MachineFunctionCloneContext &CloneContext) const; @@ -135,6 +150,7 @@ private: std::vector CalledGlobals; std::vector PrefetchTargets; std::vector DebugValueSubstitutions; + std::vector EntryValues; }; } // namespace rcc -- cgit v1.2.3