diff options
Diffstat (limited to 'include/llvm/CodeGen/CallingConvLower.h')
| -rw-r--r-- | include/llvm/CodeGen/CallingConvLower.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/CallingConvLower.h b/include/llvm/CodeGen/CallingConvLower.h index 415abb90da576..92e58564e0408 100644 --- a/include/llvm/CodeGen/CallingConvLower.h +++ b/include/llvm/CodeGen/CallingConvLower.h @@ -195,6 +195,7 @@ class CCState { private: CallingConv::ID CallingConv; bool IsVarArg; + bool AnalyzingMustTailForwardedRegs = false; MachineFunction &MF; const TargetRegisterInfo &TRI; SmallVectorImpl<CCValAssign> &Locs; @@ -281,7 +282,7 @@ public: /// be able to store all arguments and such that the alignment requirement /// of each of the arguments is satisfied. unsigned getAlignedCallFrameSize() const { - return RoundUpToAlignment(StackOffset, MaxStackArgAlign); + return alignTo(StackOffset, MaxStackArgAlign); } /// isAllocated - Return true if the specified register (or an alias) is @@ -412,14 +413,19 @@ public: /// and alignment. unsigned AllocateStack(unsigned Size, unsigned Align) { assert(Align && ((Align - 1) & Align) == 0); // Align is power of 2. - StackOffset = RoundUpToAlignment(StackOffset, Align); + StackOffset = alignTo(StackOffset, Align); unsigned Result = StackOffset; StackOffset += Size; MaxStackArgAlign = std::max(Align, MaxStackArgAlign); - MF.getFrameInfo()->ensureMaxAlignment(Align); + ensureMaxAlignment(Align); return Result; } + void ensureMaxAlignment(unsigned Align) { + if (!AnalyzingMustTailForwardedRegs) + MF.getFrameInfo()->ensureMaxAlignment(Align); + } + /// Version of AllocateStack with extra register to be shadowed. unsigned AllocateStack(unsigned Size, unsigned Align, unsigned ShadowReg) { MarkAllocated(ShadowReg); @@ -507,6 +513,14 @@ public: SmallVectorImpl<ForwardedRegister> &Forwards, ArrayRef<MVT> RegParmTypes, CCAssignFn Fn); + /// Returns true if the results of the two calling conventions are compatible. + /// This is usually part of the check for tailcall eligibility. + static bool resultsCompatible(CallingConv::ID CalleeCC, + CallingConv::ID CallerCC, MachineFunction &MF, + LLVMContext &C, + const SmallVectorImpl<ISD::InputArg> &Ins, + CCAssignFn CalleeFn, CCAssignFn CallerFn); + private: /// MarkAllocated - Mark a register and all of its aliases as allocated. void MarkAllocated(unsigned Reg); |
