aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-02-22 20:53:29 +0000
committerBill Wendling <isanbard@gmail.com>2013-02-22 20:53:29 +0000
commit93e4bff1a30d2ac37461943599efd59f04a5c00f (patch)
tree80a6003df9991b3e8a9bd00e93b68e32b04173a1
parent80190399f5a062db72127869978699af65951b73 (diff)
Make sure we apply attributes to correct places.
Some attributes make sense only on the function or on the call site, but not both. Make this distinction here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175918 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGCall.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index f2c2d0a85d..fe0088dc0b 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -1021,21 +1021,25 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
if (CodeGenOpts.NoImplicitFloat)
FuncAttrs.addAttribute(llvm::Attribute::NoImplicitFloat);
- if (!TargetOpts.CPU.empty())
- FuncAttrs.addAttribute("target-cpu", TargetOpts.CPU);
-
- if (TargetOpts.Features.size()) {
- llvm::SubtargetFeatures Features;
- for (std::vector<std::string>::const_iterator
- it = TargetOpts.Features.begin(),
- ie = TargetOpts.Features.end(); it != ie; ++it)
- Features.AddFeature(*it);
- FuncAttrs.addAttribute("target-features", Features.getString());
+ if (AttrOnCallSite) {
+ // Attributes that should go on the call site only.
+ if (!CodeGenOpts.SimplifyLibCalls)
+ FuncAttrs.addAttribute(llvm::Attribute::NoBuiltin);
+ } else {
+ // Attributes that should go on the function, but not the call site.
+ if (!TargetOpts.CPU.empty())
+ FuncAttrs.addAttribute("target-cpu", TargetOpts.CPU);
+
+ if (TargetOpts.Features.size()) {
+ llvm::SubtargetFeatures Features;
+ for (std::vector<std::string>::const_iterator
+ it = TargetOpts.Features.begin(),
+ ie = TargetOpts.Features.end(); it != ie; ++it)
+ Features.AddFeature(*it);
+ 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();