diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-07 01:27:41 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-07 01:27:41 +0800 |
| commit | 76d89700953ddd81cf31ab8f260eddf67e93aa85 (patch) | |
| tree | c96a453164154b2d1559cea36910df52103f0f19 /backend/unittests/CodeGen/MachineJumpTableInfoTest.cpp | |
| parent | 183e2354e9fdd107be420cbb185c1d239434aa48 (diff) | |
| download | rcc-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/unittests/CodeGen/MachineJumpTableInfoTest.cpp')
| -rw-r--r-- | backend/unittests/CodeGen/MachineJumpTableInfoTest.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/backend/unittests/CodeGen/MachineJumpTableInfoTest.cpp b/backend/unittests/CodeGen/MachineJumpTableInfoTest.cpp index 0273801..106a2a6 100644 --- a/backend/unittests/CodeGen/MachineJumpTableInfoTest.cpp +++ b/backend/unittests/CodeGen/MachineJumpTableInfoTest.cpp @@ -51,7 +51,7 @@ createFunction(TestContext &Context, std::string Name, std::uint64_t ID) { [[nodiscard]] rcc::MachineJumpTableDesc tableDescription(rcc::MachineBasicBlock &First, rcc::MachineBasicBlock &Second) { rcc::MachineJumpTableDesc Description; - Description.Encoding = rcc::JumpTableEntryEncoding::RelativeToTableBase; + Description.Encoding = rcc::JumpTableEntryEncoding::GPRelative32BlockAddress; Description.EntrySize = 4; Description.Align = *rcc::Alignment::create(4); Description.Targets = {&First, &Second, &Second}; @@ -90,14 +90,15 @@ void testTableLifecycle(TestContext &Context) { Function->jumpTableInfo().table(*First) == nullptr, "erasing a jump table must leave a tombstone"); auto CompressedDescription = tableDescription(*Entry, *Exit); - CompressedDescription.Encoding = rcc::JumpTableEntryEncoding::CompressedOffset; - CompressedDescription.EntrySize = 2; + CompressedDescription.Encoding = rcc::JumpTableEntryEncoding::Custom32; + CompressedDescription.EntrySize = 4; auto Compressed = Function->jumpTableInfo().createTable(std::move(CompressedDescription)); Context.expect(Compressed && Compressed->value() == 2, "jump table tombstone indices must never be reused"); auto Updated = tableDescription(*Entry, *Exit); - Updated.Encoding = rcc::JumpTableEntryEncoding::RelativeToEntry; + Updated.Encoding = rcc::JumpTableEntryEncoding::LabelDifference64; + Updated.EntrySize = 8; Context.expect(Function->jumpTableInfo().updateTable(*Target, std::move(Updated)).has_value() && Function->jumpTableInfo().verify().has_value() && Function->jumpTableInfo().freeze().has_value() && @@ -145,7 +146,8 @@ void testInvalidTables(TestContext &Context) { "generic jump table encoding must reject target encoding IDs"); auto OversizedCompressed = tableDescription(*Block, *Block); - OversizedCompressed.Encoding = rcc::JumpTableEntryEncoding::CompressedOffset; + OversizedCompressed.Encoding = rcc::JumpTableEntryEncoding::Custom32; + OversizedCompressed.EntrySize = 8; OversizedCompressed.EntrySize = 8; Context.expect(!Function->jumpTableInfo().createTable(std::move(OversizedCompressed)), "compressed jump table must reject oversized entries"); |
