From c9634fa9f529afbdf622a9cd96741bd09d14ef86 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Sat, 1 Aug 2026 13:55:21 +0800 Subject: [CodeGen] Add MachineFrameInfo Model stable frame indices, stack object kinds, tombstones, lifetimes, and frozen layouts. Validate owned frame references in the builder and verifier, and remap complete frame state during MachineFunction cloning. --- backend/unittests/CodeGen/MachineIRBuilderTest.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'backend/unittests/CodeGen/MachineIRBuilderTest.cpp') diff --git a/backend/unittests/CodeGen/MachineIRBuilderTest.cpp b/backend/unittests/CodeGen/MachineIRBuilderTest.cpp index bda30b6..ba5e3db 100644 --- a/backend/unittests/CodeGen/MachineIRBuilderTest.cpp +++ b/backend/unittests/CodeGen/MachineIRBuilderTest.cpp @@ -356,6 +356,16 @@ void testImplicitAndMemoryValidation(TestContext &Context) { Function->allInstructions().size() == BeforeMissingMemory, "missing required MMO must fail before instruction allocation"); + rcc::StackObjectDesc StackSlot; + StackSlot.Size = 8; + StackSlot.Align = *rcc::Alignment::create(8); + auto FrameIndex = Function->frameInfo().createObject(StackSlot); + auto ForeignFrameIndex = OtherFunction->frameInfo().createObject(StackSlot); + Context.expect(FrameIndex && ForeignFrameIndex, + "memory validation stack objects must be created"); + if (!FrameIndex || !ForeignFrameIndex) + return; + auto LoadMemory = Function->createMemOperand(memoryDescription(rcc::MemoryAccessFlag::Load)); auto StoreMemory = Function->createMemOperand(memoryDescription(rcc::MemoryAccessFlag::Store)); auto ForeignMemory = -- cgit v1.2.3