summaryrefslogtreecommitdiff
path: root/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2016-08-31 17:02:44 +0000
committerDavide Italiano <davide@freebsd.org>2016-08-31 17:02:44 +0000
commitc163bf589de6ceb67e0e4c3d54dd4991d387071d (patch)
treebf38a03784a405e9f5ead8923d949acac0c45a7d /lib/LTO/LTOBackend.cpp
parentb62ba77b89638d71946fa361ee4fa6bd48946948 (diff)
[lib/LTO] Factor out logic for running passes.
This is in preparation for adding an option to run a custom pipeline with the new PM. It's currently used in lld. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/LTO/LTOBackend.cpp')
-rw-r--r--lib/LTO/LTOBackend.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/LTO/LTOBackend.cpp b/lib/LTO/LTOBackend.cpp
index f5574c9d2b6..5f17c65cb26 100644
--- a/lib/LTO/LTOBackend.cpp
+++ b/lib/LTO/LTOBackend.cpp
@@ -114,10 +114,8 @@ createTargetMachine(Config &C, StringRef TheTriple, const Target *TheTarget) {
C.CodeModel, C.CGOptLevel));
}
-bool opt(Config &C, TargetMachine *TM, unsigned Task, Module &M,
- bool IsThinLto) {
- M.setDataLayout(TM->createDataLayout());
-
+static void runOldPMPasses(Config &C, Module &M, TargetMachine *TM,
+ bool IsThinLto) {
legacy::PassManager passes;
passes.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
@@ -136,7 +134,12 @@ bool opt(Config &C, TargetMachine *TM, unsigned Task, Module &M,
else
PMB.populateLTOPassManager(passes);
passes.run(M);
+}
+bool opt(Config &C, TargetMachine *TM, unsigned Task, Module &M,
+ bool IsThinLto) {
+ M.setDataLayout(TM->createDataLayout());
+ runOldPMPasses(C, M, TM, IsThinLto);
if (C.PostOptModuleHook && !C.PostOptModuleHook(Task, M))
return false;