provide an option to override the target triple in a module from the command
authorChris Lattner <sabre@nondot.org>
Fri, 16 Dec 2005 04:59:57 +0000 (04:59 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 16 Dec 2005 04:59:57 +0000 (04:59 +0000)
line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24729 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llc/llc.cpp

index e71a7b985dba07b6f589e793d0fc97360ec92858..1b6c71080af7f231e3976f61682f04ed46fe21b1 100644 (file)
@@ -48,6 +48,8 @@ static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
 static cl::opt<bool> Fast("fast", 
       cl::desc("Generate code quickly, potentially sacrificing code quality"));
 
+static cl::opt<std::string>
+TargetTriple("triple", cl::desc("Override target triple for module"));
 
 static cl::opt<const TargetMachineRegistry::Entry*, false, TargetNameParser>
 MArch("march", cl::desc("Architecture to generate code for:"));
@@ -116,6 +118,10 @@ int main(int argc, char **argv) {
     }
     Module &mod = *M.get();
 
+    // If we are supposed to override the target triple, do so now.
+    if (!TargetTriple.empty())
+      mod.setTargetTriple(TargetTriple);
+    
     // Allocate target machine.  First, check whether the user has
     // explicitly specified an architecture to compile for.
     TargetMachine* (*TargetMachineAllocator)(const Module&,