mirror of
https://github.com/intel/llvm.git
synced 2026-02-04 20:00:11 +08:00
Kill off CGCallInfo, always use CGFunctionInfo for encapsulating
function/call info. llvm-svn: 63466
This commit is contained in:
@@ -73,6 +73,16 @@ CGFunctionInfo::CGFunctionInfo(const ObjCMethodDecl *MD,
|
||||
ArgTypes.push_back((*i)->getType());
|
||||
}
|
||||
|
||||
CGFunctionInfo::CGFunctionInfo(QualType ResTy, const CallArgList &Args,
|
||||
bool _IsVariadic)
|
||||
: IsVariadic(_IsVariadic)
|
||||
{
|
||||
ArgTypes.push_back(ResTy);
|
||||
for (CallArgList::const_iterator i = Args.begin(), e = Args.end();
|
||||
i != e; ++i)
|
||||
ArgTypes.push_back(i->second);
|
||||
}
|
||||
|
||||
ArgTypeIterator CGFunctionInfo::argtypes_begin() const {
|
||||
return ArgTypes.begin();
|
||||
}
|
||||
@@ -83,22 +93,6 @@ ArgTypeIterator CGFunctionInfo::argtypes_end() const {
|
||||
|
||||
/***/
|
||||
|
||||
CGCallInfo::CGCallInfo(QualType _ResultType, const CallArgList &_Args) {
|
||||
ArgTypes.push_back(_ResultType);
|
||||
for (CallArgList::const_iterator i = _Args.begin(), e = _Args.end(); i!=e; ++i)
|
||||
ArgTypes.push_back(i->second);
|
||||
}
|
||||
|
||||
ArgTypeIterator CGCallInfo::argtypes_begin() const {
|
||||
return ArgTypes.begin();
|
||||
}
|
||||
|
||||
ArgTypeIterator CGCallInfo::argtypes_end() const {
|
||||
return ArgTypes.end();
|
||||
}
|
||||
|
||||
/***/
|
||||
|
||||
/// ABIArgInfo - Helper class to encapsulate information about how a
|
||||
/// specific C type should be passed to or returned from a function.
|
||||
class ABIArgInfo {
|
||||
@@ -878,14 +872,10 @@ CodeGenFunction::ExpandTypeToArgs(QualType Ty, RValue RV,
|
||||
|
||||
/***/
|
||||
|
||||
const llvm::FunctionType *
|
||||
CodeGenTypes::GetFunctionType(const CGCallInfo &CI, bool IsVariadic) {
|
||||
return GetFunctionType(CI.argtypes_begin(), CI.argtypes_end(), IsVariadic);
|
||||
}
|
||||
|
||||
const llvm::FunctionType *
|
||||
CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI) {
|
||||
return GetFunctionType(FI.argtypes_begin(), FI.argtypes_end(), FI.isVariadic());
|
||||
return GetFunctionType(FI.argtypes_begin(), FI.argtypes_end(),
|
||||
FI.isVariadic());
|
||||
}
|
||||
|
||||
const llvm::FunctionType *
|
||||
@@ -962,8 +952,7 @@ bool CodeGenModule::ReturnTypeUsesSret(QualType RetTy) {
|
||||
}
|
||||
|
||||
void CodeGenModule::ConstructAttributeList(const Decl *TargetDecl,
|
||||
ArgTypeIterator begin,
|
||||
ArgTypeIterator end,
|
||||
const CGFunctionInfo &Info,
|
||||
AttributeListType &PAL) {
|
||||
unsigned FuncAttrs = 0;
|
||||
unsigned RetAttrs = 0;
|
||||
@@ -979,6 +968,7 @@ void CodeGenModule::ConstructAttributeList(const Decl *TargetDecl,
|
||||
FuncAttrs |= llvm::Attribute::ReadNone;
|
||||
}
|
||||
|
||||
ArgTypeIterator begin = Info.argtypes_begin(), end = Info.argtypes_end();
|
||||
QualType RetTy = *begin;
|
||||
unsigned Index = 1;
|
||||
ABIArgInfo RetAI = getABIReturnInfo(RetTy, getTypes());
|
||||
@@ -995,8 +985,8 @@ void CodeGenModule::ConstructAttributeList(const Decl *TargetDecl,
|
||||
|
||||
case ABIArgInfo::StructRet:
|
||||
PAL.push_back(llvm::AttributeWithIndex::get(Index,
|
||||
llvm::Attribute::StructRet|
|
||||
llvm::Attribute::NoAlias));
|
||||
llvm::Attribute::StructRet |
|
||||
llvm::Attribute::NoAlias));
|
||||
++Index;
|
||||
break;
|
||||
|
||||
@@ -1294,16 +1284,15 @@ RValue CodeGenFunction::EmitCall(llvm::Value *Callee,
|
||||
}
|
||||
|
||||
llvm::CallInst *CI = Builder.CreateCall(Callee,&Args[0],&Args[0]+Args.size());
|
||||
CGCallInfo CallInfo(RetTy, CallArgs);
|
||||
bool isVariadic = cast<llvm::FunctionType>(Callee->getType())->isVarArg();
|
||||
CGFunctionInfo CallInfo(RetTy, CallArgs, isVariadic);
|
||||
|
||||
// FIXME: Provide TargetDecl so nounwind, noreturn, etc, etc get set.
|
||||
CodeGen::AttributeListType AttributeList;
|
||||
CGM.ConstructAttributeList(0,
|
||||
CallInfo.argtypes_begin(), CallInfo.argtypes_end(),
|
||||
AttributeList);
|
||||
CGM.ConstructAttributeList(0, CallInfo, AttributeList);
|
||||
CI->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(),
|
||||
AttributeList.size()));
|
||||
|
||||
AttributeList.size()));
|
||||
|
||||
if (const llvm::Function *F = dyn_cast<llvm::Function>(Callee))
|
||||
CI->setCallingConv(F->getCallingConv());
|
||||
if (CI->getType() != llvm::Type::VoidTy)
|
||||
|
||||
@@ -64,24 +64,14 @@ namespace CodeGen {
|
||||
CGFunctionInfo(const FunctionDecl *FD);
|
||||
CGFunctionInfo(const ObjCMethodDecl *MD,
|
||||
const ASTContext &Context);
|
||||
CGFunctionInfo(QualType ResTy, const CallArgList &Args,
|
||||
bool _IsVariadic);
|
||||
|
||||
bool isVariadic() const { return IsVariadic; }
|
||||
|
||||
ArgTypeIterator argtypes_begin() const;
|
||||
ArgTypeIterator argtypes_end() const;
|
||||
};
|
||||
|
||||
/// CGCallInfo - Class to encapsulate the arguments and clang types
|
||||
/// used in a call.
|
||||
class CGCallInfo {
|
||||
llvm::SmallVector<QualType, 16> ArgTypes;
|
||||
|
||||
public:
|
||||
CGCallInfo(QualType _ResultType, const CallArgList &Args);
|
||||
|
||||
ArgTypeIterator argtypes_begin() const;
|
||||
ArgTypeIterator argtypes_end() const;
|
||||
};
|
||||
} // end namespace CodeGen
|
||||
} // end namespace clang
|
||||
|
||||
|
||||
@@ -799,8 +799,8 @@ CodeGen::RValue CGObjCMac::EmitMessageSend(CodeGen::CodeGenFunction &CGF,
|
||||
ActualArgs.insert(ActualArgs.end(), CallArgs.begin(), CallArgs.end());
|
||||
|
||||
const llvm::FunctionType *FTy =
|
||||
CGM.getTypes().GetFunctionType(CGCallInfo(ResultType, ActualArgs),
|
||||
false);
|
||||
CGM.getTypes().GetFunctionType(CGFunctionInfo(ResultType, ActualArgs,
|
||||
false));
|
||||
|
||||
llvm::Constant *Fn;
|
||||
if (CGM.ReturnTypeUsesSret(ResultType)) {
|
||||
|
||||
@@ -265,8 +265,7 @@ void CodeGenModule::SetFunctionAttributes(const Decl *D,
|
||||
const CGFunctionInfo &Info,
|
||||
llvm::Function *F) {
|
||||
AttributeListType AttributeList;
|
||||
ConstructAttributeList(D, Info.argtypes_begin(), Info.argtypes_end(),
|
||||
AttributeList);
|
||||
ConstructAttributeList(D, Info, AttributeList);
|
||||
|
||||
F->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(),
|
||||
AttributeList.size()));
|
||||
|
||||
@@ -247,8 +247,7 @@ public:
|
||||
bool ReturnTypeUsesSret(QualType RetTy);
|
||||
|
||||
void ConstructAttributeList(const Decl *TargetDecl,
|
||||
const ArgTypeIterator begin,
|
||||
const ArgTypeIterator end,
|
||||
const CGFunctionInfo &Info,
|
||||
AttributeListType &PAL);
|
||||
|
||||
private:
|
||||
|
||||
@@ -145,10 +145,6 @@ public:
|
||||
|
||||
/// GetFunctionType - Get the LLVM function type from Info.
|
||||
const llvm::FunctionType *GetFunctionType(const CGFunctionInfo &Info);
|
||||
/// GetFunctionType - Get the LLVM function type from Info.
|
||||
/// \param IsVariadic Should the resulting type be variadic?
|
||||
const llvm::FunctionType *GetFunctionType(const CGCallInfo &Info,
|
||||
bool IsVariadic);
|
||||
|
||||
/// GetFunctionType - Get the LLVM function type for the given types
|
||||
/// and variadicness.
|
||||
|
||||
Reference in New Issue
Block a user