summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/CallingConvLower.cpp
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2019-08-05 09:49:09 +0000
committerGuillaume Chatelet <gchatelet@google.com>2019-08-05 09:49:09 +0000
commit6c5fb61f8bcc4323a5f128a748e12bfc51b185a4 (patch)
tree67c8203d60f71b6426e2b8cd56814f520da48254 /llvm/lib/CodeGen/CallingConvLower.cpp
parente204786b6cc968bfe725b21241c00228d1159e75 (diff)
downloadbcm5719-llvm-6c5fb61f8bcc4323a5f128a748e12bfc51b185a4.tar.gz
bcm5719-llvm-6c5fb61f8bcc4323a5f128a748e12bfc51b185a4.zip
[LLVM][Alignment] Introduce Alignment In CallingConv
Summary: This is patch is part of a serie to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Subscribers: hiraditya, llvm-commits, courbet, jfb Tags: #llvm Differential Revision: https://reviews.llvm.org/D65659 llvm-svn: 367822
Diffstat (limited to 'llvm/lib/CodeGen/CallingConvLower.cpp')
-rw-r--r--llvm/lib/CodeGen/CallingConvLower.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/CallingConvLower.cpp b/llvm/lib/CodeGen/CallingConvLower.cpp
index 497fcb14784..92da621fabb 100644
--- a/llvm/lib/CodeGen/CallingConvLower.cpp
+++ b/llvm/lib/CodeGen/CallingConvLower.cpp
@@ -32,7 +32,6 @@ CCState::CCState(CallingConv::ID CC, bool isVarArg, MachineFunction &mf,
TRI(*MF.getSubtarget().getRegisterInfo()), Locs(locs), Context(C) {
// No stack is used.
StackOffset = 0;
- MaxStackArgAlign = 1;
clearByValRegsInfo();
UsedRegs.resize((TRI.getNumRegs()+31)/32);
@@ -41,20 +40,20 @@ CCState::CCState(CallingConv::ID CC, bool isVarArg, MachineFunction &mf,
/// Allocate space on the stack 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 ValVT,
- MVT LocVT, CCValAssign::LocInfo LocInfo,
- int MinSize, int MinAlign,
- ISD::ArgFlagsTy ArgFlags) {
- unsigned Align = ArgFlags.getByValAlign();
+void CCState::HandleByVal(unsigned ValNo, MVT ValVT, MVT LocVT,
+ CCValAssign::LocInfo LocInfo, int MinSize,
+ int MinAlignment, ISD::ArgFlagsTy ArgFlags) {
+ llvm::Align MinAlign(MinAlignment);
+ llvm::Align Align(ArgFlags.getByValAlign());
unsigned Size = ArgFlags.getByValSize();
if (MinSize > (int)Size)
Size = MinSize;
- if (MinAlign > (int)Align)
+ if (MinAlign > Align)
Align = MinAlign;
ensureMaxAlignment(Align);
- MF.getSubtarget().getTargetLowering()->HandleByVal(this, Size, Align);
+ MF.getSubtarget().getTargetLowering()->HandleByVal(this, Size, Align.value());
Size = unsigned(alignTo(Size, MinAlign));
- unsigned Offset = AllocateStack(Size, Align);
+ unsigned Offset = AllocateStack(Size, Align.value());
addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
}
@@ -209,7 +208,7 @@ static bool isValueTypeInRegForCC(CallingConv::ID CC, MVT VT) {
void CCState::getRemainingRegParmsForType(SmallVectorImpl<MCPhysReg> &Regs,
MVT VT, CCAssignFn Fn) {
unsigned SavedStackOffset = StackOffset;
- unsigned SavedMaxStackArgAlign = MaxStackArgAlign;
+ llvm::Align SavedMaxStackArgAlign = MaxStackArgAlign;
unsigned NumLocs = Locs.size();
// Set the 'inreg' flag if it is used for this calling convention.
OpenPOWER on IntegriCloud