#include "postgres.h"
#include <llvm-c/Analysis.h>
#include <llvm-c/BitReader.h>
#include <llvm-c/BitWriter.h>
#include <llvm-c/Core.h>
#include <llvm-c/ExecutionEngine.h>
#include <llvm-c/Orc.h>
#include <llvm-c/OrcEE.h>
#include <llvm-c/LLJIT.h>
#include <llvm-c/Support.h>
#include <llvm-c/Target.h>
#include <llvm-c/Transforms/IPO.h>
#include <llvm-c/Transforms/PassManagerBuilder.h>
#include <llvm-c/Transforms/Scalar.h>
#include <llvm-c/Transforms/Utils.h>
#include "jit/llvmjit.h"
#include "jit/llvmjit_backport.h"
#include "jit/llvmjit_emit.h"
#include "miscadmin.h"
#include "portability/instr_time.h"
#include "storage/ipc.h"
#include "utils/memutils.h"
#include "utils/resowner.h"
Go to the source code of this file.
Definition at line 152 of file llvmjit.c.
References JitProviderCallbacks::compile_expr, llvm_compile_expr(), llvm_release_context(), llvm_reset_after_error(), JitProviderCallbacks::release_context, and JitProviderCallbacks::reset_after_error.
Definition at line 706 of file llvmjit.c.
References DEBUG1, elog, ereport, errhidecontext(), errhidestmt(), errmsg_internal(), ERROR, error(), filename, INSTR_TIME_ACCUM_DIFF, INSTR_TIME_GET_DOUBLE, INSTR_TIME_SET_CURRENT, jit_dump_bitcode, lappend(), LLVMJitHandle::lljit, llvm_error_message(), llvm_inline(), llvm_opt0_orc, llvm_opt3_orc, llvm_optimize_module(), llvm_ts_context, MemoryContextAlloc(), MemoryContextSwitchTo(), MyProcPid, pfree(), PGJIT_INLINE, PGJIT_OPT3, psprintf(), LLVMJitHandle::resource_tracker, and TopMemoryContext.
Referenced by llvm_get_function().
Definition at line 517 of file llvmjit.c.
References llvm_copy_attributes_at_index(), and LLVMGetFunctionReturnType().
Referenced by llvm_pg_func(), and slot_compile_deform().
Definition at line 493 of file llvmjit.c.
References palloc(), and pfree().
Referenced by llvm_copy_attributes().
Definition at line 224 of file llvmjit.c.
References CurrentResourceOwner, llvm_assert_in_fatal_section(), llvm_jit_context_in_use_count, llvm_recreate_llvm_context(), llvm_session_initialize(), MemoryContextAllocZero(), ResourceOwnerEnlarge(), ResourceOwnerRememberJIT(), and TopMemoryContext.
Referenced by llvm_compile_expr().
Definition at line 1210 of file llvmjit.c.
References elog, ERROR, error(), llvm_create_object_layer(), llvm_error_message(), llvm_log_jit_error(), llvm_resolve_symbols(), and tm.
Referenced by llvm_session_initialize().
Definition at line 1173 of file llvmjit.c.
References jit_debugging_support, and jit_profiling_support.
Referenced by llvm_create_jit_instance().
Definition at line 992 of file llvmjit.c.
References AttributeTemplate, buf, elog, ERROR, ExecEvalBoolSubroutineTemplate, ExecEvalSubroutineTemplate, llvm_context, llvm_pg_var_type(), llvm_types_module, load_return_type(), MAXPGPATH, pkglib_path, snprintf, StructAggState, StructAggStatePerGroupData, StructAggStatePerTransData, StructExprContext, StructExprEvalStep, StructExprState, StructFunctionCallInfoData, StructHeapTupleData, StructHeapTupleHeaderData, StructHeapTupleTableSlot, StructMemoryContextData, StructMinimalTupleData, StructMinimalTupleTableSlot, StructNullableDatum, StructPlanState, StructTupleDescData, StructTupleTableSlot, TypeDatum, TypeParamBool, TypePGFunction, TypeSizeT, and TypeStorageBool.
Referenced by llvm_recreate_llvm_context(), and llvm_session_initialize().
Definition at line 1262 of file llvmjit.c.
References error(), and pstrdup().
Referenced by llvm_compile_module(), llvm_create_jit_instance(), llvm_get_function(), llvm_log_jit_error(), and llvm_optimize_module().
Definition at line 342 of file llvmjit.c.
References Assert(), and psprintf().
Referenced by slot_compile_deform().
Definition at line 541 of file llvmjit.c.
References AttributeTemplate, FunctionCallInfoBaseData::flinfo, fmgr_symbol(), FmgrInfo::fn_addr, FmgrInfo::fn_oid, funcname, LLVMGetFunctionType(), psprintf(), pstrdup(), and TypePGFunction.
Referenced by BuildV1Call().
Definition at line 363 of file llvmjit.c.
References elog, ERROR, error(), funcname, INSTR_TIME_ACCUM_DIFF, INSTR_TIME_SET_CURRENT, lfirst, LLVMJitHandle::lljit, llvm_assert_in_fatal_section(), llvm_compile_module(), and llvm_error_message().
Referenced by ExecRunCompiledExpr().
Definition at line 1163 of file llvmjit.c.
References elog, error(), llvm_error_message(), and WARNING.
Referenced by llvm_create_jit_instance().
Definition at line 317 of file llvmjit.c.
References llvm_assert_in_fatal_section(), llvm_context, llvm_generation, llvm_layout, and llvm_triple.
Referenced by slot_compile_deform().
Definition at line 604 of file llvmjit.c.
References elog, err(), ERROR, llvm_error_message(), options, PGJIT_INLINE, and PGJIT_OPT3.
Referenced by llvm_compile_module().
Definition at line 465 of file llvmjit.c.
References elog, ERROR, funcname, llvm_copy_attributes(), llvm_types_module, and LLVMGetFunctionType().
Referenced by build_EvalXFuncInt(), and slot_compile_deform().
Definition at line 443 of file llvmjit.c.
References elog, ERROR, llvm_types_module, and LLVMGetFunctionType().
Referenced by slot_compile_deform().
Definition at line 423 of file llvmjit.c.
References elog, ERROR, and llvm_types_module.
Referenced by llvm_create_types().
Definition at line 174 of file llvmjit.c.
References elog, ERROR, llvm_context, llvm_create_types(), llvm_inline_reset_caches(), llvm_jit_context_in_use_count, llvm_llvm_context_reuse_count, and LLVMJIT_LLVM_CONTEXT_REUSE_MAX.
Referenced by llvm_create_context().
Definition at line 253 of file llvmjit.c.
References lfirst, list_free(), LLVMJitHandle::lljit, llvm_enter_fatal_on_oom(), llvm_jit_context_in_use_count, llvm_leave_fatal_on_oom(), NIL, pfree(), proc_exit_inprogress, LLVMJitHandle::resource_tracker, and ResourceOwnerForgetJIT().
Referenced by _PG_jit_provider_init().
Definition at line 1081 of file llvmjit.c.
References Assert(), elog, ERROR, funcname, llvm_split_symbol_name(), load_external_function(), pfree(), and WARNING.
Referenced by llvm_resolve_symbols().
Definition at line 1120 of file llvmjit.c.
References error(), i, llvm_resolve_symbol(), name, palloc0(), and pfree().
Referenced by llvm_create_jit_instance().
Definition at line 822 of file llvmjit.c.
References DEBUG2, elog, error(), FATAL, llvm_context, llvm_create_jit_instance(), llvm_create_types(), llvm_jit_context_in_use_count, llvm_llvm_context_reuse_count, llvm_opt0_orc, llvm_opt3_orc, llvm_session_initialized, llvm_set_target(), llvm_shutdown(), llvm_targetref, llvm_triple, llvm_ts_context, MemoryContextSwitchTo(), on_proc_exit(), and TopMemoryContext.
Referenced by llvm_create_context().
Definition at line 973 of file llvmjit.c.
References elog, ERROR, llvm_layout, llvm_triple, llvm_types_module, and pstrdup().
Referenced by llvm_session_initialize().
Definition at line 912 of file llvmjit.c.
References Assert(), elog, llvm_in_fatal_on_oom(), llvm_jit_context_in_use_count, llvm_opt0_orc, llvm_opt3_orc, llvm_ts_context, PANIC, and proc_exit_inprogress.
Referenced by llvm_session_initialize().
Definition at line 1047 of file llvmjit.c.
References Assert(), funcname, name, pnstrdup(), and pstrdup().
Referenced by llvm_build_inline_plan(), llvm_execute_inline_plan(), and llvm_resolve_symbol().
Definition at line 953 of file llvmjit.c.
References elog, ERROR, LLVMGetFunctionReturnType(), name, and value.
Referenced by llvm_create_types().
"llvmjit"
,
PG_VERSION
Definition at line 137 of file llvmjit.c.
References jit_resowner_desc, PointerGetDatum(), and ResourceOwnerForget().
Referenced by llvm_release_context().
Definition at line 132 of file llvmjit.c.
References jit_resowner_desc, PointerGetDatum(), and ResourceOwnerRemember().
Referenced by llvm_create_context().
Definition at line 1276 of file llvmjit.c.
References DatumGetPointer(), and jit_release_context().
Definition at line 79 of file llvmjit.c.
Referenced by BuildV1Call(), llvm_create_types(), llvm_function_reference(), and slot_compile_deform().
Definition at line 81 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 80 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 121 of file llvmjit.c.
Referenced by ResourceOwnerForgetJIT(), and ResourceOwnerRememberJIT().
Definition at line 95 of file llvmjit.c.
Referenced by llvm_create_types(), llvm_mutable_module(), llvm_recreate_llvm_context(), and llvm_session_initialize().
Definition at line 86 of file llvmjit.c.
Referenced by llvm_mutable_module().
Definition at line 89 of file llvmjit.c.
Referenced by llvm_create_context(), llvm_recreate_llvm_context(), llvm_release_context(), llvm_session_initialize(), and llvm_shutdown().
Definition at line 94 of file llvmjit.c.
Referenced by llvm_mutable_module(), and llvm_set_target().
Definition at line 92 of file llvmjit.c.
Referenced by llvm_recreate_llvm_context(), and llvm_session_initialize().
Definition at line 100 of file llvmjit.c.
Referenced by llvm_compile_module(), llvm_session_initialize(), and llvm_shutdown().
Definition at line 101 of file llvmjit.c.
Referenced by llvm_compile_module(), llvm_session_initialize(), and llvm_shutdown().
Definition at line 85 of file llvmjit.c.
Referenced by llvm_session_initialize().
Definition at line 98 of file llvmjit.c.
Referenced by llvm_session_initialize().
Definition at line 93 of file llvmjit.c.
Referenced by llvm_mutable_module(), llvm_session_initialize(), and llvm_set_target().
Definition at line 99 of file llvmjit.c.
Referenced by llvm_compile_module(), llvm_session_initialize(), and llvm_shutdown().
Definition at line 83 of file llvmjit.c.
Referenced by llvm_create_types(), llvm_pg_func(), llvm_pg_var_func_type(), llvm_pg_var_type(), and llvm_set_target().
Definition at line 74 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 75 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 76 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 71 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 72 of file llvmjit.c.
Referenced by build_EvalXFuncInt(), and llvm_create_types().
Definition at line 73 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 70 of file llvmjit.c.
Referenced by BuildV1Call(), and llvm_create_types().
Definition at line 62 of file llvmjit.c.
Referenced by llvm_create_types(), and slot_compile_deform().
Definition at line 66 of file llvmjit.c.
Referenced by llvm_create_types(), and slot_compile_deform().
Definition at line 67 of file llvmjit.c.
Referenced by llvm_create_types(), and slot_compile_deform().
Definition at line 69 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 63 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 68 of file llvmjit.c.
Referenced by llvm_create_types(), and slot_compile_deform().
Definition at line 61 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 77 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 64 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 65 of file llvmjit.c.
Referenced by llvm_create_types(), and slot_compile_deform().
Definition at line 57 of file llvmjit.c.
Referenced by llvm_create_types(), and slot_compile_deform().
Definition at line 58 of file llvmjit.c.
Referenced by llvm_create_types().
Definition at line 60 of file llvmjit.c.
Referenced by llvm_create_types(), and llvm_function_reference().
Definition at line 56 of file llvmjit.c.
Referenced by llvm_create_types(), and slot_compile_deform().
Definition at line 59 of file llvmjit.c.
Referenced by BuildV1Call(), llvm_create_types(), and slot_compile_deform().