diff options
author | Chris Lattner <sabre@nondot.org> | 2009-06-17 02:15:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-06-17 02:15:40 +0000 |
commit | c447ff693e9979c61f58b8e97dcfdbcfe7e10554 (patch) | |
tree | 3eede6c8bfeadac1b5c13440cc94495665b8bef5 /tools/lli/lli.cpp | |
parent | 3034c106753595f564d5852a2d4398f0acb16b32 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73595 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lli/lli.cpp')
-rw-r--r-- | tools/lli/lli.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 6d3cbbc1f5..618692db70 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -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 @@ static void do_shutdown() { 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 @@ int main(int argc, char **argv, char * const *envp) { 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()) { |