summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-02-09 00:10:00 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-02-09 00:10:00 +0000
commit819e54b65cd755fcb3cf3a8b8f94f1c9d3db0c2e (patch)
treea9592eca25446d5ff460f04e9867f81e9bca2526 /clang/lib/CodeGen/CodeGenFunction.cpp
parenta460edca798ecdd80facec0bb074865bbd16e06e (diff)
downloadbcm5719-llvm-819e54b65cd755fcb3cf3a8b8f94f1c9d3db0c2e.tar.gz
bcm5719-llvm-819e54b65cd755fcb3cf3a8b8f94f1c9d3db0c2e.zip
Pass inline keyword to optimizer as the new InlineHint function attribute.
At the moment the inlinehint attribute is ignored by the Inliner unless you pass a -respect-inlinehint option. This will soon be the default. The inlinehint attribute is set if the inline keyword is explicitly specified on any declaration. llvm-svn: 95623
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 4eeea8eea79..5a4f94e3e09 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -171,6 +171,16 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
CurFn = Fn;
assert(CurFn->isDeclaration() && "Function already has body?");
+ // Pass inline keyword to optimizer if it appears explicitly on any
+ // declaration.
+ if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D))
+ for (FunctionDecl::redecl_iterator RI = FD->redecls_begin(),
+ RE = FD->redecls_end(); RI != RE; ++RI)
+ if (RI->isInlineSpecified()) {
+ Fn->addFnAttr(llvm::Attribute::InlineHint);
+ break;
+ }
+
llvm::BasicBlock *EntryBB = createBasicBlock("entry", CurFn);
// Create a marker to make it easy to insert allocas into the entryblock
OpenPOWER on IntegriCloud