diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2014-05-20 17:12:51 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2014-05-20 17:12:51 +0000 |
| commit | 41af7c2fdc8cc2ef186669dcb21cac58d5bd69ee (patch) | |
| tree | e14576af7ea247b91481c99de20e727be5992c24 /clang/lib/CodeGen | |
| parent | 650c8f2a06f138d795d0188ec8276638e13f7c9d (diff) | |
| download | bcm5719-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.cpp | 6 |
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)); |

