[llvm-commits] [llvm] r154959 - /llvm/trunk/tools/opt/opt.cpp
Joe Groff
arcata at gmail.com
Tue Apr 17 16:05:48 PDT 2012
Author: joe
Date: Tue Apr 17 18:05:48 2012
New Revision: 154959
URL: http://llvm.org/viewvc/llvm-project?rev=154959&view=rev
Log:
allow opt to take a -mtriple option
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=154959&r1=154958&r2=154959&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Tue Apr 17 18:05:48 2012
@@ -114,6 +114,9 @@
OptLevelO3("O3",
cl::desc("Optimization level 3. Similar to llvm-gcc -O3"));
+static cl::opt<std::string>
+TargetTriple("mtriple", cl::desc("Override target triple for module"));
+
static cl::opt<bool>
UnitAtATime("funit-at-a-time",
cl::desc("Enable IPO. This is same as llvm-gcc's -funit-at-a-time"),
@@ -512,6 +515,10 @@
return 1;
}
+ // If we are supposed to override the target triple, do so now.
+ if (!TargetTriple.empty())
+ M->setTargetTriple(Triple::normalize(TargetTriple));
+
// Figure out what stream we are supposed to write to...
OwningPtr<tool_output_file> Out;
if (NoOutput) {
More information about the llvm-commits
mailing list