provide an option to override the target triple in a module from the commandline.
authorChris Lattner <sabre@nondot.org>
Fri, 16 Dec 2005 05:00:21 +0000 (05:00 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 16 Dec 2005 05:00:21 +0000 (05:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24730 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lli/lli.cpp

index c1b7478a3769ba4372eeac91b6378c46c0ce4ab2..b0f3ff5211e92c8759a663cae60bc1f9ab0fe9b2 100644 (file)
@@ -36,7 +36,9 @@ namespace {
   cl::opt<bool> ForceInterpreter("force-interpreter",
                                  cl::desc("Force interpretation: disable JIT"),
                                  cl::init(false));
-
+  cl::opt<std::string>
+  TargetTriple("triple", cl::desc("Override target triple for module"));
+  
   cl::opt<std::string>
   FakeArgv0("fake-argv0",
             cl::desc("Override the 'argv[0]' value passed into the executing"
@@ -62,6 +64,10 @@ int main(int argc, char **argv, char * const *envp) {
       exit(1);
     }
 
+    // If we are supposed to override the target triple, do so now.
+    if (!TargetTriple.empty())
+      MP->getModule()->setTargetTriple(TargetTriple);
+    
     ExecutionEngine *EE = ExecutionEngine::create(MP, ForceInterpreter);
     assert(EE && "Couldn't create an ExecutionEngine, not even an interpreter?");