aboutsummaryrefslogtreecommitdiff
path: root/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
commit877db3852e29c5b5a2dc25b3fe4a3b78619aa904 (patch)
tree90f465c800ad4cfd9eb16e1ed406258b2dc10ada /lib/Frontend/Backend.cpp
parent86f4385536a0b2202860ad4e20d84f9330b1a4f4 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72742 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/Backend.cpp')
-rw-r--r--lib/Frontend/Backend.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/Frontend/Backend.cpp b/lib/Frontend/Backend.cpp
index 44aa3a81a9..697ba941af 100644
--- a/lib/Frontend/Backend.cpp
+++ b/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;
+ }
}
}