aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2015-02-13 22:22:57 +0000
committerEric Christopher <echristo@gmail.com>2015-02-13 22:22:57 +0000
commita4ae2131935725fbe80bc27cbf447f4bc1d8adbb (patch)
tree3d70dad5b67da0a1086f223dc6e7818ed177342f /llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
parent8e5ce331936f46e259acc03a81fd7d105429cc30 (diff)
downloadllvm-a4ae2131935725fbe80bc27cbf447f4bc1d8adbb.zip
llvm-a4ae2131935725fbe80bc27cbf447f4bc1d8adbb.tar.gz
llvm-a4ae2131935725fbe80bc27cbf447f4bc1d8adbb.tar.bz2
PPC LinkageSize can be computed at initialization time, do so.
llvm-svn: 229163
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCFrameLowering.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCFrameLowering.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
index d01b58f..0d6b421 100644
--- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
@@ -60,12 +60,21 @@ static unsigned computeFramePointerSaveOffset(const PPCSubtarget &STI) {
return STI.isPPC64() ? -8U : -4U;
}
+static unsigned computeLinkageSize(const PPCSubtarget &STI) {
+ if (STI.isDarwinABI() || STI.isPPC64())
+ return (STI.isELFv2ABI() ? 4 : 6) * (STI.isPPC64() ? 8 : 4);
+
+ // SVR4 ABI:
+ return 8;
+}
+
PPCFrameLowering::PPCFrameLowering(const PPCSubtarget &STI)
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown,
(STI.hasQPX() || STI.isBGQ()) ? 32 : 16, 0),
Subtarget(STI), ReturnSaveOffset(computeReturnSaveOffset(Subtarget)),
TOCSaveOffset(computeTOCSaveOffset(Subtarget)),
- FramePointerSaveOffset(computeFramePointerSaveOffset(Subtarget)) {}
+ FramePointerSaveOffset(computeFramePointerSaveOffset(Subtarget)),
+ LinkageSize(computeLinkageSize(Subtarget)) {}
// With the SVR4 ABI, callee-saved registers have fixed offsets on the stack.
const PPCFrameLowering::SpillSlot *PPCFrameLowering::getCalleeSavedSpillSlots(
@@ -441,9 +450,7 @@ unsigned PPCFrameLowering::determineFrameLayout(MachineFunction &MF,
unsigned maxCallFrameSize = MFI->getMaxCallFrameSize();
// Maximum call frame needs to be at least big enough for linkage area.
- unsigned minCallFrameSize = getLinkageSize(Subtarget.isPPC64(),
- Subtarget.isDarwinABI(),
- Subtarget.isELFv2ABI());
+ unsigned minCallFrameSize = getLinkageSize();
maxCallFrameSize = std::max(maxCallFrameSize, minCallFrameSize);
// If we have dynamic alloca then maxCallFrameSize needs to be aligned so