aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-01-15 07:49:36 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-01-15 07:49:36 +0000
commit4c46fc6bbf206a59b1b46d8b1af43896a4675c65 (patch)
treee7349bd7b53407d65e3d1912be4092bc28f0e280 /lib/CodeGen/SelectionDAG/CallingConvLower.cpp
parent66fac79b899904ddd82e5ee354a6d370d80230f6 (diff)
Oops. Forgot to commit this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/CallingConvLower.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/CallingConvLower.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
index 522ad7399e..337c7fda9a 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));
}