summaryrefslogtreecommitdiff
path: root/tools/opt/opt.cpp
diff options
context:
space:
mode:
authorJoe Groff <arcata@gmail.com>2012-04-17 23:05:48 +0000
committerJoe Groff <arcata@gmail.com>2012-04-17 23:05:48 +0000
commite652b521f97ed0c60cb5ad533dfcf477863ac0b1 (patch)
treee1c248eb6c7f8ed4de98b30baa41d183d3c40824 /tools/opt/opt.cpp
parentd16ce17711e8e6231363fe1fd47800570b75d61d (diff)
downloadllvm-e652b521f97ed0c60cb5ad533dfcf477863ac0b1.tar.gz
llvm-e652b521f97ed0c60cb5ad533dfcf477863ac0b1.tar.bz2
llvm-e652b521f97ed0c60cb5ad533dfcf477863ac0b1.tar.xz
allow opt to take a -mtriple option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt/opt.cpp')
-rw-r--r--tools/opt/opt.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 30da863b41..a5b0511fd9 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -114,6 +114,9 @@ static cl::opt<bool>
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 @@ int main(int argc, char **argv) {
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) {