diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-18 22:13:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-18 22:13:01 +0000 |
commit | 2a66acafaf8d5ceedfef56c00526f6253ac176be (patch) | |
tree | 0890ea725fca1fe890799a70977fcbb1434de12e /tools/opt/opt.cpp | |
parent | 9a89894537ce6573d9affa5b67f8c50062b01005 (diff) | |
download | external_llvm-2a66acafaf8d5ceedfef56c00526f6253ac176be.zip external_llvm-2a66acafaf8d5ceedfef56c00526f6253ac176be.tar.gz external_llvm-2a66acafaf8d5ceedfef56c00526f6253ac176be.tar.bz2 |
Have opt set up a specific TargetLibraryInfo for modules
with a triple.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt/opt.cpp')
-rw-r--r-- | tools/opt/opt.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 0a945df..8ccd8e8 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -24,7 +24,9 @@ #include "llvm/Analysis/RegionPass.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLibraryInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/ADT/Triple.h" #include "llvm/Support/PassNameParser.h" #include "llvm/Support/Signals.h" #include "llvm/Support/Debug.h" @@ -525,11 +527,15 @@ int main(int argc, char **argv) { NoOutput = true; // Create a PassManager to hold and optimize the collection of passes we are - // about to build... + // about to build. // PassManager Passes; - // Add an appropriate TargetData instance for this module... + // Add an appropriate TargetLibraryInfo pass for the module's triple. + if (!M->getTargetTriple().empty()) + Passes.add(new TargetLibraryInfo(Triple(M->getTargetTriple()))); + + // Add an appropriate TargetData instance for this module. TargetData *TD = 0; const std::string &ModuleDataLayout = M.get()->getDataLayout(); if (!ModuleDataLayout.empty()) |