PostgreSQL Source Code git master
Loading...
Searching...
No Matches
llvmjit_types.c
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * llvmjit_types.c
4 * List of types needed by JIT emitting code.
5 *
6 * JIT emitting code often needs to access struct elements, create functions
7 * with the correct signature etc. To allow synchronizing these types with a
8 * low chance of definitions getting out of sync, this file lists types and
9 * functions that directly need to be accessed from LLVM.
10 *
11 * When LLVM is first used in a backend, a bitcode version of this file will
12 * be loaded. The needed types and signatures will be stored into Struct*,
13 * Type*, Func* variables.
14 *
15 * NB: This file will not be linked into the server, it's just converted to
16 * bitcode.
17 *
18 *
19 * Copyright (c) 2016-2026, PostgreSQL Global Development Group
20 *
21 * IDENTIFICATION
22 * src/backend/jit/llvm/llvmjit_types.c
23 *
24 *-------------------------------------------------------------------------
25 */
26
27#include "postgres.h"
28
29#include "access/htup.h"
30#include "access/htup_details.h"
31#include "access/tupdesc.h"
33#include "executor/execExpr.h"
34#include "executor/nodeAgg.h"
35#include "executor/tuptable.h"
36#include "fmgr.h"
37#include "nodes/execnodes.h"
38#include "nodes/memnodes.h"
39#include "utils/expandeddatum.h"
40#include "utils/palloc.h"
41
42
43/*
44 * List of types needed for JITing. These have to be non-static, otherwise
45 * clang/LLVM will omit them. As this file will never be linked into
46 * anything, that's harmless.
47 */
49size_t TypeSizeT;
52
55
73
74
75/*
76 * To determine which attributes functions need to have (depends e.g. on
77 * compiler version and settings) to be compatible for inlining, we simply
78 * copy the attributes of this function.
79 */
88
89/*
90 * And some more "templates" to give us examples of function types
91 * corresponding to function pointer types.
92 */
93
95 struct ExprEvalStep *op,
96 ExprContext *econtext);
97void
105
107 struct ExprEvalStep *op,
108 ExprContext *econtext);
109bool
119
120/*
121 * Clang represents bool returned by functions differently (as i1) than stored
122 * ones (as i8). Therefore we do not just need TypeStorageBool (above), but
123 * also a way to determine the width of a returned integer.
124 */
125extern bool FunctionReturningBool(void);
126bool
128{
129 return false;
130}
131
132/*
133 * To force signatures of functions used during JITing to be present,
134 * reference the functions required. This again has to be non-static, to avoid
135 * being removed as unnecessary.
136 */
#define StaticAssertVariableIsOfType(varname, typename)
Definition c.h:974
void ExecEvalParamExtern(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalFieldStoreForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalGroupingFunc(ExprState *state, ExprEvalStep *op)
void ExecEvalRow(ExprState *state, ExprEvalStep *op)
void ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalCurrentOfExpr(ExprState *state, ExprEvalStep *op)
void ExecEvalSQLValueFunction(ExprState *state, ExprEvalStep *op)
void ExecEvalRowNull(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
void ExecEvalParamSet(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalCoerceViaIOSafe(ExprState *state, ExprEvalStep *op)
Datum ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull)
void ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
bool ExecEvalPreOrderedDistinctMulti(AggState *aggstate, AggStatePerTrans pertrans)
void ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
int ExecEvalJsonExprPath(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op)
void ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op)
void ExecEvalAggOrderedTransDatum(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalParamExec(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalJsonCoercion(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, ExprContext *aggcontext)
void ExecEvalNextValueExpr(ExprState *state, ExprEvalStep *op)
void ExecEvalSysVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext, TupleTableSlot *slot)
void ExecEvalMinMax(ExprState *state, ExprEvalStep *op)
void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op)
Datum ExecAggCopyTransValue(AggState *aggstate, AggStatePerTrans pertrans, Datum newValue, bool newValueIsNull, Datum oldValue, bool oldValueIsNull)
void ExecEvalMergeSupportFunc(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalJsonConstructor(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalJsonCoercionFinish(ExprState *state, ExprEvalStep *op)
void ExecEvalRowNotNull(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op)
void ExecEvalArrayCoerce(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalFuncExprFusage(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op)
bool ExecEvalPreOrderedDistinctSingle(AggState *aggstate, AggStatePerTrans pertrans)
void ExecEvalAggOrderedTransTuple(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
bool(* ExecEvalBoolSubroutine)(ExprState *state, struct ExprEvalStep *op, ExprContext *econtext)
Definition execExpr.h:39
void(* ExecEvalSubroutine)(ExprState *state, struct ExprEvalStep *op, ExprContext *econtext)
Definition execExpr.h:34
void slot_getmissingattrs(TupleTableSlot *slot, int startAttNum, int lastAttNum)
void slot_getsomeattrs_int(TupleTableSlot *slot, int attnum)
Datum MakeExpandedObjectReadOnlyInternal(Datum d)
#define PG_RETURN_NULL()
Definition fmgr.h:346
Datum(* PGFunction)(FunctionCallInfo fcinfo)
Definition fmgr.h:40
#define PG_FUNCTION_ARGS
Definition fmgr.h:193
size_t varsize_any(void *p)
Definition heaptuple.c:1609
LLVMValueRef AttributeTemplate
Definition llvmjit.c:79
LLVMValueRef ExecEvalSubroutineTemplate
Definition llvmjit.c:80
LLVMValueRef ExecEvalBoolSubroutineTemplate
Definition llvmjit.c:81
HeapTupleHeaderData StructHeapTupleHeaderData
HeapTupleData StructHeapTupleData
ExprContext StructExprContext
MemoryContextData StructMemoryContextData
TupleTableSlot StructTupleTableSlot
PGFunction TypePGFunction
ExecEvalBoolSubroutine TypeExecEvalBoolSubroutine
bool TypeStorageBool
AggState StructAggState
NullableDatum StructNullableDatum
MinimalTupleData StructMinimalTupleData
FunctionCallInfoBaseData StructFunctionCallInfoData
ExprEvalStep StructExprEvalStep
TupleDescData StructTupleDescData
Datum TypeDatum
AggStatePerTransData StructAggStatePerTransData
MinimalTupleTableSlot StructMinimalTupleTableSlot
void * referenced_functions[]
HeapTupleTableSlot StructHeapTupleTableSlot
ExecEvalSubroutine TypeExecEvalSubroutine
bool FunctionReturningBool(void)
ExprState StructExprState
PlanState StructPlanState
AggStatePerGroupData StructAggStatePerGroupData
size_t TypeSizeT
uint64_t Datum
Definition postgres.h:70
static int fb(int x)