[llvm-commits] [llvm] r73595 - /llvm/trunk/tools/lli/lli.cpp

Chris Lattner sabre at nondot.org
Tue Jun 16 19:15:42 PDT 2009


Author: lattner
Date: Tue Jun 16 21:15:40 2009
New Revision: 73595

URL: http://llvm.org/viewvc/llvm-project?rev=73595&view=rev
Log:
Use Doug's new LLVM_NATIVE_ARCH macro in config.h to link in the native
target so that the JIT works in LLI, not just the interpreter.

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

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

==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Tue Jun 16 21:15:40 2009
@@ -28,6 +28,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/System/Process.h"
 #include "llvm/System/Signals.h"
+#include "llvm/Config/config.h"
 #include <iostream>
 #include <cerrno>
 using namespace llvm;
@@ -84,6 +85,16 @@
   llvm_shutdown();
 }
 
+#ifdef LLVM_NATIVE_ARCH
+namespace llvm {
+#define Declare2(TARG, MOD)   void Initialize ## TARG ## MOD()
+#define Declare(T, M) Declare2(T, M)
+  Declare(LLVM_NATIVE_ARCH, Target);
+#undef Declare
+#undef Declare2
+}
+#endif
+
 //===----------------------------------------------------------------------===//
 // main Driver function
 //
@@ -137,6 +148,16 @@
   case '2': OLvl = CodeGenOpt::Default; break;
   case '3': OLvl = CodeGenOpt::Aggressive; break;
   }
+  
+  // If we have a native target, initialize it to ensure it is linked in.
+#ifdef LLVM_NATIVE_ARCH
+#define DoInit2(TARG, MOD)   llvm::Initialize ## TARG ## MOD()
+#define DoInit(T, M) DoInit2(T, M)
+  DoInit(LLVM_NATIVE_ARCH, Target);
+#undef DoInit
+#undef DoInit2
+#endif
+  
 
   EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg, OLvl);
   if (!EE && !ErrorMsg.empty()) {





More information about the llvm-commits mailing list