summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-07-16 14:16:26 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-07-16 14:16:26 +0000
commitb950f1961b8ffe20c4c54423241ce1f699ccfe3f (patch)
tree6eaba79fedbcef91ab4e9eb7edbbcbdc3f25c6cc /llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp
parent091872cb375b46d96cc3fc76aff56244cd5a680e (diff)
downloadbcm5719-llvm-b950f1961b8ffe20c4c54423241ce1f699ccfe3f.tar.gz
bcm5719-llvm-b950f1961b8ffe20c4c54423241ce1f699ccfe3f.zip
Another attempt to fix prologue emission
llvm-svn: 76007
Diffstat (limited to 'llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp')
-rw-r--r--llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp b/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp
index deceb35284a..dfd5336a204 100644
--- a/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp
@@ -143,10 +143,10 @@ SystemZRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
// if yes - mark it as 'callee' saved.
MachineFrameInfo *FFI = MF.getFrameInfo();
- if (FFI->hasCalls()
- /* FIXME: function is varargs */
- /* FIXME: function grabs RA */
- /* FIXME: function calls eh_return */)
+ if (FFI->hasCalls())
+ /* FIXME: function is varargs */
+ /* FIXME: function grabs RA */
+ /* FIXME: function calls eh_return */
MF.getRegInfo().setPhysRegUsed(SystemZ::R14D);
if (FFI->hasCalls() ||
@@ -193,9 +193,10 @@ void SystemZRegisterInfo::emitPrologue(MachineFunction &MF) const {
// Get the number of bytes to allocate from the FrameInfo.
// Note that area for callee-saved stuff is already allocated, thus we need to
// 'undo' the stack movement.
- uint64_t StackSize = MFI->getStackSize();
- uint64_t NumBytes = StackSize - SystemZMFI->getCalleeSavedFrameSize();
- NumBytes -= TFI.getOffsetOfLocalArea();
+ uint64_t StackSize = MFI->getStackSize();
+ StackSize -= SystemZMFI->getCalleeSavedFrameSize();
+
+ uint64_t NumBytes = StackSize - TFI.getOffsetOfLocalArea();
// Skip the callee-saved push instructions.
while (MBBI != MBB.end() &&
@@ -207,8 +208,11 @@ void SystemZRegisterInfo::emitPrologue(MachineFunction &MF) const {
DL = MBBI->getDebugLoc();
// adjust stack pointer: R15 -= numbytes
- if (StackSize)
+ if (StackSize || MFI->hasCalls()) {
+ assert(MF.getRegInfo().isPhysRegUsed(SystemZ::R15D) &&
+ "Invalid stack frame calculation!");
emitSPUpdate(MBB, MBBI, -(int64_t)NumBytes, TII);
+ }
if (hasFP(MF)) {
// Update R11 with the new base value...
OpenPOWER on IntegriCloud