[llvm-commits] [llvm] r75888 - in /llvm/trunk/tools: llc/llc.cpp lli/lli.cpp

Daniel Dunbar daniel at zuster.org
Wed Jul 15 19:04:54 PDT 2009


Author: ddunbar
Date: Wed Jul 15 21:04:54 2009
New Revision: 75888

URL: http://llvm.org/viewvc/llvm-project?rev=75888&view=rev
Log:
Make sure targets are initialized before we do anything, even command line
processing.

Modified:
    llvm/trunk/tools/llc/llc.cpp
    llvm/trunk/tools/lli/lli.cpp

Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=75888&r1=75887&r2=75888&view=diff

==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Wed Jul 15 21:04:54 2009
@@ -210,10 +210,12 @@
   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;

Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=75888&r1=75887&r2=75888&view=diff

==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Wed Jul 15 21:04:54 2009
@@ -96,6 +96,11 @@
   
   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 @@
   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())





More information about the llvm-commits mailing list