aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/MIR/MIParser.h
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-07 01:27:41 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-07 01:27:41 +0800
commit76d89700953ddd81cf31ab8f260eddf67e93aa85 (patch)
treec96a453164154b2d1559cea36910df52103f0f19 /backend/include/rcc/MIR/MIParser.h
parent183e2354e9fdd107be420cbb185c1d239434aa48 (diff)
downloadrcc-project-76d89700953ddd81cf31ab8f260eddf67e93aa85.tar.gz
rcc-project-76d89700953ddd81cf31ab8f260eddf67e93aa85.tar.xz
[MIR] Complete document parsing and printing
Implement the single LLVM-compatible MIR document path with structured\nembedded-IR references, YAML mappings, constants, and deterministic printing.\n\nKeep pointer LLT widths DataLayout-derived, reject layout-dependent output\nwhen embedded IR is omitted, and record the fixed-baseline compatibility\ncontract and regression coverage.
Diffstat (limited to 'backend/include/rcc/MIR/MIParser.h')
-rw-r--r--backend/include/rcc/MIR/MIParser.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/backend/include/rcc/MIR/MIParser.h b/backend/include/rcc/MIR/MIParser.h
index 978e928..116a97f 100644
--- a/backend/include/rcc/MIR/MIParser.h
+++ b/backend/include/rcc/MIR/MIParser.h
@@ -5,15 +5,18 @@
#include "rcc/CodeGen/MachineIRTypes.h"
#include "rcc/CodeGen/MachineMetadata.h"
+#include "rcc/CodeGen/Register.h"
#include "rcc/Support/Error.h"
#include "rcc/Support/TextDiagnostic.h"
#include <cstddef>
#include <cstdint>
+#include <functional>
#include <memory>
#include <optional>
#include <span>
#include <string>
+#include <string_view>
#include <vector>
namespace rcc {
@@ -23,6 +26,11 @@ class TargetDescription;
namespace mir {
+struct MIVirtualRegisterSlot final {
+ std::uint32_t TextID = 0;
+ Register Reg;
+};
+
struct MIFrameObjectSlot final {
std::uint32_t TextID = 0;
FrameIndex Index;
@@ -50,12 +58,15 @@ struct MISyncScopeSlot final {
};
struct MIParserContext final {
+ std::vector<MIVirtualRegisterSlot> VirtualRegisters;
std::vector<MIFrameObjectSlot> StackObjects;
std::vector<MIFrameObjectSlot> FixedStackObjects;
std::vector<MIConstantPoolSlot> ConstantPoolItems;
std::vector<MIJumpTableSlot> JumpTables;
std::vector<MIMetadataSlot> Metadata;
std::vector<MISyncScopeSlot> SyncScopes;
+ std::function<Expected<SyncScopeID>(std::string_view)> InternSyncScope;
+ std::function<Expected<std::uint32_t>(std::uint32_t)> PointerSizeInBits;
std::uint32_t DefaultPointerSizeInBits = 0;
};
@@ -66,6 +77,7 @@ struct MIParserOptions final {
std::size_t MaximumInstructions = std::size_t{1} << 24U;
std::size_t MaximumOperandsPerInstruction = std::size_t{1} << 20U;
std::size_t MaximumMemoryOperandsPerInstruction = std::size_t{1} << 20U;
+ bool VerifyAfterParse = true;
};
class MIParser final {