provide an option to override the target triple in a module from the commandline.

llvm-svn: 24730
This commit is contained in:
Chris Lattner 2005-12-16 05:00:21 +00:00
parent e568b88c98
commit 76766cb880
1 changed files with 7 additions and 1 deletions

View 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?");