[llvm-commits] [llvm] r125970 - /llvm/trunk/tools/opt/opt.cpp
Chris Lattner
sabre at nondot.org
Fri Feb 18 14:13:01 PST 2011
Author: lattner
Date: Fri Feb 18 16:13:01 2011
New Revision: 125970
URL: http://llvm.org/viewvc/llvm-project?rev=125970&view=rev
Log:
Have opt set up a specific TargetLibraryInfo for modules
with a triple.
Modified:
llvm/trunk/tools/opt/opt.cpp
Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=125970&r1=125969&r2=125970&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Fri Feb 18 16:13:01 2011
@@ -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 @@
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())
More information about the llvm-commits
mailing list