summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2016-06-22 16:56:16 +0000
committerHans Wennborg <hans@hanshq.net>2016-06-22 16:56:16 +0000
commit44d061a4714769b33e17c6099a35a61e3c62b726 (patch)
tree7773dc6d0c287f39e9afddf854ff5be755c83fb8 /clang/lib/Frontend/CompilerInvocation.cpp
parenteeec4c83648a9a296724c801e1a3fa8686270d4e (diff)
downloadbcm5719-llvm-44d061a4714769b33e17c6099a35a61e3c62b726.tar.gz
bcm5719-llvm-44d061a4714769b33e17c6099a35a61e3c62b726.zip
Add support for /Ob1 and -finline-hint-functions flags
Add support for /Ob1 (and equivalent -finline-hint-functions), which enable inlining only for functions marked inline, either explicitly (via inline keyword, for example), or implicitly (function definition in class body, for example). This works by enabling inlining pass, and adding noinline attribute to every function not marked inline. Patch by Rudy Pons <rudy.pons@ilod.org>! Differential Revision: http://reviews.llvm.org/D20647 llvm-svn: 273440
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 0836bdcc9f4..ba6f6918aa8 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -442,10 +442,15 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
// -fno-inline-functions overrides OptimizationLevel > 1.
Opts.NoInline = Args.hasArg(OPT_fno_inline);
if (Arg* InlineArg = Args.getLastArg(options::OPT_finline_functions,
+ options::OPT_finline_hint_functions,
options::OPT_fno_inline_functions)) {
- Opts.setInlining(
- InlineArg->getOption().matches(options::OPT_finline_functions) ?
- CodeGenOptions::NormalInlining : CodeGenOptions::OnlyAlwaysInlining);
+ const Option& InlineOpt = InlineArg->getOption();
+ if (InlineOpt.matches(options::OPT_finline_functions))
+ Opts.setInlining(CodeGenOptions::NormalInlining);
+ else if (InlineOpt.matches(options::OPT_finline_hint_functions))
+ Opts.setInlining(CodeGenOptions::OnlyHintInlining);
+ else
+ Opts.setInlining(CodeGenOptions::OnlyAlwaysInlining);
}
if (Arg *A = Args.getLastArg(OPT_fveclib)) {
OpenPOWER on IntegriCloud