mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-10 22:46:25 +00:00
Make the location a parameter since we may not want the next one
in the block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165050 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
96bd4418b2
commit
2d4d0f0ee8
@ -146,7 +146,8 @@ static
|
|||||||
void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
|
void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
|
||||||
unsigned StackPtr, int64_t NumBytes,
|
unsigned StackPtr, int64_t NumBytes,
|
||||||
bool Is64Bit, bool UseLEA,
|
bool Is64Bit, bool UseLEA,
|
||||||
const TargetInstrInfo &TII, const TargetRegisterInfo &TRI) {
|
const TargetInstrInfo &TII, const TargetRegisterInfo &TRI,
|
||||||
|
DebugLoc DL) {
|
||||||
bool isSub = NumBytes < 0;
|
bool isSub = NumBytes < 0;
|
||||||
uint64_t Offset = isSub ? -NumBytes : NumBytes;
|
uint64_t Offset = isSub ? -NumBytes : NumBytes;
|
||||||
unsigned Opc;
|
unsigned Opc;
|
||||||
@ -158,7 +159,6 @@ void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
|
|||||||
: getADDriOpcode(Is64Bit, Offset);
|
: getADDriOpcode(Is64Bit, Offset);
|
||||||
|
|
||||||
uint64_t Chunk = (1LL << 31) - 1;
|
uint64_t Chunk = (1LL << 31) - 1;
|
||||||
DebugLoc DL = MBB.findDebugLoc(MBBI);
|
|
||||||
|
|
||||||
while (Offset) {
|
while (Offset) {
|
||||||
uint64_t ThisVal = (Offset > Chunk) ? Chunk : Offset;
|
uint64_t ThisVal = (Offset > Chunk) ? Chunk : Offset;
|
||||||
@ -912,7 +912,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
|
|||||||
// FIXME: %rax preserves the offset and should be available.
|
// FIXME: %rax preserves the offset and should be available.
|
||||||
if (isSPUpdateNeeded)
|
if (isSPUpdateNeeded)
|
||||||
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit,
|
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit,
|
||||||
UseLEA, TII, *RegInfo);
|
UseLEA, TII, *RegInfo, MBB.findDebugLoc(MBBI));
|
||||||
|
|
||||||
if (isEAXAlive) {
|
if (isEAXAlive) {
|
||||||
// Restore EAX
|
// Restore EAX
|
||||||
@ -924,7 +924,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
|
|||||||
}
|
}
|
||||||
} else if (NumBytes)
|
} else if (NumBytes)
|
||||||
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit,
|
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit,
|
||||||
UseLEA, TII, *RegInfo);
|
UseLEA, TII, *RegInfo, MBB.findDebugLoc(MBBI));
|
||||||
|
|
||||||
// If we need a base pointer, set it up here. It's whatever the value
|
// If we need a base pointer, set it up here. It's whatever the value
|
||||||
// of the stack pointer is at this point. Any variable size objects
|
// of the stack pointer is at this point. Any variable size objects
|
||||||
@ -1075,7 +1075,8 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
|
|||||||
}
|
}
|
||||||
} else if (NumBytes) {
|
} else if (NumBytes) {
|
||||||
// Adjust stack pointer back: ESP += numbytes.
|
// Adjust stack pointer back: ESP += numbytes.
|
||||||
emitSPUpdate(MBB, MBBI, StackPtr, NumBytes, Is64Bit, UseLEA, TII, *RegInfo);
|
emitSPUpdate(MBB, MBBI, StackPtr, NumBytes, Is64Bit, UseLEA, TII,
|
||||||
|
*RegInfo, MBB.findDebugLoc(MBBI));
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're returning from function via eh_return.
|
// We're returning from function via eh_return.
|
||||||
@ -1110,7 +1111,8 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
|
|||||||
if (Offset) {
|
if (Offset) {
|
||||||
// Check for possible merge with preceding ADD instruction.
|
// Check for possible merge with preceding ADD instruction.
|
||||||
Offset += mergeSPUpdates(MBB, MBBI, StackPtr, true);
|
Offset += mergeSPUpdates(MBB, MBBI, StackPtr, true);
|
||||||
emitSPUpdate(MBB, MBBI, StackPtr, Offset, Is64Bit, UseLEA, TII, *RegInfo);
|
emitSPUpdate(MBB, MBBI, StackPtr, Offset, Is64Bit, UseLEA, TII,
|
||||||
|
*RegInfo, MBB.findDebugLoc(MBBI));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Jump to label or value in register.
|
// Jump to label or value in register.
|
||||||
@ -1153,7 +1155,8 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
|
|||||||
|
|
||||||
// Check for possible merge with preceding ADD instruction.
|
// Check for possible merge with preceding ADD instruction.
|
||||||
delta += mergeSPUpdates(MBB, MBBI, StackPtr, true);
|
delta += mergeSPUpdates(MBB, MBBI, StackPtr, true);
|
||||||
emitSPUpdate(MBB, MBBI, StackPtr, delta, Is64Bit, UseLEA, TII, *RegInfo);
|
emitSPUpdate(MBB, MBBI, StackPtr, delta, Is64Bit, UseLEA, TII,
|
||||||
|
*RegInfo, MBB.findDebugLoc(MBBI));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user