summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/Backend.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-02 22:07:45 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-02 22:07:45 +0000
commit4b665ebb014d6f4187f80ad6f92da14cad84e0f9 (patch)
tree9535634344d7e9706b1ab1f7942695171383ee4e /clang/lib/Frontend/Backend.cpp
parent136bd719f0711b7c08ea2b1cfe699c6f77026f73 (diff)
downloadbcm5719-llvm-4b665ebb014d6f4187f80ad6f92da14cad84e0f9.tar.gz
bcm5719-llvm-4b665ebb014d6f4187f80ad6f92da14cad84e0f9.zip
Add clang-cc support for -disable-llvm-optzns.
- Avoids running any LLVM optimizations, even at -O2, etc., while still keeping any language changes these optimizations imply. llvm-svn: 72742
Diffstat (limited to 'clang/lib/Frontend/Backend.cpp')
-rw-r--r--clang/lib/Frontend/Backend.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/clang/lib/Frontend/Backend.cpp b/clang/lib/Frontend/Backend.cpp
index 44aa3a81a96..697ba941af2 100644
--- a/clang/lib/Frontend/Backend.cpp
+++ b/clang/lib/Frontend/Backend.cpp
@@ -294,10 +294,16 @@ void BackendConsumer::CreatePasses() {
PM->add(createPruneEHPass()); // Remove dead EH info
PM->add(createFunctionAttrsPass()); // Set readonly/readnone attrs
}
- if (CompileOpts.InlineFunctions)
+ switch (CompileOpts.Inlining) {
+ case CompileOptions::NoInlining:
+ break;
+ case CompileOptions::NormalInlining:
PM->add(createFunctionInliningPass()); // Inline small functions
- else
+ break;
+ case CompileOptions::OnlyAlwaysInlining:
PM->add(createAlwaysInlinerPass()); // Respect always_inline
+ break;
+ }
if (CompileOpts.OptimizationLevel > 2)
PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args
if (CompileOpts.SimplifyLibCalls)
@@ -341,7 +347,16 @@ void BackendConsumer::CreatePasses() {
if (CompileOpts.OptimizationLevel > 1 && CompileOpts.UnitAtATime)
PM->add(createConstantMergePass()); // Merge dup global constants
} else {
- PM->add(createAlwaysInlinerPass());
+ switch (CompileOpts.Inlining) {
+ case CompileOptions::NoInlining:
+ break;
+ case CompileOptions::NormalInlining:
+ PM->add(createFunctionInliningPass()); // Inline small functions
+ break;
+ case CompileOptions::OnlyAlwaysInlining:
+ PM->add(createAlwaysInlinerPass()); // Respect always_inline
+ break;
+ }
}
}
OpenPOWER on IntegriCloud