From 76d89700953ddd81cf31ab8f260eddf67e93aa85 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Fri, 7 Aug 2026 01:27:41 +0800 Subject: [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. --- backend/include/rcc/CodeGen/MachineJumpTableInfo.h | 26 +++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'backend/include/rcc/CodeGen/MachineJumpTableInfo.h') diff --git a/backend/include/rcc/CodeGen/MachineJumpTableInfo.h b/backend/include/rcc/CodeGen/MachineJumpTableInfo.h index 6342281..b22ea50 100644 --- a/backend/include/rcc/CodeGen/MachineJumpTableInfo.h +++ b/backend/include/rcc/CodeGen/MachineJumpTableInfo.h @@ -21,10 +21,13 @@ class MachineBasicBlock; class MachineFunction; enum class JumpTableEntryEncoding : std::uint8_t { - AbsoluteAddress, - RelativeToTableBase, - RelativeToEntry, - CompressedOffset, + BlockAddress, + GPRelative64BlockAddress, + GPRelative32BlockAddress, + LabelDifference32, + LabelDifference64, + Inline, + Custom32, Target, Count, }; @@ -39,7 +42,7 @@ struct JumpTablePlacement final { }; struct MachineJumpTableDesc final { - JumpTableEntryEncoding Encoding = JumpTableEntryEncoding::AbsoluteAddress; + JumpTableEntryEncoding Encoding = JumpTableEntryEncoding::BlockAddress; std::uint8_t EntrySize = 8; Alignment Align; std::vector Targets; @@ -60,16 +63,24 @@ public: return std::holds_alternative(Description); } + [[nodiscard]] bool isPending() const noexcept { + return std::holds_alternative(Description); + } + [[nodiscard]] const MachineJumpTableDesc *description() const noexcept { return std::get_if(&Description); } private: + struct PendingDescription final {}; + MachineJumpTableEntry(JumpTableIndex Index, MachineJumpTableDesc Description) : Index(Index), Description(std::move(Description)) {} + explicit MachineJumpTableEntry(JumpTableIndex Index) + : Index(Index), Description(PendingDescription{}) {} JumpTableIndex Index; - std::variant Description; + std::variant Description; friend class MachineJumpTableInfo; }; @@ -85,6 +96,9 @@ public: ~MachineJumpTableInfo() = default; [[nodiscard]] Expected createTable(MachineJumpTableDesc Description); + [[nodiscard]] Expected reserveTable(); + [[nodiscard]] Expected defineReservedTable(JumpTableIndex Index, + MachineJumpTableDesc Description); [[nodiscard]] Expected updateTable(JumpTableIndex Index, MachineJumpTableDesc Description); [[nodiscard]] Expected eraseTable(JumpTableIndex Index); -- cgit v1.2.3