diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-02-22 00:13:35 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-02-22 00:13:35 +0000 |
commit | f4d64cb3a53109f3e207b6650fac96a6f83548bf (patch) | |
tree | 68e87a99d600467e5b2f7a59e36914228f32ed4b /clang/lib/CodeGen | |
parent | 09bd1f71eeb2558f4e4516740328b9d5e9177500 (diff) | |
download | bcm5719-llvm-f4d64cb3a53109f3e207b6650fac96a6f83548bf.tar.gz bcm5719-llvm-f4d64cb3a53109f3e207b6650fac96a6f83548bf.zip |
Apply the 'nobuiltin' attribute to call sites when the user specifies `-fno-builtin' on the command line.
llvm-svn: 175836
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 11 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 3 |
3 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 6072f601359..9fd31fe253f 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -969,7 +969,8 @@ llvm::Type *CodeGenTypes::GetFunctionTypeForVTable(GlobalDecl GD) { void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, const Decl *TargetDecl, AttributeListType &PAL, - unsigned &CallingConv) { + unsigned &CallingConv, + bool AttrOnCallSite) { llvm::AttrBuilder FuncAttrs; llvm::AttrBuilder RetAttrs; @@ -1028,6 +1029,9 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, FuncAttrs.addAttribute("target-features", Features.getString()); } + if (AttrOnCallSite && !CodeGenOpts.SimplifyLibCalls) + FuncAttrs.addAttribute(llvm::Attribute::NoBuiltin); + QualType RetTy = FI.getReturnType(); unsigned Index = 1; const ABIArgInfo &RetAI = FI.getReturnInfo(); @@ -2238,9 +2242,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, unsigned CallingConv; CodeGen::AttributeListType AttributeList; - CGM.ConstructAttributeList(CallInfo, TargetDecl, AttributeList, CallingConv); + CGM.ConstructAttributeList(CallInfo, TargetDecl, AttributeList, + CallingConv, true); llvm::AttributeSet Attrs = llvm::AttributeSet::get(getLLVMContext(), - AttributeList); + AttributeList); llvm::BasicBlock *InvokeDest = 0; if (!Attrs.hasAttribute(llvm::AttributeSet::FunctionIndex, diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 5033b56d3a7..60ec3232031 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -550,7 +550,7 @@ void CodeGenModule::SetLLVMFunctionAttributes(const Decl *D, llvm::Function *F) { unsigned CallingConv; AttributeListType AttributeList; - ConstructAttributeList(Info, D, AttributeList, CallingConv); + ConstructAttributeList(Info, D, AttributeList, CallingConv, false); F->setAttributes(llvm::AttributeSet::get(getLLVMContext(), AttributeList)); F->setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv)); } diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index f467ee79d49..bf9dc255d63 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -839,7 +839,8 @@ public: void ConstructAttributeList(const CGFunctionInfo &Info, const Decl *TargetDecl, AttributeListType &PAL, - unsigned &CallingConv); + unsigned &CallingConv, + bool AttrOnCallSite); StringRef getMangledName(GlobalDecl GD); void getBlockMangledName(GlobalDecl GD, MangleBuffer &Buffer, |