diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2015-02-01 10:11:22 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2015-02-01 10:11:22 +0000 |
commit | e038552c8ae99abe129837255273a992f72c6d9c (patch) | |
tree | 391c11977c8ac0b7230a1a747c4dc8d74d0f210a /llvm/tools/opt/opt.cpp | |
parent | 2844ca7319bab9dacceb499227c15391ce97fb87 (diff) | |
download | bcm5719-llvm-e038552c8ae99abe129837255273a992f72c6d9c.tar.gz bcm5719-llvm-e038552c8ae99abe129837255273a992f72c6d9c.zip |
[PM] Port TTI to the new pass manager, introducing a TargetIRAnalysis to
produce it.
This adds a function to the TargetMachine that produces this analysis
via a callback for each function. This in turn faves the way to produce
a *different* TTI per-function with the correct subtarget cached.
I've also done the necessary wiring in the opt tool to thread the target
machine down and make it available to the pass registry so that we can
construct this analysis from a target machine when available.
llvm-svn: 227721
Diffstat (limited to 'llvm/tools/opt/opt.cpp')
-rw-r--r-- | llvm/tools/opt/opt.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index 93b44d4f7f4..af2cdd82460 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -370,6 +370,12 @@ int main(int argc, char **argv) { } } + Triple ModuleTriple(M->getTargetTriple()); + TargetMachine *Machine = nullptr; + if (ModuleTriple.getArch()) + Machine = GetTargetMachine(ModuleTriple); + std::unique_ptr<TargetMachine> TM(Machine); + // If the output is set to be emitted to standard out, and standard out is a // console, print out a warning message and refuse to do it. We don't // impress anyone by spewing tons of binary goo to a terminal. @@ -391,8 +397,8 @@ int main(int argc, char **argv) { // The user has asked to use the new pass manager and provided a pipeline // string. Hand off the rest of the functionality to the new code for that // layer. - return runPassPipeline(argv[0], Context, *M, Out.get(), PassPipeline, - OK, VK) + return runPassPipeline(argv[0], Context, *M, TM.get(), Out.get(), + PassPipeline, OK, VK) ? 0 : 1; } @@ -403,7 +409,7 @@ int main(int argc, char **argv) { PassManager Passes; // Add an appropriate TargetLibraryInfo pass for the module's triple. - TargetLibraryInfoImpl TLII(Triple(M->getTargetTriple())); + TargetLibraryInfoImpl TLII(ModuleTriple); // The -disable-simplify-libcalls flag actually disables all builtin optzns. if (DisableSimplifyLibCalls) @@ -420,12 +426,6 @@ int main(int argc, char **argv) { if (DL) Passes.add(new DataLayoutPass()); - Triple ModuleTriple(M->getTargetTriple()); - TargetMachine *Machine = nullptr; - if (ModuleTriple.getArch()) - Machine = GetTargetMachine(Triple(ModuleTriple)); - std::unique_ptr<TargetMachine> TM(Machine); - // Add internal analysis passes from the target machine. Passes.add(createTargetTransformInfoWrapperPass( TM ? TM->getTTI() : TargetTransformInfo(DL))); |