aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/MIR/EmbeddedIR.h
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-11 17:37:42 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-11 17:37:42 +0800
commit6a7b083f322f4ac47e58cbf9d4d5fd4d1f6fecd0 (patch)
treef363c502f0e2b9cda2f12928049275a433db6ad4 /backend/include/rcc/MIR/EmbeddedIR.h
parentadcf8c9b1bd1b47e00bf859693112cea1f7e8c9f (diff)
downloadrcc-project-6a7b083f322f4ac47e58cbf9d4d5fd4d1f6fecd0.tar.gz
rcc-project-6a7b083f322f4ac47e58cbf9d4d5fd4d1f6fecd0.tar.xz
[MIR] Accept fixed-baseline LLVM syntax
Diffstat (limited to 'backend/include/rcc/MIR/EmbeddedIR.h')
-rw-r--r--backend/include/rcc/MIR/EmbeddedIR.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/backend/include/rcc/MIR/EmbeddedIR.h b/backend/include/rcc/MIR/EmbeddedIR.h
index 522a217..99f1493 100644
--- a/backend/include/rcc/MIR/EmbeddedIR.h
+++ b/backend/include/rcc/MIR/EmbeddedIR.h
@@ -6,6 +6,7 @@
#include "rcc/Support/TextDiagnostic.h"
#include <cstddef>
+#include <cstdint>
#include <functional>
#include <optional>
#include <span>
@@ -52,6 +53,10 @@ public:
return IsDefinition;
}
+ [[nodiscard]] bool isUnnamed() const noexcept {
+ return IsUnnamed;
+ }
+
[[nodiscard]] std::span<const EmbeddedIRReference> blocks() const noexcept {
return Blocks;
}
@@ -80,9 +85,12 @@ private:
std::string Name;
TextRange NameRange;
bool IsDefinition = false;
+ bool IsUnnamed = false;
+ std::uint64_t NextUnnamedSlot = 0;
std::vector<EmbeddedIRReference> Blocks;
std::vector<EmbeddedIRReference> Allocas;
std::vector<EmbeddedIRReference> Values;
+ std::vector<EmbeddedIRReference> LocalReferences;
std::unordered_map<std::string, std::size_t, StringHash, std::equal_to<>> BlockNameToIndex;
std::unordered_map<std::string, std::size_t, StringHash, std::equal_to<>> AllocaNameToIndex;
std::unordered_map<std::string, std::size_t, StringHash, std::equal_to<>> ValueNameToIndex;
@@ -131,6 +139,7 @@ public:
}
[[nodiscard]] const EmbeddedIRFunction *function(std::string_view Name) const noexcept;
+ [[nodiscard]] const EmbeddedIRFunction *unnamedFunction(std::size_t Ordinal) const noexcept;
[[nodiscard]] const EmbeddedIRReference *globalObject(std::string_view Name) const noexcept;
[[nodiscard]] const EmbeddedIRMetadataDefinition *metadata(std::string_view Name) const noexcept;
[[nodiscard]] const EmbeddedIRTypeDefinition *