summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCFrameInfo.h
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-11-16 22:43:37 +0000
committerJim Laskey <jlaskey@mac.com>2006-11-16 22:43:37 +0000
commit2f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173 (patch)
tree345098bfe09f8de197e21e72161fcb04533d2259 /lib/Target/PowerPC/PPCFrameInfo.h
parent1b0a2d8370b28de0d3998b0303bc3dad983989d9 (diff)
downloadllvm-2f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173.tar.gz
llvm-2f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173.tar.bz2
llvm-2f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173.tar.xz
This is a general clean up of the PowerPC ABI. Address several problems and
bugs including making sure that the TOS links back to the previous frame, that the maximum call frame size is not included twice when using frame pointers, no longer growing the frame on calls, double storing of SP and a cleaner/faster dynamic alloca. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31792 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCFrameInfo.h')
-rw-r--r--lib/Target/PowerPC/PPCFrameInfo.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCFrameInfo.h b/lib/Target/PowerPC/PPCFrameInfo.h
index 40305be78e..ed67496e55 100644
--- a/lib/Target/PowerPC/PPCFrameInfo.h
+++ b/lib/Target/PowerPC/PPCFrameInfo.h
@@ -35,6 +35,40 @@ public:
NumEntries = 1;
return &LR[0];
}
+
+ /// getFramePointerSaveOffset - Return the previous frame offset to save the
+ /// frame pointer.
+ static unsigned getFramePointerSaveOffset(bool LP64) {
+ // Use the TOC save slot in the PowerPC linkage area for saving the frame
+ // pointer (if needed.) LLVM does not generate code that uses the TOC (R2
+ // is treated as a caller saved register.)
+ return LP64 ? 40 : 20;
+ }
+
+ /// getLinkageSize - Return the size of the PowerPC ABI linkage area.
+ ///
+ static unsigned getLinkageSize(bool LP64) {
+ return 6 * (LP64 ? 8 : 4);
+ }
+
+ /// getMinCallArgumentsSize - Return the size of the minium PowerPC ABI
+ /// argument area.
+ static unsigned getMinCallArgumentsSize(bool LP64) {
+ // The prolog code of the callee may store up to 8 GPR argument registers to
+ // the stack, allowing va_start to index over them in memory if its varargs.
+ // Because we cannot tell if this is needed on the caller side, we have to
+ // conservatively assume that it is needed. As such, make sure we have at
+ // least enough stack space for the caller to store the 8 GPRs.
+ return 8 * (LP64 ? 8 : 4);
+ }
+
+ /// getMinCallFrameSize - Return the minimum size a call frame can be using
+ /// the PowerPC ABI.
+ static unsigned getMinCallFrameSize(bool LP64) {
+ // The call frame needs to be at least big enough for linkage and 8 args.
+ return getLinkageSize(LP64) + getMinCallArgumentsSize(LP64);
+ }
+
};
} // End llvm namespace