diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-16 02:04:54 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-16 02:04:54 +0000 |
commit | 3d92d936b975b1ad02533e4a2333d0b0c2f68e5c (patch) | |
tree | 6ed0a68aa4a9f88ce4b56727a12fc8c7e0d6da38 /llvm | |
parent | 84a56054cd9eea757312bc3cc7f7ed9ad2b47804 (diff) | |
download | bcm5719-llvm-3d92d936b975b1ad02533e4a2333d0b0c2f68e5c.tar.gz bcm5719-llvm-3d92d936b975b1ad02533e4a2333d0b0c2f68e5c.zip |
Make sure targets are initialized before we do anything, even command line
processing.
llvm-svn: 75888
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/tools/llc/llc.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/lli/lli.cpp | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp index 34587173ab9..304638c52f7 100644 --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -210,10 +210,12 @@ int main(int argc, char **argv) { PrettyStackTraceProgram X(argc, argv); LLVMContext &Context = getGlobalContext(); llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. - cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n"); + // Initialize targets first. InitializeAllTargets(); InitializeAllAsmPrinters(); + + cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n"); // Load the module to be compiled... std::string ErrorMessage; diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index 788aca01d6a..8afdbcad95b 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -96,6 +96,11 @@ int main(int argc, char **argv, char * const *envp) { LLVMContext &Context = getGlobalContext(); atexit(do_shutdown); // Call llvm_shutdown() on exit. + + // If we have a native target, initialize it to ensure it is linked in and + // usable by the JIT. + InitializeNativeTarget(); + cl::ParseCommandLineOptions(argc, argv, "llvm interpreter & dynamic compiler\n"); @@ -142,10 +147,6 @@ int main(int argc, char **argv, char * const *envp) { case '3': OLvl = CodeGenOpt::Aggressive; break; } - // If we have a native target, initialize it to ensure it is linked in and - // usable by the JIT. - InitializeNativeTarget(); - EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg, OLvl); if (!EE) { if (!ErrorMsg.empty()) |