1/*-------------------------------------------------------------------------
5 * Copyright (c) 2016-2025, PostgreSQL Global Development Group
7 * src/include/jit/llvmjit.h
9 *-------------------------------------------------------------------------
15 * To avoid breaking cpluspluscheck, allow including the file even when LLVM
22#include <llvm-c/Types.h>
23#ifdef USE_LLVM_BACKPORT_SECTION_MEMORY_MANAGER
24#include <llvm-c/OrcEE.h>
29 * File needs to be includable by both C and C++ code, and include other
30 * headers doing the same. Therefore wrap C portion in our own extern "C" if
43typedef struct LLVMJitContext
47 /* used to ensure cleanup of context */
50 /* number of modules created */
51 size_t module_generation;
54 * The LLVM Context used by this JIT context. An LLVM context is reused
55 * across many compilations, but occasionally reset to prevent it using
56 * too much memory due to more and more types accumulating.
60 /* current, "open for write", module */
63 /* is there any pending code that needs to be emitted */
66 /* # of objects emitted, used to generate non-conflicting names */
69 /* list of handles for code emitted via Orc */
73/* type and struct definitions */
119 LLVMBuilderRef builder,
127 ****************************************************************************
128 * Code generation functions.
129 ****************************************************************************
137 ****************************************************************************
138 * Extensions / Backward compatibility section of the LLVM C API
139 * Error handling related functions.
140 ****************************************************************************
144#ifdef USE_LLVM_BACKPORT_SECTION_MEMORY_MANAGER
145extern LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithSafeSectionMemoryManager(LLVMOrcExecutionSessionRef ES);
153#endif /* LLVMJIT_H */
LLVMTypeRef StructFunctionCallInfoData
LLVMTypeRef StructMinimalTupleData
LLVMTypeRef StructMinimalTupleTableSlot
LLVMTypeRef StructPlanState
static LLVMContextRef llvm_context
LLVMJitContext * llvm_create_context(int jitFlags)
LLVMTypeRef StructExprState
LLVMTypeRef StructExprEvalStep
LLVMValueRef llvm_pg_func(LLVMModuleRef mod, const char *funcname)
LLVMTypeRef TypeParamBool
LLVMTypeRef StructMemoryContextData
LLVMTypeRef StructAggStatePerGroupData
LLVMTypeRef llvm_pg_var_type(const char *varname)
LLVMValueRef llvm_function_reference(LLVMJitContext *context, LLVMBuilderRef builder, LLVMModuleRef mod, FunctionCallInfo fcinfo)
char * llvm_expand_funcname(struct LLVMJitContext *context, const char *basename)
void llvm_split_symbol_name(const char *name, char **modname, char **funcname)
LLVMTypeRef llvm_pg_var_func_type(const char *varname)
LLVMTypeRef StructTupleTableSlot
LLVMTypeRef TypeStorageBool
LLVMTypeRef StructHeapTupleTableSlot
LLVMModuleRef llvm_mutable_module(LLVMJitContext *context)
LLVMTypeRef StructAggState
LLVMTypeRef TypePGFunction
LLVMTypeRef StructTupleDescData
LLVMValueRef AttributeTemplate
LLVMTypeRef StructExprContext
LLVMTypeRef StructHeapTupleHeaderData
LLVMTypeRef StructHeapTupleData
void * llvm_get_function(LLVMJitContext *context, const char *funcname)
LLVMTypeRef StructNullableDatum
LLVMValueRef ExecEvalSubroutineTemplate
LLVMValueRef ExecEvalBoolSubroutineTemplate
LLVMTypeRef StructAggStatePerTransData
void llvm_copy_attributes(LLVMValueRef v_from, LLVMValueRef v_to)
void llvm_enter_fatal_on_oom(void)
bool llvm_in_fatal_on_oom(void)
void llvm_assert_in_fatal_section(void)
void llvm_reset_after_error(void)
void llvm_leave_fatal_on_oom(void)
bool llvm_compile_expr(ExprState *state)
void llvm_inline(LLVMModuleRef M)
void llvm_inline_reset_caches(void)
LLVMTypeRef LLVMGetFunctionReturnType(LLVMValueRef r)
LLVMTypeRef LLVMGetFunctionType(LLVMValueRef r)