aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-01-15 03:14:05 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-01-15 03:14:05 +0000
commitc67e6e8e8203be62da647832842edd7d90c4c585 (patch)
tree787d346f1d860304ccb308c737ddbe99ed5a9f15 /lib/CodeGen/SelectionDAG/CallingConvLower.cpp
parent5daafa9b1b5279ba6a5032a4a841abb20b4023ef (diff)
ByVal stack slot alignment should be at least as large as pointer ABI alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45995 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/CallingConvLower.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/CallingConvLower.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
index b8bc484e3b..522ad7399e 100644
--- a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
+++ b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
@@ -15,6 +15,7 @@
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/Target/MRegisterInfo.h"
+#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
@@ -31,11 +32,12 @@ CCState::CCState(unsigned CC, bool isVarArg, const TargetMachine &tm,
void CCState::HandleStruct(unsigned ValNo, MVT::ValueType ValVT,
MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,
unsigned ArgFlags) {
+ unsigned MinAlign = TM.getTargetData()->getPointerABIAlignment();
unsigned Align = 1 << ((ArgFlags & ISD::ParamFlags::ByValAlign) >>
ISD::ParamFlags::ByValAlignOffs);
unsigned Size = (ArgFlags & ISD::ParamFlags::ByValSize) >>
ISD::ParamFlags::ByValSizeOffs;
- unsigned Offset = AllocateStack(Size, Align);
+ unsigned Offset = AllocateStack(Size, std::max(MinAlign, Align));
addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
}