diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGBlocks.cpp | 19 | ||||
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 29 | ||||
-rw-r--r-- | lib/CodeGen/CGCall.h | 7 | ||||
-rw-r--r-- | lib/CodeGen/CGClass.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 5 | ||||
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 7 | ||||
-rw-r--r-- | lib/CodeGen/CGObjCGNU.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 16 | ||||
-rw-r--r-- | lib/CodeGen/CGVtable.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenTypes.h | 11 |
11 files changed, 55 insertions, 57 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index c10a401d8a..9217859ef1 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -192,7 +192,7 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) { CallArgList Args; CodeGenTypes &Types = CGM.getTypes(); const CGFunctionInfo &FnInfo = Types.getFunctionInfo(ResultType, Args, - CC_Default, false); + FunctionType::ExtInfo()); if (CGM.ReturnTypeUsesSret(FnInfo)) flags |= BLOCK_USE_STRET; } @@ -472,8 +472,8 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E, QualType ResultType = FuncTy->getResultType(); const CGFunctionInfo &FnInfo = - CGM.getTypes().getFunctionInfo(ResultType, Args, FuncTy->getCallConv(), - FuncTy->getNoReturnAttr()); + CGM.getTypes().getFunctionInfo(ResultType, Args, + FuncTy->getExtInfo()); // Cast the function pointer to the right type. const llvm::Type *BlockFTy = @@ -678,8 +678,7 @@ CodeGenFunction::GenerateBlockFunction(const BlockExpr *BExpr, const FunctionType *BlockFunctionType = BExpr->getFunctionType(); QualType ResultType; - CallingConv CC = BlockFunctionType->getCallConv(); - bool NoReturn = BlockFunctionType->getNoReturnAttr(); + FunctionType::ExtInfo EInfo = getFunctionExtInfo(*BlockFunctionType); bool IsVariadic; if (const FunctionProtoType *FTy = dyn_cast<FunctionProtoType>(BlockFunctionType)) { @@ -718,7 +717,7 @@ CodeGenFunction::GenerateBlockFunction(const BlockExpr *BExpr, Args.push_back(std::make_pair(*i, (*i)->getType())); const CGFunctionInfo &FI = - CGM.getTypes().getFunctionInfo(ResultType, Args, CC, NoReturn); + CGM.getTypes().getFunctionInfo(ResultType, Args, EInfo); CodeGenTypes &Types = CGM.getTypes(); const llvm::FunctionType *LTy = Types.GetFunctionType(FI, IsVariadic); @@ -843,7 +842,7 @@ GenerateCopyHelperFunction(bool BlockHasCopyDispose, const llvm::StructType *T, Args.push_back(std::make_pair(Src, Src->getType())); const CGFunctionInfo &FI = - CGM.getTypes().getFunctionInfo(R, Args, CC_Default, false); + CGM.getTypes().getFunctionInfo(R, Args, FunctionType::ExtInfo()); // FIXME: We'd like to put these into a mergable by content, with // internal linkage. @@ -924,7 +923,7 @@ GenerateDestroyHelperFunction(bool BlockHasCopyDispose, Args.push_back(std::make_pair(Src, Src->getType())); const CGFunctionInfo &FI = - CGM.getTypes().getFunctionInfo(R, Args, CC_Default, false); + CGM.getTypes().getFunctionInfo(R, Args, FunctionType::ExtInfo()); // FIXME: We'd like to put these into a mergable by content, with // internal linkage. @@ -1008,7 +1007,7 @@ GeneratebyrefCopyHelperFunction(const llvm::Type *T, int flag) { Args.push_back(std::make_pair(Src, Src->getType())); const CGFunctionInfo &FI = - CGM.getTypes().getFunctionInfo(R, Args, CC_Default, false); + CGM.getTypes().getFunctionInfo(R, Args, FunctionType::ExtInfo()); CodeGenTypes &Types = CGM.getTypes(); const llvm::FunctionType *LTy = Types.GetFunctionType(FI, false); @@ -1071,7 +1070,7 @@ BlockFunction::GeneratebyrefDestroyHelperFunction(const llvm::Type *T, Args.push_back(std::make_pair(Src, Src->getType())); const CGFunctionInfo &FI = - CGM.getTypes().getFunctionInfo(R, Args, CC_Default, false); + CGM.getTypes().getFunctionInfo(R, Args, FunctionType::ExtInfo()); CodeGenTypes &Types = CGM.getTypes(); const llvm::FunctionType *LTy = Types.GetFunctionType(FI, false); diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index dcd0beab10..d861348ce8 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -67,8 +67,7 @@ const CGFunctionInfo & CodeGenTypes::getFunctionInfo(CanQual<FunctionNoProtoType> FTNP) { return getFunctionInfo(FTNP->getResultType().getUnqualifiedType(), llvm::SmallVector<CanQualType, 16>(), - FTNP->getCallConv(), - FTNP->getNoReturnAttr()); + FTNP->getExtInfo()); } /// \param Args - contains any initial parameters besides those @@ -81,8 +80,7 @@ static const CGFunctionInfo &getFunctionInfo(CodeGenTypes &CGT, ArgTys.push_back(FTP->getArgType(i)); CanQualType ResTy = FTP->getResultType().getUnqualifiedType(); return CGT.getFunctionInfo(ResTy, ArgTys, - FTP->getCallConv(), - FTP->getNoReturnAttr()); + FTP->getExtInfo()); } const CGFunctionInfo & @@ -175,8 +173,9 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const ObjCMethodDecl *MD) { } return getFunctionInfo(GetReturnType(MD->getResultType()), ArgTys, - getCallingConventionForDecl(MD), - /*NoReturn*/ false); + FunctionType::ExtInfo( + /*NoReturn*/ false, + getCallingConventionForDecl(MD))); } const CGFunctionInfo &CodeGenTypes::getFunctionInfo(GlobalDecl GD) { @@ -194,32 +193,32 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(GlobalDecl GD) { const CGFunctionInfo &CodeGenTypes::getFunctionInfo(QualType ResTy, const CallArgList &Args, - CallingConv CC, - bool NoReturn) { + const FunctionType::ExtInfo &Info) { // FIXME: Kill copy. llvm::SmallVector<CanQualType, 16> ArgTys; for (CallArgList::const_iterator i = Args.begin(), e = Args.end(); i != e; ++i) ArgTys.push_back(Context.getCanonicalParamType(i->second)); - return getFunctionInfo(GetReturnType(ResTy), ArgTys, CC, NoReturn); + return getFunctionInfo(GetReturnType(ResTy), ArgTys, Info); } const CGFunctionInfo &CodeGenTypes::getFunctionInfo(QualType ResTy, const FunctionArgList &Args, - CallingConv CC, - bool NoReturn) { + const FunctionType::ExtInfo &Info) { // FIXME: Kill copy. llvm::SmallVector<CanQualType, 16> ArgTys; for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end(); i != e; ++i) ArgTys.push_back(Context.getCanonicalParamType(i->second)); - return getFunctionInfo(GetReturnType(ResTy), ArgTys, CC, NoReturn); + return getFunctionInfo(GetReturnType(ResTy), ArgTys, Info); } const CGFunctionInfo &CodeGenTypes::getFunctionInfo(CanQualType ResTy, const llvm::SmallVectorImpl<CanQualType> &ArgTys, - CallingConv CallConv, - bool NoReturn) { + const FunctionType::ExtInfo &Info) { + const CallingConv CallConv = Info.getCC(); + const bool NoReturn = Info.getNoReturn(); + #ifndef NDEBUG for (llvm::SmallVectorImpl<CanQualType>::const_iterator I = ArgTys.begin(), E = ArgTys.end(); I != E; ++I) @@ -230,7 +229,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(CanQualType ResTy, // Lookup or create unique function info. llvm::FoldingSetNodeID ID; - CGFunctionInfo::Profile(ID, CC, NoReturn, ResTy, + CGFunctionInfo::Profile(ID, Info, ResTy, ArgTys.begin(), ArgTys.end()); void *InsertPos = 0; diff --git a/lib/CodeGen/CGCall.h b/lib/CodeGen/CGCall.h index 3d81165b1b..235ff9c674 100644 --- a/lib/CodeGen/CGCall.h +++ b/lib/CodeGen/CGCall.h @@ -122,13 +122,12 @@ namespace CodeGen { } template<class Iterator> static void Profile(llvm::FoldingSetNodeID &ID, - unsigned CallingConvention, - bool NoReturn, + const FunctionType::ExtInfo &Info, CanQualType ResTy, Iterator begin, Iterator end) { - ID.AddInteger(CallingConvention); - ID.AddBoolean(NoReturn); + ID.AddInteger(Info.getCC()); + ID.AddBoolean(Info.getNoReturn()); ResTy.Profile(ID); for (; begin != end; ++begin) { CanQualType T = *begin; // force iterator to be over canonical types diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index e702c5e783..177e862304 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -1379,7 +1379,7 @@ CodeGenFunction::GenerateCXXAggrDestructorHelper(const CXXDestructorDecl *D, llvm::raw_svector_ostream(Name) << "__tcf_" << (++UniqueAggrDestructorCount); QualType R = getContext().VoidTy; const CGFunctionInfo &FI - = CGM.getTypes().getFunctionInfo(R, Args, CC_Default, false); + = CGM.getTypes().getFunctionInfo(R, Args, FunctionType::ExtInfo()); const llvm::FunctionType *FTy = CGM.getTypes().GetFunctionType(FI, false); llvm::Function *Fn = llvm::Function::Create(FTy, llvm::GlobalValue::InternalLinkage, diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 28b1d3b501..d9585c9c6d 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -44,9 +44,8 @@ RValue CodeGenFunction::EmitCXXMemberCall(const CXXMethodDecl *MD, QualType ResultType = FPT->getResultType(); return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args, - FPT->getCallConv(), - FPT->getNoReturnAttr()), Callee, - ReturnValue, Args, MD); + FPT->getExtInfo()), + Callee, ReturnValue, Args, MD); } /// canDevirtualizeMemberFunctionCalls - Checks whether virtual calls on given diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index d2b7a242e8..9eaf57c445 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -191,7 +191,7 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP, // FIXME: We shouldn't need to get the function info here, the // runtime already should have computed it to build the function. RValue RV = EmitCall(Types.getFunctionInfo(PD->getType(), Args, - CC_Default, false), + FunctionType::ExtInfo()), GetPropertyFn, ReturnValueSlot(), Args); // We need to fix the type here. Ivars with copy & retain are // always objects so we don't need to worry about complex or @@ -285,7 +285,8 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP, // FIXME: We shouldn't need to get the function info here, the runtime // already should have computed it to build the function. EmitCall(Types.getFunctionInfo(getContext().VoidTy, Args, - CC_Default, false), SetPropertyFn, + FunctionType::ExtInfo()), + SetPropertyFn, ReturnValueSlot(), Args); } else { // FIXME: Find a clean way to avoid AST node creation. @@ -561,7 +562,7 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){ // FIXME: We shouldn't need to get the function info here, the runtime already // should have computed it to build the function. EmitCall(CGM.getTypes().getFunctionInfo(getContext().VoidTy, Args2, - CC_Default, false), + FunctionType::ExtInfo()), EnumerationMutationFn, ReturnValueSlot(), Args2); EmitBlock(WasNotMutated); diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 119819b810..d4452000dc 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -465,7 +465,7 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, CodeGenTypes &Types = CGM.getTypes(); const CGFunctionInfo &FnInfo = Types.getFunctionInfo(ResultType, ActualArgs, - CC_Default, false); + FunctionType::ExtInfo()); const llvm::FunctionType *impType = Types.GetFunctionType(FnInfo, Method ? Method->isVariadic() : false); @@ -573,7 +573,7 @@ CGObjCGNU::GenerateMessageSend(CodeGen::CodeGenFunction &CGF, CodeGenTypes &Types = CGM.getTypes(); const CGFunctionInfo &FnInfo = Types.getFunctionInfo(ResultType, ActualArgs, - CC_Default, false); + FunctionType::ExtInfo()); const llvm::FunctionType *impType = Types.GetFunctionType(FnInfo, Method ? Method->isVariadic() : false); @@ -1694,7 +1694,7 @@ llvm::Constant *CGObjCGNU::EnumerationMutationFunction() { Params.push_back(ASTIdTy); const llvm::FunctionType *FTy = Types.GetFunctionType(Types.getFunctionInfo(Ctx.VoidTy, Params, - CC_Default, false), false); + FunctionType::ExtInfo()), false); return CGM.CreateRuntimeFunction(FTy, "objc_enumerationMutation"); } diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 475280b6a0..1ed41d005f 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -306,7 +306,8 @@ public: Params.push_back(Ctx.BoolTy); const llvm::FunctionType *FTy = Types.GetFunctionType(Types.getFunctionInfo(IdType, Params, - CC_Default, false), false); + FunctionType::ExtInfo()), + false); return CGM.CreateRuntimeFunction(FTy, "objc_getProperty"); } @@ -325,7 +326,8 @@ public: Params.push_back(Ctx.BoolTy); const llvm::FunctionType *FTy = Types.GetFunctionType(Types.getFunctionInfo(Ctx.VoidTy, Params, - CC_Default, false), false); + FunctionType::ExtInfo()), + false); return CGM.CreateRuntimeFunction(FTy, "objc_setProperty"); } @@ -337,7 +339,8 @@ public: Params.push_back(Ctx.getCanonicalParamType(Ctx.getObjCIdType())); const llvm::FunctionType *FTy = Types.GetFunctionType(Types.getFunctionInfo(Ctx.VoidTy, Params, - CC_Default, false), false); + FunctionType::ExtInfo()), + false); return CGM.CreateRuntimeFunction(FTy, "objc_enumerationMutation"); } @@ -1559,7 +1562,7 @@ CGObjCCommonMac::EmitLegacyMessageSend(CodeGen::CodeGenFunction &CGF, CodeGenTypes &Types = CGM.getTypes(); const CGFunctionInfo &FnInfo = Types.getFunctionInfo(ResultType, ActualArgs, - CC_Default, false); + FunctionType::ExtInfo()); const llvm::FunctionType *FTy = Types.GetFunctionType(FnInfo, Method ? Method->isVariadic() : false); @@ -5094,7 +5097,8 @@ CodeGen::RValue CGObjCNonFragileABIMac::EmitMessageSend( // FIXME. This is too much work to get the ABI-specific result type needed to // find the message name. const CGFunctionInfo &FnInfo - = Types.getFunctionInfo(ResultType, CallArgList(), CC_Default, false); + = Types.getFunctionInfo(ResultType, CallArgList(), + FunctionType::ExtInfo()); llvm::Constant *Fn = 0; std::string Name("\01l_"); if (CGM.ReturnTypeUsesSret(FnInfo)) { @@ -5169,7 +5173,7 @@ CodeGen::RValue CGObjCNonFragileABIMac::EmitMessageSend( ObjCTypes.MessageRefCPtrTy)); ActualArgs.insert(ActualArgs.end(), CallArgs.begin(), CallArgs.end()); const CGFunctionInfo &FnInfo1 = Types.getFunctionInfo(ResultType, ActualArgs, - CC_Default, false); + FunctionType::ExtInfo()); llvm::Value *Callee = CGF.Builder.CreateStructGEP(Arg1, 0); Callee = CGF.Builder.CreateLoad(Callee); const llvm::FunctionType *FTy = Types.GetFunctionType(FnInfo1, true); diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index bae588ab9b..2d1c73440b 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -2669,8 +2669,8 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn, GlobalDecl GD, llvm::Value *Callee = CGM.GetAddrOfFunction(GD, Ty); const CGFunctionInfo &FnInfo = - CGM.getTypes().getFunctionInfo(ResultType, CallArgs, FPT->getCallConv(), - FPT->getNoReturnAttr()); + CGM.getTypes().getFunctionInfo(ResultType, CallArgs, + FPT->getExtInfo()); // Now emit our call. RValue RV = EmitCall(FnInfo, Callee, ReturnValueSlot(), CallArgs, MD); diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index ba5aaf685b..b863aff236 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -199,8 +199,8 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, QualType FnType = getContext().getFunctionType(RetTy, 0, 0, false, 0, false, false, 0, 0, - /*FIXME?*/false, - /*FIXME?*/CC_Default); + /*FIXME?*/ + FunctionType::ExtInfo()); // Emit subprogram debug descriptor. if (CGDebugInfo *DI = getDebugInfo()) { @@ -211,7 +211,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, // FIXME: Leaked. // CC info is ignored, hopefully? CurFnInfo = &CGM.getTypes().getFunctionInfo(FnRetTy, Args, - CC_Default, false); + FunctionType::ExtInfo()); if (RetTy->isVoidType()) { // Void type; nothing to return. diff --git a/lib/CodeGen/CodeGenTypes.h b/lib/CodeGen/CodeGenTypes.h index b2912efb34..173c4ad378 100644 --- a/lib/CodeGen/CodeGenTypes.h +++ b/lib/CodeGen/CodeGenTypes.h @@ -202,7 +202,7 @@ public: const CGFunctionInfo &getFunctionInfo(const CallArgList &Args, const FunctionType *Ty) { return getFunctionInfo(Ty->getResultType(), Args, - Ty->getCallConv(), Ty->getNoReturnAttr()); + Ty->getExtInfo()); } const CGFunctionInfo &getFunctionInfo(CanQual<FunctionProtoType> Ty); const CGFunctionInfo &getFunctionInfo(CanQual<FunctionNoProtoType> Ty); @@ -216,20 +216,17 @@ public: /// specified, the "C" calling convention will be used. const CGFunctionInfo &getFunctionInfo(QualType ResTy, const CallArgList &Args, - CallingConv CC, - bool NoReturn); + const FunctionType::ExtInfo &Info); const CGFunctionInfo &getFunctionInfo(QualType ResTy, const FunctionArgList &Args, - CallingConv CC, - bool NoReturn); + const FunctionType::ExtInfo &Info); /// Retrieves the ABI information for the given function signature. /// /// \param ArgTys - must all actually be canonical as params const CGFunctionInfo &getFunctionInfo(CanQualType RetTy, const llvm::SmallVectorImpl<CanQualType> &ArgTys, - CallingConv CC, - bool NoReturn); + const FunctionType::ExtInfo &Info); public: // These are internal details of CGT that shouldn't be used externally. /// addFieldInfo - Assign field number to field FD. |