aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-01 18:17:33 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-01 18:17:33 +0800
commite0c77d80585428818c32886eb8c26755ea8ed159 (patch)
treef1d79404cb767c91b9aed3ad1a7709a628b3860f /backend/lib/CodeGen/MachineFunction.cpp
parent6e09614afd2a589690d107b41308f6fe6614c266 (diff)
downloadrcc-project-e0c77d80585428818c32886eb8c26755ea8ed159.tar.gz
rcc-project-e0c77d80585428818c32886eb8c26755ea8ed159.tar.xz
[CodeGen] Track debug instruction identities
Add monotonic MIR debug instruction numbers and structured value substitutions. Verify live number uniqueness, meta-instruction exclusion, substitution graph integrity, and target subregister references while preserving debug identities during cloning.
Diffstat (limited to 'backend/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--backend/lib/CodeGen/MachineFunction.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/backend/lib/CodeGen/MachineFunction.cpp b/backend/lib/CodeGen/MachineFunction.cpp
index 294158b..df1ceb5 100644
--- a/backend/lib/CodeGen/MachineFunction.cpp
+++ b/backend/lib/CodeGen/MachineFunction.cpp
@@ -10,6 +10,7 @@
#include <algorithm>
#include <cstddef>
#include <cstdint>
+#include <limits>
#include <memory>
#include <memory_resource>
#include <new>
@@ -86,6 +87,19 @@ Expected<void> MachineFunction::setTargetState(TargetFunctionState State) {
return {};
}
+Expected<std::uint32_t> MachineFunction::allocateDebugInstrNumber() {
+ if (DebugInstrNumberingCount == std::numeric_limits<std::uint32_t>::max()) {
+ return makeUnexpected(ErrorCode::InternalError,
+ "machine debug instruction number space is exhausted");
+ }
+ ++DebugInstrNumberingCount;
+ return DebugInstrNumberingCount;
+}
+
+void MachineFunction::observeDebugInstrNumber(std::uint32_t Number) noexcept {
+ DebugInstrNumberingCount = std::max(DebugInstrNumberingCount, Number);
+}
+
Expected<MachineBasicBlock *> MachineFunction::createBasicBlock() {
auto ID = BlockIDGenerator.allocate();
if (!ID)