aboutsummaryrefslogtreecommitdiff
path: root/src/include/jit/llvmjit.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/jit/llvmjit.h')
-rw-r--r--src/include/jit/llvmjit.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h
new file mode 100644
index 00000000000..187ebe2c2a0
--- /dev/null
+++ b/src/include/jit/llvmjit.h
@@ -0,0 +1,51 @@
+/*-------------------------------------------------------------------------
+ * llvmjit.h
+ * LLVM JIT provider.
+ *
+ * Copyright (c) 2016-2018, PostgreSQL Global Development Group
+ *
+ * src/include/jit/llvmjit.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef LLVMJIT_H
+#define LLVMJIT_H
+
+#ifndef USE_LLVM
+#error "llvmjit.h should only be included by code dealing with llvm"
+#endif
+
+#include <llvm-c/Types.h>
+
+
+/*
+ * File needs to be includable by both C and C++ code, and include other
+ * headers doing the same. Therefore wrap C portion in our own extern "C" if
+ * in C++ mode.
+ */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+#include "jit/jit.h"
+
+
+typedef struct LLVMJitContext
+{
+ JitContext base;
+} LLVMJitContext;
+
+extern void llvm_enter_fatal_on_oom(void);
+extern void llvm_leave_fatal_on_oom(void);
+extern void llvm_reset_after_error(void);
+extern void llvm_assert_in_fatal_section(void);
+
+extern LLVMJitContext *llvm_create_context(int jitFlags);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* LLVMJIT_H */