mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
PR15868 fix.
Introduction: In case when stack alignment is 8 and GPRs parameter part size is not N*8: we add padding to GPRs part, so part's last byte must be recovered at address K*8-1. We need to do it, since remained (stack) part of parameter starts from address K*8, and we need to "attach" "GPRs head" without gaps to it: Stack: |---- 8 bytes block ----| |---- 8 bytes block ----| |---- 8 bytes... [ [padding] [GPRs head] ] [ ------ Tail passed via stack ------ ... FIX: Note, once we added padding we need to correct *all* Arg offsets that are going after padded one. That's why we need this fix: Arg offsets were never corrected before this patch. See new test-cases included in patch. We also don't need to insert padding for byval parameters that are stored in GPRs only. We need pad only last byval parameter and only in case it outsides GPRs and stack alignment = 8. Though, stack area, allocated for recovered byval params, must satisfy "Size mod 8 = 0" restriction. This patch reduces stack usage for some cases: We can reduce ArgRegsSaveArea since inner N*4 bytes sized byval params my be "packed" with alignment 4 in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182237 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -141,7 +141,8 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
assert(!AFI->isThumb1OnlyFunction() &&
|
||||
"This emitPrologue does not support Thumb1!");
|
||||
bool isARM = !AFI->isThumbFunction();
|
||||
unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize();
|
||||
unsigned Align = MF.getTarget().getFrameLowering()->getStackAlignment();
|
||||
unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize(Align);
|
||||
unsigned NumBytes = MFI->getStackSize();
|
||||
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
|
||||
DebugLoc dl = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
|
||||
@@ -357,7 +358,8 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF,
|
||||
"This emitEpilogue does not support Thumb1!");
|
||||
bool isARM = !AFI->isThumbFunction();
|
||||
|
||||
unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize();
|
||||
unsigned Align = MF.getTarget().getFrameLowering()->getStackAlignment();
|
||||
unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize(Align);
|
||||
int NumBytes = (int)MFI->getStackSize();
|
||||
unsigned FramePtr = RegInfo->getFrameRegister(MF);
|
||||
|
||||
|
Reference in New Issue
Block a user