PostgreSQL Source Code  git master
llvmjit.c File Reference
#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/OrcBindings.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 "jit/llvmjit.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_private.h"
Include dependency graph for llvmjit.c:

Go to the source code of this file.

Data Structures

struct  LLVMJitHandle
 

Typedefs

typedef struct LLVMJitHandle LLVMJitHandle
 

Functions

static void llvm_release_context (JitContext *context)
 
static void llvm_session_initialize (void)
 
static void llvm_shutdown (int code, Datum arg)
 
static void llvm_compile_module (LLVMJitContext *context)
 
static void llvm_optimize_module (LLVMJitContext *context, LLVMModuleRef module)
 
static void llvm_create_types (void)
 
static uint64_t llvm_resolve_symbol (const char *name, void *ctx)
 
void _PG_jit_provider_init (JitProviderCallbacks *cb)
 
LLVMJitContext * llvm_create_context (int jitFlags)
 
LLVMModuleRef llvm_mutable_module (LLVMJitContext *context)
 
char * llvm_expand_funcname (struct LLVMJitContext *context, const char *basename)
 
void * llvm_get_function (LLVMJitContext *context, const char *funcname)
 
LLVMValueRef llvm_pg_func (LLVMModuleRef mod, const char *funcname)
 
void llvm_copy_attributes (LLVMValueRef v_from, LLVMValueRef v_to)
 
LLVMValueRef llvm_function_reference (LLVMJitContext *context, LLVMBuilderRef builder, LLVMModuleRef mod, FunctionCallInfo fcinfo)
 
static LLVMTypeRef load_type (LLVMModuleRef mod, const char *name)
 
static LLVMTypeRef load_return_type (LLVMModuleRef mod, const char *name)
 
void llvm_split_symbol_name (const char *name, char **modname, char **funcname)
 

Variables

LLVMTypeRef TypeSizeT
 
LLVMTypeRef TypeParamBool
 
LLVMTypeRef TypeStorageBool
 
LLVMTypeRef TypePGFunction
 
LLVMTypeRef StructNullableDatum
 
LLVMTypeRef StructHeapTupleFieldsField3
 
LLVMTypeRef StructHeapTupleFields
 
LLVMTypeRef StructHeapTupleHeaderData
 
LLVMTypeRef StructHeapTupleDataChoice
 
LLVMTypeRef StructHeapTupleData
 
LLVMTypeRef StructMinimalTupleData
 
LLVMTypeRef StructItemPointerData
 
LLVMTypeRef StructBlockId
 
LLVMTypeRef StructFormPgAttribute
 
LLVMTypeRef StructTupleConstr
 
LLVMTypeRef StructTupleDescData
 
LLVMTypeRef StructTupleTableSlot
 
LLVMTypeRef StructHeapTupleTableSlot
 
LLVMTypeRef StructMinimalTupleTableSlot
 
LLVMTypeRef StructMemoryContextData
 
LLVMTypeRef StructPGFinfoRecord
 
LLVMTypeRef StructFmgrInfo
 
LLVMTypeRef StructFunctionCallInfoData
 
LLVMTypeRef StructExprContext
 
LLVMTypeRef StructExprEvalStep
 
LLVMTypeRef StructExprState
 
LLVMTypeRef StructAggState
 
LLVMTypeRef StructAggStatePerGroupData
 
LLVMTypeRef StructAggStatePerTransData
 
LLVMValueRef AttributeTemplate
 
LLVMModuleRef llvm_types_module = NULL
 
static bool llvm_session_initialized = false
 
static size_t llvm_generation = 0
 
static const char * llvm_triple = NULL
 
static const char * llvm_layout = NULL
 
static LLVMTargetMachineRef llvm_opt0_targetmachine
 
static LLVMTargetMachineRef llvm_opt3_targetmachine
 
static LLVMTargetRef llvm_targetref
 
static LLVMOrcJITStackRef llvm_opt0_orc
 
static LLVMOrcJITStackRef llvm_opt3_orc
 
 PG_MODULE_MAGIC
 

Typedef Documentation

◆ LLVMJitHandle

typedef struct LLVMJitHandle LLVMJitHandle

Function Documentation

◆ _PG_jit_provider_init()

void _PG_jit_provider_init ( JitProviderCallbacks cb)

Definition at line 113 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.

114 {
118 }
JitProviderResetAfterErrorCB reset_after_error
Definition: jit.h:75
JitProviderCompileExprCB compile_expr
Definition: jit.h:77
void llvm_reset_after_error(void)
static void llvm_release_context(JitContext *context)
Definition: llvmjit.c:153
bool llvm_compile_expr(ExprState *state)
Definition: llvmjit_expr.c:78
JitProviderReleaseContextCB release_context
Definition: jit.h:76

◆ llvm_compile_module()

static void llvm_compile_module ( LLVMJitContext *  context)
static

Definition at line 485 of file llvmjit.c.

References DEBUG1, elog, ereport, errhidecontext(), errhidestmt(), errmsg(), ERROR, filename, INSTR_TIME_ACCUM_DIFF, INSTR_TIME_GET_DOUBLE, INSTR_TIME_SET_CURRENT, jit_dump_bitcode, lappend(), llvm_inline(), llvm_opt0_orc, llvm_opt3_orc, llvm_optimize_module(), llvm_resolve_symbol(), MemoryContextSwitchTo(), MyProcPid, LLVMJitHandle::orc_handle, palloc(), pfree(), PGJIT_INLINE, PGJIT_OPT3, psprintf(), LLVMJitHandle::stack, and TopMemoryContext.

Referenced by llvm_get_function().

486 {
487  LLVMOrcModuleHandle orc_handle;
488  MemoryContext oldcontext;
489  static LLVMOrcJITStackRef compile_orc;
490  instr_time starttime;
491  instr_time endtime;
492 
493  if (context->base.flags & PGJIT_OPT3)
494  compile_orc = llvm_opt3_orc;
495  else
496  compile_orc = llvm_opt0_orc;
497 
498  /* perform inlining */
499  if (context->base.flags & PGJIT_INLINE)
500  {
501  INSTR_TIME_SET_CURRENT(starttime);
502  llvm_inline(context->module);
503  INSTR_TIME_SET_CURRENT(endtime);
504  INSTR_TIME_ACCUM_DIFF(context->base.instr.inlining_counter,
505  endtime, starttime);
506  }
507 
508  if (jit_dump_bitcode)
509  {
510  char *filename;
511 
512  filename = psprintf("%u.%zu.bc",
513  MyProcPid,
514  context->module_generation);
515  LLVMWriteBitcodeToFile(context->module, filename);
516  pfree(filename);
517  }
518 
519 
520  /* optimize according to the chosen optimization settings */
521  INSTR_TIME_SET_CURRENT(starttime);
522  llvm_optimize_module(context, context->module);
523  INSTR_TIME_SET_CURRENT(endtime);
524  INSTR_TIME_ACCUM_DIFF(context->base.instr.optimization_counter,
525  endtime, starttime);
526 
527  if (jit_dump_bitcode)
528  {
529  char *filename;
530 
531  filename = psprintf("%u.%zu.optimized.bc",
532  MyProcPid,
533  context->module_generation);
534  LLVMWriteBitcodeToFile(context->module, filename);
535  pfree(filename);
536  }
537 
538  /*
539  * Emit the code. Note that this can, depending on the optimization
540  * settings, take noticeable resources as code emission executes low-level
541  * instruction combining/selection passes etc. Without optimization a
542  * faster instruction selection mechanism is used.
543  */
544  INSTR_TIME_SET_CURRENT(starttime);
545 #if LLVM_VERSION_MAJOR > 6
546  {
547  if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &orc_handle, context->module,
548  llvm_resolve_symbol, NULL))
549  {
550  elog(ERROR, "failed to JIT module");
551  }
552 
553  /* LLVMOrcAddEagerlyCompiledIR takes ownership of the module */
554  }
555 #elif LLVM_VERSION_MAJOR > 4
556  {
557  LLVMSharedModuleRef smod;
558 
559  smod = LLVMOrcMakeSharedModule(context->module);
560  if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &orc_handle, smod,
561  llvm_resolve_symbol, NULL))
562  {
563  elog(ERROR, "failed to JIT module");
564  }
565  LLVMOrcDisposeSharedModuleRef(smod);
566  }
567 #else /* LLVM 4.0 and 3.9 */
568  {
569  orc_handle = LLVMOrcAddEagerlyCompiledIR(compile_orc, context->module,
570  llvm_resolve_symbol, NULL);
571  LLVMDisposeModule(context->module);
572  }
573 #endif
574  INSTR_TIME_SET_CURRENT(endtime);
575  INSTR_TIME_ACCUM_DIFF(context->base.instr.emission_counter,
576  endtime, starttime);
577 
578  context->module = NULL;
579  context->compiled = true;
580 
581  /* remember emitted code for cleanup and lookups */
583  {
584  LLVMJitHandle *handle;
585 
586  handle = (LLVMJitHandle *) palloc(sizeof(LLVMJitHandle));
587  handle->stack = compile_orc;
588  handle->orc_handle = orc_handle;
589 
590  context->handles = lappend(context->handles, handle);
591  }
592  MemoryContextSwitchTo(oldcontext);
593 
594  ereport(DEBUG1,
595  (errmsg("time to inline: %.3fs, opt: %.3fs, emit: %.3fs",
596  INSTR_TIME_GET_DOUBLE(context->base.instr.inlining_counter),
597  INSTR_TIME_GET_DOUBLE(context->base.instr.optimization_counter),
598  INSTR_TIME_GET_DOUBLE(context->base.instr.emission_counter)),
599  errhidestmt(true),
600  errhidecontext(true)));
601 }
#define DEBUG1
Definition: elog.h:25
int MyProcPid
Definition: globals.c:40
LLVMOrcJITStackRef stack
Definition: llvmjit.c:42
char * psprintf(const char *fmt,...)
Definition: psprintf.c:46
struct timeval instr_time
Definition: instr_time.h:150
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
int errhidestmt(bool hide_stmt)
Definition: elog.c:1142
#define INSTR_TIME_ACCUM_DIFF(x, y, z)
Definition: instr_time.h:182
#define INSTR_TIME_GET_DOUBLE(t)
Definition: instr_time.h:199
#define PGJIT_OPT3
Definition: jit.h:21
void pfree(void *pointer)
Definition: mcxt.c:1056
#define ERROR
Definition: elog.h:43
static uint64_t llvm_resolve_symbol(const char *name, void *ctx)
Definition: llvmjit.c:861
LLVMOrcModuleHandle orc_handle
Definition: llvmjit.c:43
MemoryContext TopMemoryContext
Definition: mcxt.c:44
static LLVMOrcJITStackRef llvm_opt3_orc
Definition: llvmjit.c:93
List * lappend(List *list, void *datum)
Definition: list.c:322
#define PGJIT_INLINE
Definition: jit.h:22
#define ereport(elevel,...)
Definition: elog.h:144
bool jit_dump_bitcode
Definition: jit.c:35
#define INSTR_TIME_SET_CURRENT(t)
Definition: instr_time.h:156
static char * filename
Definition: pg_dumpall.c:90
void llvm_inline(LLVMModuleRef M)
void * palloc(Size size)
Definition: mcxt.c:949
int errmsg(const char *fmt,...)
Definition: elog.c:824
#define elog(elevel,...)
Definition: elog.h:214
static LLVMOrcJITStackRef llvm_opt0_orc
Definition: llvmjit.c:92
static void llvm_optimize_module(LLVMJitContext *context, LLVMModuleRef module)
Definition: llvmjit.c:414
int errhidecontext(bool hide_ctx)
Definition: elog.c:1161

◆ llvm_copy_attributes()

void llvm_copy_attributes ( LLVMValueRef  v_from,
LLVMValueRef  v_to 
)

Definition at line 330 of file llvmjit.c.

References palloc().

Referenced by llvm_compile_expr(), llvm_pg_func(), and slot_compile_deform().

331 {
332  int num_attributes;
333  int attno;
334  LLVMAttributeRef *attrs;
335 
336  num_attributes =
337  LLVMGetAttributeCountAtIndex(v_from, LLVMAttributeFunctionIndex);
338 
339  attrs = palloc(sizeof(LLVMAttributeRef) * num_attributes);
340  LLVMGetAttributesAtIndex(v_from, LLVMAttributeFunctionIndex, attrs);
341 
342  for (attno = 0; attno < num_attributes; attno++)
343  {
344  LLVMAddAttributeAtIndex(v_to, LLVMAttributeFunctionIndex,
345  attrs[attno]);
346  }
347 }
void * palloc(Size size)
Definition: mcxt.c:949

◆ llvm_create_context()

LLVMJitContext* llvm_create_context ( int  jitFlags)

Definition at line 128 of file llvmjit.c.

References CurrentResourceOwner, llvm_assert_in_fatal_section(), llvm_session_initialize(), MemoryContextAllocZero(), PointerGetDatum, ResourceOwnerEnlargeJIT(), ResourceOwnerRememberJIT(), and TopMemoryContext.

Referenced by llvm_compile_expr().

129 {
130  LLVMJitContext *context;
131 
133 
135 
137 
139  sizeof(LLVMJitContext));
140  context->base.flags = jitFlags;
141 
142  /* ensure cleanup */
143  context->base.resowner = CurrentResourceOwner;
145 
146  return context;
147 }
#define PointerGetDatum(X)
Definition: postgres.h:556
ResourceOwner CurrentResourceOwner
Definition: resowner.c:142
void llvm_assert_in_fatal_section(void)
MemoryContext TopMemoryContext
Definition: mcxt.c:44
void ResourceOwnerRememberJIT(ResourceOwner owner, Datum handle)
Definition: resowner.c:1358
void * MemoryContextAllocZero(MemoryContext context, Size size)
Definition: mcxt.c:839
static void llvm_session_initialize(void)
Definition: llvmjit.c:607
void ResourceOwnerEnlargeJIT(ResourceOwner owner)
Definition: resowner.c:1347

◆ llvm_create_types()

static void llvm_create_types ( void  )
static

Definition at line 771 of file llvmjit.c.

References AttributeTemplate, buf, elog, ERROR, llvm_layout, llvm_triple, llvm_types_module, load_return_type(), load_type(), MAXPGPATH, pkglib_path, pstrdup(), snprintf, StructAggState, StructAggStatePerGroupData, StructAggStatePerTransData, StructExprContext, StructExprEvalStep, StructExprState, StructFunctionCallInfoData, StructHeapTupleData, StructHeapTupleTableSlot, StructMemoryContextData, StructMinimalTupleTableSlot, StructNullableDatum, StructTupleDescData, StructTupleTableSlot, TypeParamBool, TypePGFunction, TypeSizeT, and TypeStorageBool.

Referenced by llvm_session_initialize().

772 {
773  char path[MAXPGPATH];
774  LLVMMemoryBufferRef buf;
775  char *msg;
776 
777  snprintf(path, MAXPGPATH, "%s/%s", pkglib_path, "llvmjit_types.bc");
778 
779  /* open file */
780  if (LLVMCreateMemoryBufferWithContentsOfFile(path, &buf, &msg))
781  {
782  elog(ERROR, "LLVMCreateMemoryBufferWithContentsOfFile(%s) failed: %s",
783  path, msg);
784  }
785 
786  /* eagerly load contents, going to need it all */
787  if (LLVMParseBitcode2(buf, &llvm_types_module))
788  {
789  elog(ERROR, "LLVMParseBitcode2 of %s failed", path);
790  }
791  LLVMDisposeMemoryBuffer(buf);
792 
793  /*
794  * Load triple & layout from clang emitted file so we're guaranteed to be
795  * compatible.
796  */
797  llvm_triple = pstrdup(LLVMGetTarget(llvm_types_module));
798  llvm_layout = pstrdup(LLVMGetDataLayoutStr(llvm_types_module));
799 
800  TypeSizeT = load_type(llvm_types_module, "TypeSizeT");
801  TypeParamBool = load_return_type(llvm_types_module, "FunctionReturningBool");
802  TypeStorageBool = load_type(llvm_types_module, "TypeStorageBool");
803  TypePGFunction = load_type(llvm_types_module, "TypePGFunction");
804  StructNullableDatum = load_type(llvm_types_module, "StructNullableDatum");
805  StructExprContext = load_type(llvm_types_module, "StructExprContext");
806  StructExprEvalStep = load_type(llvm_types_module, "StructExprEvalStep");
807  StructExprState = load_type(llvm_types_module, "StructExprState");
808  StructFunctionCallInfoData = load_type(llvm_types_module, "StructFunctionCallInfoData");
809  StructMemoryContextData = load_type(llvm_types_module, "StructMemoryContextData");
810  StructTupleTableSlot = load_type(llvm_types_module, "StructTupleTableSlot");
811  StructHeapTupleTableSlot = load_type(llvm_types_module, "StructHeapTupleTableSlot");
812  StructMinimalTupleTableSlot = load_type(llvm_types_module, "StructMinimalTupleTableSlot");
813  StructHeapTupleData = load_type(llvm_types_module, "StructHeapTupleData");
814  StructTupleDescData = load_type(llvm_types_module, "StructTupleDescData");
815  StructAggState = load_type(llvm_types_module, "StructAggState");
816  StructAggStatePerGroupData = load_type(llvm_types_module, "StructAggStatePerGroupData");
817  StructAggStatePerTransData = load_type(llvm_types_module, "StructAggStatePerTransData");
818 
819  AttributeTemplate = LLVMGetNamedFunction(llvm_types_module, "AttributeTemplate");
820 }
LLVMTypeRef StructFunctionCallInfoData
Definition: llvmjit.c:70
static LLVMTypeRef load_type(LLVMModuleRef mod, const char *name)
Definition: llvmjit.c:721
LLVMTypeRef StructExprEvalStep
Definition: llvmjit.c:72
LLVMTypeRef TypeSizeT
Definition: llvmjit.c:48
LLVMTypeRef StructExprState
Definition: llvmjit.c:73
char * pstrdup(const char *in)
Definition: mcxt.c:1186
LLVMTypeRef StructNullableDatum
Definition: llvmjit.c:52
static const char * llvm_layout
Definition: llvmjit.c:85
LLVMTypeRef StructHeapTupleTableSlot
Definition: llvmjit.c:65
LLVMTypeRef StructAggState
Definition: llvmjit.c:74
static LLVMTypeRef load_return_type(LLVMModuleRef mod, const char *name)
Definition: llvmjit.c:741
static const char * llvm_triple
Definition: llvmjit.c:84
LLVMTypeRef StructHeapTupleData
Definition: llvmjit.c:57
#define ERROR
Definition: elog.h:43
#define MAXPGPATH
static char * buf
Definition: pg_test_fsync.c:67
LLVMTypeRef TypeStorageBool
Definition: llvmjit.c:50
LLVMTypeRef StructMemoryContextData
Definition: llvmjit.c:67
LLVMTypeRef StructExprContext
Definition: llvmjit.c:71
LLVMTypeRef TypePGFunction
Definition: llvmjit.c:51
LLVMTypeRef StructAggStatePerTransData
Definition: llvmjit.c:76
LLVMTypeRef StructMinimalTupleTableSlot
Definition: llvmjit.c:66
LLVMTypeRef StructTupleTableSlot
Definition: llvmjit.c:64
LLVMTypeRef StructTupleDescData
Definition: llvmjit.c:63
LLVMTypeRef TypeParamBool
Definition: llvmjit.c:49
LLVMModuleRef llvm_types_module
Definition: llvmjit.c:80
#define elog(elevel,...)
Definition: elog.h:214
LLVMValueRef AttributeTemplate
Definition: llvmjit.c:78
#define snprintf
Definition: port.h:193
char pkglib_path[MAXPGPATH]
Definition: globals.c:73
LLVMTypeRef StructAggStatePerGroupData
Definition: llvmjit.c:75

◆ llvm_expand_funcname()

char* llvm_expand_funcname ( struct LLVMJitContext *  context,
const char *  basename 
)

Definition at line 214 of file llvmjit.c.

References Assert, and psprintf().

Referenced by llvm_compile_expr(), and slot_compile_deform().

215 {
216  Assert(context->module != NULL);
217 
218  context->base.instr.created_functions++;
219 
220  /*
221  * Previously we used dots to separate, but turns out some tools, e.g.
222  * GDB, don't like that and truncate name.
223  */
224  return psprintf("%s_%zu_%d",
225  basename,
226  context->module_generation,
227  context->counter++);
228 }
char * psprintf(const char *fmt,...)
Definition: psprintf.c:46
#define Assert(condition)
Definition: c.h:738

◆ llvm_function_reference()

LLVMValueRef llvm_function_reference ( LLVMJitContext *  context,
LLVMBuilderRef  builder,
LLVMModuleRef  mod,
FunctionCallInfo  fcinfo 
)

Definition at line 353 of file llvmjit.c.

References FunctionCallInfoBaseData::flinfo, fmgr_symbol(), FmgrInfo::fn_addr, FmgrInfo::fn_oid, psprintf(), and TypePGFunction.

Referenced by BuildV1Call(), and llvm_compile_expr().

357 {
358  char *modname;
359  char *basename;
360  char *funcname;
361 
362  LLVMValueRef v_fn;
363 
364  fmgr_symbol(fcinfo->flinfo->fn_oid, &modname, &basename);
365 
366  if (modname != NULL && basename != NULL)
367  {
368  /* external function in loadable library */
369  funcname = psprintf("pgextern.%s.%s", modname, basename);
370  }
371  else if (basename != NULL)
372  {
373  /* internal function */
374  funcname = psprintf("%s", basename);
375  }
376  else
377  {
378  /*
379  * Function we don't know to handle, return pointer. We do so by
380  * creating a global constant containing a pointer to the function.
381  * Makes IR more readable.
382  */
383  LLVMValueRef v_fn_addr;
384 
385  funcname = psprintf("pgoidextern.%u",
386  fcinfo->flinfo->fn_oid);
387  v_fn = LLVMGetNamedGlobal(mod, funcname);
388  if (v_fn != 0)
389  return LLVMBuildLoad(builder, v_fn, "");
390 
391  v_fn_addr = l_ptr_const(fcinfo->flinfo->fn_addr, TypePGFunction);
392 
393  v_fn = LLVMAddGlobal(mod, TypePGFunction, funcname);
394  LLVMSetInitializer(v_fn, v_fn_addr);
395  LLVMSetGlobalConstant(v_fn, true);
396 
397  return LLVMBuildLoad(builder, v_fn, "");
398  }
399 
400  /* check if function already has been added */
401  v_fn = LLVMGetNamedFunction(mod, funcname);
402  if (v_fn != 0)
403  return v_fn;
404 
405  v_fn = LLVMAddFunction(mod, funcname, LLVMGetElementType(TypePGFunction));
406 
407  return v_fn;
408 }
PGFunction fn_addr
Definition: fmgr.h:58
char * psprintf(const char *fmt,...)
Definition: psprintf.c:46
void fmgr_symbol(Oid functionId, char **mod, char **fn)
Definition: fmgr.c:283
LLVMTypeRef TypePGFunction
Definition: llvmjit.c:51
FmgrInfo * flinfo
Definition: fmgr.h:87
Oid fn_oid
Definition: fmgr.h:59

◆ llvm_get_function()

void* llvm_get_function ( LLVMJitContext *  context,
const char *  funcname 
)

Definition at line 235 of file llvmjit.c.

References elog, ERROR, lfirst, llvm_assert_in_fatal_section(), llvm_compile_module(), llvm_opt0_orc, llvm_opt3_orc, LLVMJitHandle::orc_handle, and LLVMJitHandle::stack.

Referenced by ExecRunCompiledExpr().

236 {
237  LLVMOrcTargetAddress addr = 0;
238 #if defined(HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN) && HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN
239  ListCell *lc;
240 #endif
241 
243 
244  /*
245  * If there is a pending / not emitted module, compile and emit now.
246  * Otherwise we might not find the [correct] function.
247  */
248  if (!context->compiled)
249  {
250  llvm_compile_module(context);
251  }
252 
253  /*
254  * ORC's symbol table is of *unmangled* symbols. Therefore we don't need
255  * to mangle here.
256  */
257 
258 #if defined(HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN) && HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN
259  foreach(lc, context->handles)
260  {
261  LLVMJitHandle *handle = (LLVMJitHandle *) lfirst(lc);
262 
263  addr = 0;
264  if (LLVMOrcGetSymbolAddressIn(handle->stack, &addr, handle->orc_handle, funcname))
265  elog(ERROR, "failed to look up symbol \"%s\"", funcname);
266  if (addr)
267  return (void *) (uintptr_t) addr;
268  }
269 
270 #else
271 
272 #if LLVM_VERSION_MAJOR < 5
273  if ((addr = LLVMOrcGetSymbolAddress(llvm_opt0_orc, funcname)))
274  return (void *) (uintptr_t) addr;
275  if ((addr = LLVMOrcGetSymbolAddress(llvm_opt3_orc, funcname)))
276  return (void *) (uintptr_t) addr;
277 #else
278  if (LLVMOrcGetSymbolAddress(llvm_opt0_orc, &addr, funcname))
279  elog(ERROR, "failed to look up symbol \"%s\"", funcname);
280  if (addr)
281  return (void *) (uintptr_t) addr;
282  if (LLVMOrcGetSymbolAddress(llvm_opt3_orc, &addr, funcname))
283  elog(ERROR, "failed to look up symbol \"%s\"", funcname);
284  if (addr)
285  return (void *) (uintptr_t) addr;
286 #endif /* LLVM_VERSION_MAJOR */
287 
288 #endif /* HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN */
289 
290  elog(ERROR, "failed to JIT: %s", funcname);
291 
292  return NULL;
293 }
static void llvm_compile_module(LLVMJitContext *context)
Definition: llvmjit.c:485
LLVMOrcJITStackRef stack
Definition: llvmjit.c:42
#define ERROR
Definition: elog.h:43
LLVMOrcModuleHandle orc_handle
Definition: llvmjit.c:43
void llvm_assert_in_fatal_section(void)
static LLVMOrcJITStackRef llvm_opt3_orc
Definition: llvmjit.c:93
#define lfirst(lc)
Definition: pg_list.h:190
#define elog(elevel,...)
Definition: elog.h:214
static LLVMOrcJITStackRef llvm_opt0_orc
Definition: llvmjit.c:92

◆ llvm_mutable_module()

LLVMModuleRef llvm_mutable_module ( LLVMJitContext *  context)

Definition at line 189 of file llvmjit.c.

References llvm_assert_in_fatal_section(), llvm_generation, llvm_layout, and llvm_triple.

Referenced by llvm_compile_expr(), and slot_compile_deform().

190 {
192 
193  /*
194  * If there's no in-progress module, create a new one.
195  */
196  if (!context->module)
197  {
198  context->compiled = false;
199  context->module_generation = llvm_generation++;
200  context->module = LLVMModuleCreateWithName("pg");
201  LLVMSetTarget(context->module, llvm_triple);
202  LLVMSetDataLayout(context->module, llvm_layout);
203  }
204 
205  return context->module;
206 }
static const char * llvm_layout
Definition: llvmjit.c:85
static const char * llvm_triple
Definition: llvmjit.c:84
void llvm_assert_in_fatal_section(void)
static size_t llvm_generation
Definition: llvmjit.c:83

◆ llvm_optimize_module()

static void llvm_optimize_module ( LLVMJitContext *  context,
LLVMModuleRef  module 
)
static

Definition at line 414 of file llvmjit.c.

References PGJIT_INLINE, and PGJIT_OPT3.

Referenced by llvm_compile_module().

415 {
416  LLVMPassManagerBuilderRef llvm_pmb;
417  LLVMPassManagerRef llvm_mpm;
418  LLVMPassManagerRef llvm_fpm;
419  LLVMValueRef func;
420  int compile_optlevel;
421 
422  if (context->base.flags & PGJIT_OPT3)
423  compile_optlevel = 3;
424  else
425  compile_optlevel = 0;
426 
427  /*
428  * Have to create a new pass manager builder every pass through, as the
429  * inliner has some per-builder state. Otherwise one ends up only inlining
430  * a function the first time though.
431  */
432  llvm_pmb = LLVMPassManagerBuilderCreate();
433  LLVMPassManagerBuilderSetOptLevel(llvm_pmb, compile_optlevel);
434  llvm_fpm = LLVMCreateFunctionPassManagerForModule(module);
435 
436  if (context->base.flags & PGJIT_OPT3)
437  {
438  /* TODO: Unscientifically determined threshold */
439  LLVMPassManagerBuilderUseInlinerWithThreshold(llvm_pmb, 512);
440  }
441  else
442  {
443  /* we rely on mem2reg heavily, so emit even in the O0 case */
444  LLVMAddPromoteMemoryToRegisterPass(llvm_fpm);
445  }
446 
447  LLVMPassManagerBuilderPopulateFunctionPassManager(llvm_pmb, llvm_fpm);
448 
449  /*
450  * Do function level optimization. This could be moved to the point where
451  * functions are emitted, to reduce memory usage a bit.
452  */
453  LLVMInitializeFunctionPassManager(llvm_fpm);
454  for (func = LLVMGetFirstFunction(context->module);
455  func != NULL;
456  func = LLVMGetNextFunction(func))
457  LLVMRunFunctionPassManager(llvm_fpm, func);
458  LLVMFinalizeFunctionPassManager(llvm_fpm);
459  LLVMDisposePassManager(llvm_fpm);
460 
461  /*
462  * Perform module level optimization. We do so even in the non-optimized
463  * case, so always-inline functions etc get inlined. It's cheap enough.
464  */
465  llvm_mpm = LLVMCreatePassManager();
466  LLVMPassManagerBuilderPopulateModulePassManager(llvm_pmb,
467  llvm_mpm);
468  /* always use always-inliner pass */
469  if (!(context->base.flags & PGJIT_OPT3))
470  LLVMAddAlwaysInlinerPass(llvm_mpm);
471  /* if doing inlining, but no expensive optimization, add inlining pass */
472  if (context->base.flags & PGJIT_INLINE
473  && !(context->base.flags & PGJIT_OPT3))
474  LLVMAddFunctionInliningPass(llvm_mpm);
475  LLVMRunPassManager(llvm_mpm, context->module);
476  LLVMDisposePassManager(llvm_mpm);
477 
478  LLVMPassManagerBuilderDispose(llvm_pmb);
479 }
#define PGJIT_OPT3
Definition: jit.h:21
#define PGJIT_INLINE
Definition: jit.h:22

◆ llvm_pg_func()

LLVMValueRef llvm_pg_func ( LLVMModuleRef  mod,
const char *  funcname 
)

Definition at line 303 of file llvmjit.c.

References elog, ERROR, llvm_copy_attributes(), and llvm_types_module.

Referenced by build_EvalXFuncInt(), llvm_compile_expr(), and slot_compile_deform().

304 {
305  LLVMValueRef v_srcfn;
306  LLVMValueRef v_fn;
307 
308  /* don't repeatedly add function */
309  v_fn = LLVMGetNamedFunction(mod, funcname);
310  if (v_fn)
311  return v_fn;
312 
313  v_srcfn = LLVMGetNamedFunction(llvm_types_module, funcname);
314 
315  if (!v_srcfn)
316  elog(ERROR, "function %s not in llvmjit_types.c", funcname);
317 
318  v_fn = LLVMAddFunction(mod,
319  funcname,
320  LLVMGetElementType(LLVMTypeOf(v_srcfn)));
321  llvm_copy_attributes(v_srcfn, v_fn);
322 
323  return v_fn;
324 }
#define ERROR
Definition: elog.h:43
LLVMModuleRef llvm_types_module
Definition: llvmjit.c:80
#define elog(elevel,...)
Definition: elog.h:214
void llvm_copy_attributes(LLVMValueRef v_from, LLVMValueRef v_to)
Definition: llvmjit.c:330

◆ llvm_release_context()

static void llvm_release_context ( JitContext context)
static

Definition at line 153 of file llvmjit.c.

References linitial, list_delete_first(), llvm_enter_fatal_on_oom(), NIL, LLVMJitHandle::orc_handle, pfree(), proc_exit_inprogress, and LLVMJitHandle::stack.

Referenced by _PG_jit_provider_init().

154 {
155  LLVMJitContext *llvm_context = (LLVMJitContext *) context;
156 
158 
159  /*
160  * When this backend is exiting, don't clean up LLVM. As an error might
161  * have occurred from within LLVM, we do not want to risk reentering. All
162  * resource cleanup is going to happen through process exit.
163  */
165  {
166  if (llvm_context->module)
167  {
168  LLVMDisposeModule(llvm_context->module);
169  llvm_context->module = NULL;
170  }
171 
172  while (llvm_context->handles != NIL)
173  {
174  LLVMJitHandle *jit_handle;
175 
176  jit_handle = (LLVMJitHandle *) linitial(llvm_context->handles);
177  llvm_context->handles = list_delete_first(llvm_context->handles);
178 
179  LLVMOrcRemoveModule(jit_handle->stack, jit_handle->orc_handle);
180  pfree(jit_handle);
181  }
182  }
183 }
#define NIL
Definition: pg_list.h:65
LLVMOrcJITStackRef stack
Definition: llvmjit.c:42
void pfree(void *pointer)
Definition: mcxt.c:1056
#define linitial(l)
Definition: pg_list.h:195
LLVMOrcModuleHandle orc_handle
Definition: llvmjit.c:43
bool proc_exit_inprogress
Definition: ipc.c:40
void llvm_enter_fatal_on_oom(void)
List * list_delete_first(List *list)
Definition: list.c:861

◆ llvm_resolve_symbol()

static uint64_t llvm_resolve_symbol ( const char *  name,
void *  ctx 
)
static

Definition at line 861 of file llvmjit.c.

References Assert, elog, ERROR, llvm_split_symbol_name(), load_external_function(), pfree(), and WARNING.

Referenced by llvm_compile_module().

862 {
863  uintptr_t addr;
864  char *funcname;
865  char *modname;
866 
867  /*
868  * macOS prefixes all object level symbols with an underscore. But neither
869  * dlsym() nor PG's inliner expect that. So undo.
870  */
871 #if defined(__darwin__)
872  if (symname[0] != '_')
873  elog(ERROR, "expected prefixed symbol name, but got \"%s\"", symname);
874  symname++;
875 #endif
876 
877  llvm_split_symbol_name(symname, &modname, &funcname);
878 
879  /* functions that aren't resolved to names shouldn't ever get here */
880  Assert(funcname);
881 
882  if (modname)
883  addr = (uintptr_t) load_external_function(modname, funcname,
884  true, NULL);
885  else
886  addr = (uintptr_t) LLVMSearchForAddressOfSymbol(symname);
887 
888  pfree(funcname);
889  if (modname)
890  pfree(modname);
891 
892  /* let LLVM will error out - should never happen */
893  if (!addr)
894  elog(WARNING, "failed to resolve name %s", symname);
895 
896  return (uint64_t) addr;
897 }
void llvm_split_symbol_name(const char *name, char **modname, char **funcname)
Definition: llvmjit.c:827
void pfree(void *pointer)
Definition: mcxt.c:1056
#define ERROR
Definition: elog.h:43
PGFunction load_external_function(const char *filename, const char *funcname, bool signalNotFound, void **filehandle)
Definition: dfmgr.c:107
#define WARNING
Definition: elog.h:40
#define Assert(condition)
Definition: c.h:738
#define elog(elevel,...)
Definition: elog.h:214

◆ llvm_session_initialize()

static void llvm_session_initialize ( void  )
static

Definition at line 607 of file llvmjit.c.

References before_shmem_exit(), DEBUG2, elog, error(), FATAL, jit_debugging_support, jit_profiling_support, llvm_create_types(), llvm_opt0_orc, llvm_opt0_targetmachine, llvm_opt3_orc, llvm_opt3_targetmachine, llvm_session_initialized, llvm_shutdown(), llvm_targetref, llvm_triple, MemoryContextSwitchTo(), and TopMemoryContext.

Referenced by llvm_create_context().

608 {
609  MemoryContext oldcontext;
610  char *error = NULL;
611  char *cpu = NULL;
612  char *features = NULL;
613 
615  return;
616 
618 
619  LLVMInitializeNativeTarget();
620  LLVMInitializeNativeAsmPrinter();
621  LLVMInitializeNativeAsmParser();
622 
623  /*
624  * Synchronize types early, as that also includes inferring the target
625  * triple.
626  */
628 
629  if (LLVMGetTargetFromTriple(llvm_triple, &llvm_targetref, &error) != 0)
630  {
631  elog(FATAL, "failed to query triple %s\n", error);
632  }
633 
634  /*
635  * We want the generated code to use all available features. Therefore
636  * grab the host CPU string and detect features of the current CPU. The
637  * latter is needed because some CPU architectures default to enabling
638  * features not all CPUs have (weird, huh).
639  */
640  cpu = LLVMGetHostCPUName();
641  features = LLVMGetHostCPUFeatures();
642  elog(DEBUG2, "LLVMJIT detected CPU \"%s\", with features \"%s\"",
643  cpu, features);
644 
646  LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features,
647  LLVMCodeGenLevelNone,
648  LLVMRelocDefault,
649  LLVMCodeModelJITDefault);
651  LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features,
652  LLVMCodeGenLevelAggressive,
653  LLVMRelocDefault,
654  LLVMCodeModelJITDefault);
655 
656  LLVMDisposeMessage(cpu);
657  cpu = NULL;
658  LLVMDisposeMessage(features);
659  features = NULL;
660 
661  /* force symbols in main binary to be loaded */
662  LLVMLoadLibraryPermanently(NULL);
663 
664  llvm_opt0_orc = LLVMOrcCreateInstance(llvm_opt0_targetmachine);
665  llvm_opt3_orc = LLVMOrcCreateInstance(llvm_opt3_targetmachine);
666 
667 #if defined(HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER) && HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER
669  {
670  LLVMJITEventListenerRef l = LLVMCreateGDBRegistrationListener();
671 
672  LLVMOrcRegisterJITEventListener(llvm_opt0_orc, l);
673  LLVMOrcRegisterJITEventListener(llvm_opt3_orc, l);
674  }
675 #endif
676 #if defined(HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER) && HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER
678  {
679  LLVMJITEventListenerRef l = LLVMCreatePerfJITEventListener();
680 
681  LLVMOrcRegisterJITEventListener(llvm_opt0_orc, l);
682  LLVMOrcRegisterJITEventListener(llvm_opt3_orc, l);
683  }
684 #endif
685 
687 
689 
690  MemoryContextSwitchTo(oldcontext);
691 }
static void error(void)
Definition: sql-dyntest.c:147
static LLVMTargetMachineRef llvm_opt3_targetmachine
Definition: llvmjit.c:89
bool jit_debugging_support
Definition: jit.c:34
static void llvm_shutdown(int code, Datum arg)
Definition: llvmjit.c:694
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
static const char * llvm_triple
Definition: llvmjit.c:84
#define FATAL
Definition: elog.h:52
#define DEBUG2
Definition: elog.h:24
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
Definition: ipc.c:333
MemoryContext TopMemoryContext
Definition: mcxt.c:44
static LLVMOrcJITStackRef llvm_opt3_orc
Definition: llvmjit.c:93
static bool llvm_session_initialized
Definition: llvmjit.c:82
static LLVMTargetRef llvm_targetref
Definition: llvmjit.c:91
bool jit_profiling_support
Definition: jit.c:37
static void llvm_create_types(void)
Definition: llvmjit.c:771
static LLVMTargetMachineRef llvm_opt0_targetmachine
Definition: llvmjit.c:88
#define elog(elevel,...)
Definition: elog.h:214
static LLVMOrcJITStackRef llvm_opt0_orc
Definition: llvmjit.c:92

◆ llvm_shutdown()

static void llvm_shutdown ( int  code,
Datum  arg 
)
static

Definition at line 694 of file llvmjit.c.

References jit_profiling_support, llvm_opt0_orc, and llvm_opt3_orc.

Referenced by llvm_session_initialize().

695 {
696  /* unregister profiling support, needs to be flushed to be useful */
697 
698  if (llvm_opt3_orc)
699  {
700 #if defined(HAVE_DECL_LLVMORCREGISTERPERF) && HAVE_DECL_LLVMORCREGISTERPERF
702  LLVMOrcUnregisterPerf(llvm_opt3_orc);
703 #endif
704  LLVMOrcDisposeInstance(llvm_opt3_orc);
705  llvm_opt3_orc = NULL;
706  }
707 
708  if (llvm_opt0_orc)
709  {
710 #if defined(HAVE_DECL_LLVMORCREGISTERPERF) && HAVE_DECL_LLVMORCREGISTERPERF
712  LLVMOrcUnregisterPerf(llvm_opt0_orc);
713 #endif
714  LLVMOrcDisposeInstance(llvm_opt0_orc);
715  llvm_opt0_orc = NULL;
716  }
717 }
static LLVMOrcJITStackRef llvm_opt3_orc
Definition: llvmjit.c:93
bool jit_profiling_support
Definition: jit.c:37
static LLVMOrcJITStackRef llvm_opt0_orc
Definition: llvmjit.c:92

◆ llvm_split_symbol_name()

void llvm_split_symbol_name ( const char *  name,
char **  modname,
char **  funcname 
)

Definition at line 827 of file llvmjit.c.

References Assert, pnstrdup(), and pstrdup().

Referenced by llvm_build_inline_plan(), llvm_execute_inline_plan(), and llvm_resolve_symbol().

828 {
829  *modname = NULL;
830  *funcname = NULL;
831 
832  /*
833  * Module function names are pgextern.$module.$funcname
834  */
835  if (strncmp(name, "pgextern.", strlen("pgextern.")) == 0)
836  {
837  /*
838  * Symbol names cannot contain a ., therefore we can split based on
839  * first and last occurrence of one.
840  */
841  *funcname = rindex(name, '.');
842  (*funcname)++; /* jump over . */
843 
844  *modname = pnstrdup(name + strlen("pgextern."),
845  *funcname - name - strlen("pgextern.") - 1);
846  Assert(funcname);
847 
848  *funcname = pstrdup(*funcname);
849  }
850  else
851  {
852  *modname = NULL;
853  *funcname = pstrdup(name);
854  }
855 }
char * pnstrdup(const char *in, Size len)
Definition: mcxt.c:1197
char * pstrdup(const char *in)
Definition: mcxt.c:1186
#define Assert(condition)
Definition: c.h:738
const char * name
Definition: encode.c:521

◆ load_return_type()

static LLVMTypeRef load_return_type ( LLVMModuleRef  mod,
const char *  name 
)
static

Definition at line 741 of file llvmjit.c.

References Assert, elog, ERROR, and value.

Referenced by llvm_create_types().

742 {
743  LLVMValueRef value;
744  LLVMTypeRef typ;
745 
746  /* this'll return a *pointer* to the function */
747  value = LLVMGetNamedFunction(mod, name);
748  if (!value)
749  elog(ERROR, "function %s is unknown", name);
750 
751  /* get type of function pointer */
752  typ = LLVMTypeOf(value);
753  Assert(typ != NULL);
754  /* dereference pointer */
755  typ = LLVMGetElementType(typ);
756  Assert(typ != NULL);
757  /* and look at return type */
758  typ = LLVMGetReturnType(typ);
759  Assert(typ != NULL);
760 
761  return typ;
762 }
#define ERROR
Definition: elog.h:43
static struct @143 value
#define Assert(condition)
Definition: c.h:738
const char * name
Definition: encode.c:521
#define elog(elevel,...)
Definition: elog.h:214

◆ load_type()

static LLVMTypeRef load_type ( LLVMModuleRef  mod,
const char *  name 
)
static

Definition at line 721 of file llvmjit.c.

References Assert, elog, ERROR, and value.

Referenced by llvm_create_types().

722 {
723  LLVMValueRef value;
724  LLVMTypeRef typ;
725 
726  /* this'll return a *pointer* to the global */
727  value = LLVMGetNamedGlobal(mod, name);
728  if (!value)
729  elog(ERROR, "type %s is unknown", name);
730 
731  /* therefore look at the contained type and return that */
732  typ = LLVMTypeOf(value);
733  Assert(typ != NULL);
734  typ = LLVMGetElementType(typ);
735  Assert(typ != NULL);
736  return typ;
737 }
#define ERROR
Definition: elog.h:43
static struct @143 value
#define Assert(condition)
Definition: c.h:738
const char * name
Definition: encode.c:521
#define elog(elevel,...)
Definition: elog.h:214

Variable Documentation

◆ AttributeTemplate

Datum AttributeTemplate

Definition at line 78 of file llvmjit.c.

Referenced by llvm_compile_expr(), llvm_create_types(), and slot_compile_deform().

◆ llvm_generation

size_t llvm_generation = 0
static

Definition at line 83 of file llvmjit.c.

Referenced by llvm_mutable_module().

◆ llvm_layout

const char* llvm_layout = NULL
static

Definition at line 85 of file llvmjit.c.

Referenced by llvm_create_types(), and llvm_mutable_module().

◆ llvm_opt0_orc

LLVMOrcJITStackRef llvm_opt0_orc
static

◆ llvm_opt0_targetmachine

LLVMTargetMachineRef llvm_opt0_targetmachine
static

Definition at line 88 of file llvmjit.c.

Referenced by llvm_session_initialize().

◆ llvm_opt3_orc

LLVMOrcJITStackRef llvm_opt3_orc
static

◆ llvm_opt3_targetmachine

LLVMTargetMachineRef llvm_opt3_targetmachine
static

Definition at line 89 of file llvmjit.c.

Referenced by llvm_session_initialize().

◆ llvm_session_initialized

bool llvm_session_initialized = false
static

Definition at line 82 of file llvmjit.c.

Referenced by llvm_session_initialize().

◆ llvm_targetref

LLVMTargetRef llvm_targetref
static

Definition at line 91 of file llvmjit.c.

Referenced by llvm_session_initialize().

◆ llvm_triple

const char* llvm_triple = NULL
static

Definition at line 84 of file llvmjit.c.

Referenced by llvm_create_types(), llvm_mutable_module(), and llvm_session_initialize().

◆ llvm_types_module

LLVMModuleRef llvm_types_module = NULL

Definition at line 80 of file llvmjit.c.

Referenced by llvm_create_types(), and llvm_pg_func().

◆ PG_MODULE_MAGIC

PG_MODULE_MAGIC

Definition at line 106 of file llvmjit.c.

◆ StructAggState

LLVMTypeRef StructAggState

Definition at line 74 of file llvmjit.c.

Referenced by llvm_compile_expr(), and llvm_create_types().

◆ StructAggStatePerGroupData

LLVMTypeRef StructAggStatePerGroupData

Definition at line 75 of file llvmjit.c.

Referenced by llvm_create_types().

◆ StructAggStatePerTransData

LLVMTypeRef StructAggStatePerTransData

Definition at line 76 of file llvmjit.c.

Referenced by llvm_compile_expr(), and llvm_create_types().

◆ StructBlockId

LLVMTypeRef StructBlockId

Definition at line 60 of file llvmjit.c.

◆ StructExprContext

LLVMTypeRef StructExprContext

Definition at line 71 of file llvmjit.c.

Referenced by llvm_compile_expr(), and llvm_create_types().

◆ StructExprEvalStep

LLVMTypeRef StructExprEvalStep

Definition at line 72 of file llvmjit.c.

Referenced by build_EvalXFuncInt(), and llvm_create_types().

◆ StructExprState

LLVMTypeRef StructExprState

Definition at line 73 of file llvmjit.c.

Referenced by llvm_compile_expr(), and llvm_create_types().

◆ StructFmgrInfo

LLVMTypeRef StructFmgrInfo

Definition at line 69 of file llvmjit.c.

◆ StructFormPgAttribute

LLVMTypeRef StructFormPgAttribute

Definition at line 61 of file llvmjit.c.

◆ StructFunctionCallInfoData

LLVMTypeRef StructFunctionCallInfoData

Definition at line 70 of file llvmjit.c.

Referenced by BuildV1Call(), llvm_compile_expr(), and llvm_create_types().

◆ StructHeapTupleData

LLVMTypeRef StructHeapTupleData

Definition at line 57 of file llvmjit.c.

Referenced by llvm_create_types().

◆ StructHeapTupleDataChoice

LLVMTypeRef StructHeapTupleDataChoice

Definition at line 56 of file llvmjit.c.

◆ StructHeapTupleFields

LLVMTypeRef StructHeapTupleFields

Definition at line 54 of file llvmjit.c.

◆ StructHeapTupleFieldsField3

LLVMTypeRef StructHeapTupleFieldsField3

Definition at line 53 of file llvmjit.c.

◆ StructHeapTupleHeaderData

LLVMTypeRef StructHeapTupleHeaderData

Definition at line 55 of file llvmjit.c.

◆ StructHeapTupleTableSlot

LLVMTypeRef StructHeapTupleTableSlot

Definition at line 65 of file llvmjit.c.

Referenced by llvm_create_types(), and slot_compile_deform().

◆ StructItemPointerData

LLVMTypeRef StructItemPointerData

Definition at line 59 of file llvmjit.c.

◆ StructMemoryContextData

LLVMTypeRef StructMemoryContextData

Definition at line 67 of file llvmjit.c.

Referenced by llvm_compile_expr(), and llvm_create_types().

◆ StructMinimalTupleData

LLVMTypeRef StructMinimalTupleData

Definition at line 58 of file llvmjit.c.

◆ StructMinimalTupleTableSlot

LLVMTypeRef StructMinimalTupleTableSlot

Definition at line 66 of file llvmjit.c.

Referenced by llvm_create_types(), and slot_compile_deform().

◆ StructNullableDatum

LLVMTypeRef StructNullableDatum

Definition at line 52 of file llvmjit.c.

Referenced by llvm_compile_expr(), and llvm_create_types().

◆ StructPGFinfoRecord

LLVMTypeRef StructPGFinfoRecord

Definition at line 68 of file llvmjit.c.

◆ StructTupleConstr

LLVMTypeRef StructTupleConstr

Definition at line 62 of file llvmjit.c.

◆ StructTupleDescData

LLVMTypeRef StructTupleDescData

Definition at line 63 of file llvmjit.c.

Referenced by llvm_create_types().

◆ StructTupleTableSlot

LLVMTypeRef StructTupleTableSlot

Definition at line 64 of file llvmjit.c.

Referenced by llvm_create_types(), and slot_compile_deform().

◆ TypeParamBool

LLVMTypeRef TypeParamBool

Definition at line 49 of file llvmjit.c.

Referenced by llvm_compile_expr(), and llvm_create_types().

◆ TypePGFunction

LLVMTypeRef TypePGFunction

Definition at line 51 of file llvmjit.c.

Referenced by llvm_create_types(), and llvm_function_reference().

◆ TypeSizeT

LLVMTypeRef TypeSizeT

Definition at line 48 of file llvmjit.c.

Referenced by llvm_compile_expr(), llvm_create_types(), and slot_compile_deform().

◆ TypeStorageBool

LLVMTypeRef TypeStorageBool

Definition at line 50 of file llvmjit.c.

Referenced by llvm_compile_expr(), and llvm_create_types().