just in time native code: now compiles by doing cmake; make.

no workie in this version, though :)
This commit is contained in:
Vítor Santos Costa
2015-02-06 18:11:52 +00:00
parent 42d7b305c0
commit ba978d8275
32 changed files with 2436 additions and 9666 deletions

58
JIT/JIT_Init.cpp Normal file
View File

@@ -0,0 +1,58 @@
#include "JIT_Compiler.hpp"
using namespace std;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
extern "C" void Yap_InitJitAnalysisPreds(void);
extern "C" void Yap_InitJitTransformPreds(void);
extern "C" void Yap_InitJitCodegenPreds(void);
extern "C" void Yap_InitJitConfigPreds(void);
#if YAP_STAT_PREDS
extern "C" void Yap_InitJitStatisticPreds(void);
#endif
#if YAP_DBG_PREDS
extern "C" void Yap_InitJitDebugPreds(void);
#endif
// global variables with intercae
extern "C" void* (*Yap_JitCall)(JIT_Compiler* jc, yamop* p);
extern "C" void (* Yap_llvmShutdown)( ) ;
extern "C" Int (* Yap_traced_absmi)( ) ;
void init_jit();
extern "C" void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p) {
return jc->compile(p); }
extern "C" void shutdown_llvm() { llvm_shutdown(); }
extern "C" Int traced_absmi();
static void
initJit(void)
{
Yap_InitJitAnalysisPreds();
Yap_InitJitTransformPreds();
Yap_InitJitCodegenPreds();
Yap_InitJitConfigPreds();
#if YAP_STAT_PREDS
Yap_InitJitStatisticPreds();
#endif
#if YAP_DBG_PREDS
Yap_InitJitDebugPreds();
#endif
Yap_JitCall = call_JIT_Compiler;
Yap_llvmShutdown = llvm_shutdown;
Yap_traced_absmi = traced_absmi;
}
// export JIT as DLL
void
init_jit() {
initJit();
}
#pragma GCC diagnostic pop