1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#include "llvm-c/Core.h"
#include "llvm-c/Target.h"
#include "core.h"
#include "llvm/Config/llvm-config.h"
extern "C" {
// Pass registry and initialization APIs support dropped
// https://reviews.llvm.org/D145043
API_EXPORT(void)
LLVMPY_Shutdown() { LLVMShutdown(); }
// Target Initialization
#define INIT(F) \
API_EXPORT(void) LLVMPY_Initialize##F() { LLVMInitialize##F(); }
// NOTE: it is important that we don't export functions which we don't use,
// especially those which may pull in large amounts of additional code or data.
INIT(AllTargetInfos)
INIT(AllTargets)
INIT(AllTargetMCs)
INIT(AllAsmPrinters)
INIT(NativeTarget)
INIT(NativeAsmParser)
INIT(NativeAsmPrinter)
// INIT(NativeDisassembler)
#undef INIT
API_EXPORT(unsigned int)
LLVMPY_GetVersionInfo() {
unsigned int verinfo = 0;
verinfo += LLVM_VERSION_MAJOR << 16;
verinfo += LLVM_VERSION_MINOR << 8;
#ifdef LLVM_VERSION_PATCH
/* Not available under Windows... */
verinfo += LLVM_VERSION_PATCH << 0;
#endif
return verinfo;
}
} // end extern "C"
|