summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/jit/jit.h21
-rw-r--r--src/include/jit/llvmjit.h30
2 files changed, 51 insertions, 0 deletions
diff --git a/src/include/jit/jit.h b/src/include/jit/jit.h
index a2f3dd9d4f2..35301674c8a 100644
--- a/src/include/jit/jit.h
+++ b/src/include/jit/jit.h
@@ -11,14 +11,34 @@
#ifndef JIT_H
#define JIT_H
+#include "executor/instrument.h"
#include "utils/resowner.h"
+/* Flags deterimining what kind of JIT operations to perform */
+#define PGJIT_NONE 0
+#define PGJIT_PERFORM 1 << 0
+#define PGJIT_OPT3 1 << 1
+
+
typedef struct JitContext
{
+ /* see PGJIT_* above */
int flags;
ResourceOwner resowner;
+
+ /* number of emitted functions */
+ size_t created_functions;
+
+ /* accumulated time to generate code */
+ instr_time generation_counter;
+
+ /* accumulated time for optimization */
+ instr_time optimization_counter;
+
+ /* accumulated time for code emission */
+ instr_time emission_counter;
} JitContext;
typedef struct JitProviderCallbacks JitProviderCallbacks;
@@ -38,6 +58,7 @@ struct JitProviderCallbacks
/* GUCs */
extern bool jit_enabled;
extern char *jit_provider;
+extern bool jit_dump_bitcode;
extern void jit_reset_after_error(void);
diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h
index 63b2fdfe591..bd201bb7ca1 100644
--- a/src/include/jit/llvmjit.h
+++ b/src/include/jit/llvmjit.h
@@ -30,19 +30,49 @@ extern "C"
#include "jit/jit.h"
+#include "nodes/pg_list.h"
typedef struct LLVMJitContext
{
JitContext base;
+
+ /* number of modules created */
+ size_t module_generation;
+
+ /* current, "open for write", module */
+ LLVMModuleRef module;
+
+ /* is there any pending code that needs to be emitted */
+ bool compiled;
+
+ /* # of objects emitted, used to generate non-conflicting names */
+ int counter;
+
+ /* list of handles for code emitted via Orc */
+ List *handles;
} LLVMJitContext;
+
+/* type and struct definitions */
+extern LLVMTypeRef TypeSizeT;
+
+extern LLVMValueRef AttributeTemplate;
+extern LLVMValueRef FuncStrlen;
+
+
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);
+extern LLVMModuleRef llvm_mutable_module(LLVMJitContext *context);
+extern char *llvm_expand_funcname(LLVMJitContext *context, const char *basename);
+extern void *llvm_get_function(LLVMJitContext *context, const char *funcname);
+extern void llvm_split_symbol_name(const char *name, char **modname, char **funcname);
+extern LLVMValueRef llvm_get_decl(LLVMModuleRef mod, LLVMValueRef f);
+extern void llvm_copy_attributes(LLVMValueRef from, LLVMValueRef to);
/*