Simplify some CodeGenTypes::arrangeXXX functions. No functionality change

llvm-svn: 215606
This commit is contained in:
Alexey Samsonov 2014-08-13 23:55:54 +00:00
parent 8fc67fba01
commit e5ef3ca932
1 changed files with 10 additions and 28 deletions

View File

@ -85,37 +85,18 @@ CodeGenTypes::arrangeFreeFunctionType(CanQual<FunctionNoProtoType> FTNP) {
} }
/// Arrange the LLVM function layout for a value of the given function /// Arrange the LLVM function layout for a value of the given function
/// type, on top of any implicit parameters already stored. Use the /// type, on top of any implicit parameters already stored.
/// given ExtInfo instead of the ExtInfo from the function type. static const CGFunctionInfo &
static const CGFunctionInfo &arrangeLLVMFunctionInfo(CodeGenTypes &CGT, arrangeLLVMFunctionInfo(CodeGenTypes &CGT, bool IsInstanceMethod,
bool IsInstanceMethod, SmallVectorImpl<CanQualType> &prefix,
SmallVectorImpl<CanQualType> &prefix, CanQual<FunctionProtoType> FTP) {
CanQual<FunctionProtoType> FTP,
FunctionType::ExtInfo extInfo) {
RequiredArgs required = RequiredArgs::forPrototypePlus(FTP, prefix.size()); RequiredArgs required = RequiredArgs::forPrototypePlus(FTP, prefix.size());
// FIXME: Kill copy. // FIXME: Kill copy.
for (unsigned i = 0, e = FTP->getNumParams(); i != e; ++i) for (unsigned i = 0, e = FTP->getNumParams(); i != e; ++i)
prefix.push_back(FTP->getParamType(i)); prefix.push_back(FTP->getParamType(i));
CanQualType resultType = FTP->getReturnType().getUnqualifiedType(); CanQualType resultType = FTP->getReturnType().getUnqualifiedType();
return CGT.arrangeLLVMFunctionInfo(resultType, IsInstanceMethod, prefix, return CGT.arrangeLLVMFunctionInfo(resultType, IsInstanceMethod, prefix,
extInfo, required); FTP->getExtInfo(), required);
}
/// Arrange the argument and result information for a free function (i.e.
/// not a C++ or ObjC instance method) of the given type.
static const CGFunctionInfo &arrangeFreeFunctionType(CodeGenTypes &CGT,
SmallVectorImpl<CanQualType> &prefix,
CanQual<FunctionProtoType> FTP) {
return arrangeLLVMFunctionInfo(CGT, false, prefix, FTP, FTP->getExtInfo());
}
/// Arrange the argument and result information for a free function (i.e.
/// not a C++ or ObjC instance method) of the given type.
static const CGFunctionInfo &arrangeCXXMethodType(CodeGenTypes &CGT,
SmallVectorImpl<CanQualType> &prefix,
CanQual<FunctionProtoType> FTP) {
FunctionType::ExtInfo extInfo = FTP->getExtInfo();
return arrangeLLVMFunctionInfo(CGT, true, prefix, FTP, extInfo);
} }
/// Arrange the argument and result information for a value of the /// Arrange the argument and result information for a value of the
@ -123,7 +104,7 @@ static const CGFunctionInfo &arrangeCXXMethodType(CodeGenTypes &CGT,
const CGFunctionInfo & const CGFunctionInfo &
CodeGenTypes::arrangeFreeFunctionType(CanQual<FunctionProtoType> FTP) { CodeGenTypes::arrangeFreeFunctionType(CanQual<FunctionProtoType> FTP) {
SmallVector<CanQualType, 16> argTypes; SmallVector<CanQualType, 16> argTypes;
return ::arrangeFreeFunctionType(*this, argTypes, FTP); return ::arrangeLLVMFunctionInfo(*this, false, argTypes, FTP);
} }
static CallingConv getCallingConventionForDecl(const Decl *D, bool IsWindows) { static CallingConv getCallingConventionForDecl(const Decl *D, bool IsWindows) {
@ -192,8 +173,9 @@ CodeGenTypes::arrangeCXXMethodType(const CXXRecordDecl *RD,
else else
argTypes.push_back(Context.VoidPtrTy); argTypes.push_back(Context.VoidPtrTy);
return ::arrangeCXXMethodType(*this, argTypes, return ::arrangeLLVMFunctionInfo(
FTP->getCanonicalTypeUnqualified().getAs<FunctionProtoType>()); *this, true, argTypes,
FTP->getCanonicalTypeUnqualified().getAs<FunctionProtoType>());
} }
/// Arrange the argument and result information for a declaration or /// Arrange the argument and result information for a declaration or