[llvm] [AVR] Support stack realignment (PR #187129)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 06:39:44 PDT 2026


================
@@ -222,6 +213,32 @@ void AVRFrameLowering::emitEpilogue(MachineFunction &MF,
   restoreStatusRegister(MF, MBB);
 }
 
+StackOffset AVRFrameLowering::getFrameIndexReference(const MachineFunction &MF,
+                                                     int FI,
+                                                     Register &FrameReg) const {
+  int64_t Offset;
+  const MachineFrameInfo &MFI = MF.getFrameInfo();
+
+  switch (MFI.getStackID(FI)) {
+  case TargetStackID::Default:
+    Offset = MFI.getObjectOffset(FI) + MFI.getOffsetAdjustment() +
+             MFI.getStackSize() - getOffsetOfLocalArea() + 1;
+
+    assert(Offset > 0);
+    break;
+
+  case TargetStackID::AvrAlign:
+    Offset = MFI.getObjectOffset(FI);
----------------
arsenm wrote:

This looks like an abuse of what the stack ID is for. If it's not being placed in a separate memory space, this is the wrong solution. This looks like it's just skipping ordinary adjustments which can be handled directly 

https://github.com/llvm/llvm-project/pull/187129


More information about the llvm-commits mailing list