summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-05-20 17:12:51 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-05-20 17:12:51 +0000
commit41af7c2fdc8cc2ef186669dcb21cac58d5bd69ee (patch)
treee14576af7ea247b91481c99de20e727be5992c24 /clang/lib/CodeGen
parent650c8f2a06f138d795d0188ec8276638e13f7c9d (diff)
downloadbcm5719-llvm-41af7c2fdc8cc2ef186669dcb21cac58d5bd69ee.tar.gz
bcm5719-llvm-41af7c2fdc8cc2ef186669dcb21cac58d5bd69ee.zip
Implement the flatten attribute.
This is a GNU attribute that causes calls within the attributed function to be inlined where possible. It is implemented by giving such calls the alwaysinline attribute. Differential Revision: http://reviews.llvm.org/D3816 llvm-svn: 209217
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index e477a54c67e..31665f8851a 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2935,6 +2935,12 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
if (callOrInvoke)
*callOrInvoke = CS.getInstruction();
+ if (CurCodeDecl && CurCodeDecl->hasAttr<FlattenAttr>() &&
+ !CS.hasFnAttr(llvm::Attribute::NoInline))
+ Attrs =
+ Attrs.addAttribute(getLLVMContext(), llvm::AttributeSet::FunctionIndex,
+ llvm::Attribute::AlwaysInline);
+
CS.setAttributes(Attrs);
CS.setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv));
OpenPOWER on IntegriCloud