summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2017-07-13 17:03:12 +0000
committerMartin Storsjo <martin@martin.st>2017-07-13 17:03:12 +0000
commit68266faa31acd20bede070d4a64de090bd55c953 (patch)
treeeb9bb2869b08898128f9a82c8e4d0e7fff00cc49 /llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
parent8c0317da023510a221ec8291083cf3dd2ce3b1b5 (diff)
downloadbcm5719-llvm-68266faa31acd20bede070d4a64de090bd55c953.tar.gz
bcm5719-llvm-68266faa31acd20bede070d4a64de090bd55c953.zip
[AArch64] Implement support for windows style vararg functions
Pass parameters properly in calls to such functions (pass all floats in integer registers), and handle va_start properly (allocate stack immediately below the arguments on the stack, to save the register arguments into a single continuous array). Differential Revision: https://reviews.llvm.org/D35006 llvm-svn: 307928
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64FrameLowering.cpp')
-rw-r--r--llvm/lib/Target/AArch64/AArch64FrameLowering.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
index e96ee7d29b3..2436c4eb76f 100644
--- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -41,6 +41,10 @@
// | |
// |-----------------------------------|
// | |
+// | (Win64 only) varargs from reg |
+// | |
+// |-----------------------------------|
+// | |
// | prev_fp, prev_lr |
// | (a.k.a. "frame record") |
// |-----------------------------------| <- fp(=x29)
@@ -950,7 +954,12 @@ static void computeCalleeSaveRegisterPairs(
CC == CallingConv::PreserveMost ||
(Count & 1) == 0) &&
"Odd number of callee-saved regs to spill!");
- unsigned Offset = AFI->getCalleeSavedStackSize();
+ int Offset = AFI->getCalleeSavedStackSize();
+
+ unsigned GPRSaveSize = AFI->getVarArgsGPRSize();
+ const AArch64Subtarget &Subtarget = MF.getSubtarget<AArch64Subtarget>();
+ if (Subtarget.isTargetWindows())
+ Offset -= alignTo(GPRSaveSize, 16);
for (unsigned i = 0; i < Count; ++i) {
RegPairInfo RPI;
OpenPOWER on IntegriCloud