From: Evan Cheng Date: Tue, 15 Jan 2008 07:49:36 +0000 (+0000) Subject: Oops. Forgot to commit this. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4c46fc6bbf206a59b1b46d8b1af43896a4675c65;p=oota-llvm.git Oops. Forgot to commit this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46002 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp index 522ad7399e2..337c7fda9ab 100644 --- a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp +++ b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp @@ -29,15 +29,22 @@ CCState::CCState(unsigned CC, bool isVarArg, const TargetMachine &tm, UsedRegs.resize(MRI.getNumRegs()); } -void CCState::HandleStruct(unsigned ValNo, MVT::ValueType ValVT, - MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo, - unsigned ArgFlags) { - unsigned MinAlign = TM.getTargetData()->getPointerABIAlignment(); +// HandleByVal - Allocate a stack slot large enough to pass an argument by +// value. The size and alignment information of the argument is encoded in its +// parameter attribute. +void CCState::HandleByVal(unsigned ValNo, MVT::ValueType ValVT, + MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo, + int MinSize, int MinAlign, + unsigned ArgFlags) { unsigned Align = 1 << ((ArgFlags & ISD::ParamFlags::ByValAlign) >> ISD::ParamFlags::ByValAlignOffs); unsigned Size = (ArgFlags & ISD::ParamFlags::ByValSize) >> ISD::ParamFlags::ByValSizeOffs; - unsigned Offset = AllocateStack(Size, std::max(MinAlign, Align)); + if (MinSize > (int)Size) + Size = MinSize; + if (MinAlign > (int)Align) + Align = MinAlign; + unsigned Offset = AllocateStack(Size, Align); addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo)); }