mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Fixed stack frame addressing bug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41160 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6d32ca0762
commit
055c7eb4a4
@ -271,15 +271,15 @@ emitPrologue(MachineFunction &MF) const
|
|||||||
MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
|
MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
|
||||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||||
|
|
||||||
// Get the number of bytes to allocate from the FrameInfo
|
// Get the number of bytes to allocate from the FrameInfo.
|
||||||
int NumBytes = (int) MFI->getStackSize();
|
int NumBytes = (int) MFI->getStackSize();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
DOUT << "\n<--- EMIT PROLOGUE --->";
|
DOUT << "\n<--- EMIT PROLOGUE --->\n";
|
||||||
DOUT << "Stack size :" << NumBytes << "\n";
|
DOUT << "Stack size :" << NumBytes << "\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Do we need to allocate space on the stack?
|
// Don't need to allocate space on the stack.
|
||||||
if (NumBytes == 0) return;
|
if (NumBytes == 0) return;
|
||||||
|
|
||||||
int FPOffset, RAOffset;
|
int FPOffset, RAOffset;
|
||||||
@ -289,13 +289,13 @@ emitPrologue(MachineFunction &MF) const
|
|||||||
// using FP, the last stack slot becomes empty
|
// using FP, the last stack slot becomes empty
|
||||||
// and RA is saved before it.
|
// and RA is saved before it.
|
||||||
if ((hasFP(MF)) && (MFI->hasCalls())) {
|
if ((hasFP(MF)) && (MFI->hasCalls())) {
|
||||||
FPOffset = NumBytes;
|
FPOffset = NumBytes+4;
|
||||||
RAOffset = (NumBytes+4);
|
RAOffset = (NumBytes+8);
|
||||||
} else if ((!hasFP(MF)) && (MFI->hasCalls())) {
|
} else if ((!hasFP(MF)) && (MFI->hasCalls())) {
|
||||||
FPOffset = 0;
|
FPOffset = 0;
|
||||||
RAOffset = NumBytes;
|
RAOffset = NumBytes+4;
|
||||||
} else if ((hasFP(MF)) && (!MFI->hasCalls())) {
|
} else if ((hasFP(MF)) && (!MFI->hasCalls())) {
|
||||||
FPOffset = NumBytes;
|
FPOffset = NumBytes+4;
|
||||||
RAOffset = 0;
|
RAOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ emitPrologue(MachineFunction &MF) const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Align stack.
|
// Align stack.
|
||||||
NumBytes += 8;
|
NumBytes += 12;
|
||||||
unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
|
unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
|
||||||
NumBytes = ((NumBytes+Align-1)/Align*Align);
|
NumBytes = ((NumBytes+Align-1)/Align*Align);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user