18#include <llvm-c/Core.h>
19#include <llvm-c/Target.h>
68#define build_EvalXFunc(b, mod, funcname, v_state, op, ...) \
69 build_EvalXFuncInt(b, mod, funcname, v_state, op, \
70 lengthof(((LLVMValueRef[]){__VA_ARGS__})), \
71 ((LLVMValueRef[]){__VA_ARGS__}))
292 "v.econtext.aggvalues");
297 "v.econtext.aggnulls");
301 for (
int opno = 0; opno <
state->steps_len; opno++)
307 for (
int opno = 0; opno <
state->steps_len; opno++)
316 op = &
state->steps[opno];
356 "op.%d.fetch", opno);
402 if (tts_ops && desc && (context->base.flags &
PGJIT_DEFORM))
618 "op.%d.assign_tmp.notnull", opno);
685 "b.%d.no-null-args", opno);
689 elog(
ERROR,
"argumentless strict functions are pointless");
784 "b.%d.boolisnull", opno);
786 "b.%d.boolcheckfalse", opno);
788 "b.%d.boolisfalse", opno);
790 "b.%d.boolisanynull", opno);
792 "b.%d.boolcont", opno);
876 "b.%d.boolisnull", opno);
878 "b.%d.boolchecktrue", opno);
880 "b.%d.boolistrue", opno);
882 "b.%d.boolisanynull", opno);
884 "b.%d.boolcont", opno);
978 "op.%d.qualfail", opno);
1132 "op.%d.isnull", opno);
1134 "op.%d.isnotnull", opno);
1328 "op.%d.readonly.notnull", opno);
1389 "op.%d.skipoutputnull", opno);
1391 "op.%d.calloutput", opno);
1393 "op.%d.input", opno);
1395 "op.%d.inputcall", opno);
1407 "v_fcinfo_in_isnull");
1435 1,
"funccall_coerce_out");
1492 "funccall_iocoerce_in");
1623 "b.%d.null-args", opno);
1625 "b.%d.no-null-args", opno);
1627 "b.%d.argsequal", opno);
1734 "op.%d.row.isnull", opno);
1794 "op.%d.row-null", opno);
1796 "op.%d.row-compare", opno);
1799 "op.%d.row-compare-result",
2087 if (fcinfo->
nargs != 1)
2088 elog(
ERROR,
"incorrect number of function arguments");
2094 "b.%d.isnull.0", opno);
2292 "op.%d.jsonexpr_empty", opno);
2295 "op.%d.jsonexpr_error", opno);
2298 "op.%d.jsonexpr_coercion", opno);
2301 "op.%d.jsonexpr_done", opno);
2453 "op.%d.deserialize", opno);
2513 "op.%d.check-null.%d",
2528 if (
argno + 1 == nargs)
2579 "aggstate.all_pergroups");
2651 "aggstate.all_pergroups");
2677 "op.%d.inittrans", opno);
2679 "op.%d.no_inittrans", opno);
2722 "op.%d.strictpass", opno);
2750 "aggstate.current_set");
2756 "aggstate.curaggcontext");
2762 "aggstate.curpertrans");
2825 "op.%d.transcall", opno);
2827 "op.%d.transnocall", opno);
2965 state->evalfunc_private = cstate;
3000 state->evalfunc = func;
3002 return func(
state, econtext, isNull);
3068 elog(
ERROR,
"parameter mismatch: %s expects %d passed %d",
3076 for (
int i = 0;
i < nargs;
i++)
3095 const char *
nm =
"llvm.lifetime.end.p0";
#define Assert(condition)
void CheckExprStillValid(ExprState *state, ExprContext *econtext)
ExprEvalOp ExecEvalStepOp(ExprState *state, ExprEvalStep *op)
@ EEOP_FUNCEXPR_STRICT_FUSAGE
@ EEOP_HASHDATUM_NEXT32_STRICT
@ EEOP_JSONEXPR_COERCION_FINISH
@ EEOP_HASHDATUM_FIRST_STRICT
@ EEOP_AGG_PLAIN_PERGROUP_NULLCHECK
@ EEOP_AGG_STRICT_DESERIALIZE
@ EEOP_BOOLTEST_IS_NOT_FALSE
@ EEOP_AGG_PLAIN_TRANS_BYREF
@ EEOP_AGG_PRESORTED_DISTINCT_MULTI
@ EEOP_AGG_PLAIN_TRANS_BYVAL
@ EEOP_NULLTEST_ROWISNOTNULL
@ EEOP_ASSIGN_TMP_MAKE_RO
@ EEOP_BOOL_OR_STEP_FIRST
@ EEOP_AGG_STRICT_INPUT_CHECK_NULLS
@ EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1
@ EEOP_AGG_STRICT_INPUT_CHECK_ARGS
@ EEOP_NULLTEST_ROWISNULL
@ EEOP_NULLTEST_ISNOTNULL
@ EEOP_MERGE_SUPPORT_FUNC
@ EEOP_AGG_PRESORTED_DISTINCT_SINGLE
@ EEOP_BOOL_AND_STEP_FIRST
@ EEOP_DOMAIN_TESTVAL_EXT
@ EEOP_BOOL_AND_STEP_LAST
@ EEOP_AGG_ORDERED_TRANS_DATUM
@ EEOP_HASHDATUM_SET_INITVAL
@ EEOP_AGG_PLAIN_TRANS_STRICT_BYREF
@ EEOP_BOOLTEST_IS_NOT_TRUE
@ EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL
@ EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL
@ EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF
@ EEOP_HASHED_SCALARARRAYOP
@ EEOP_AGG_ORDERED_TRANS_TUPLE
const TupleTableSlotOps TTSOpsVirtual
Datum(* ExprStateEvalFunc)(ExprState *expression, ExprContext *econtext, bool *isNull)
#define FIELDNO_EXPRSTATE_RESULTSLOT
#define FIELDNO_EXPRCONTEXT_CASENULL
#define FIELDNO_EXPRCONTEXT_INNERTUPLE
#define FIELDNO_EXPRSTATE_FLAGS
#define FIELDNO_EXPRCONTEXT_DOMAINNULL
#define FIELDNO_EXPRCONTEXT_DOMAINDATUM
#define FIELDNO_EXPRCONTEXT_CASEDATUM
#define FIELDNO_EXPRCONTEXT_OLDTUPLE
#define FIELDNO_AGGSTATE_CURPERTRANS
#define FIELDNO_EXPRSTATE_RESNULL
#define FIELDNO_EXPRCONTEXT_NEWTUPLE
#define FIELDNO_EXPRCONTEXT_AGGNULLS
#define FIELDNO_EXPRSTATE_RESVALUE
#define FIELDNO_AGGSTATE_CURRENT_SET
#define FIELDNO_EXPRCONTEXT_AGGVALUES
#define FIELDNO_EXPRCONTEXT_OUTERTUPLE
#define FIELDNO_AGGSTATE_ALL_PERGROUPS
#define FIELDNO_EXPRSTATE_PARENT
#define FIELDNO_EXPRCONTEXT_SCANTUPLE
#define FIELDNO_AGGSTATE_CURAGGCONTEXT
#define palloc_array(type, count)
#define palloc0_object(type)
#define FIELDNO_FUNCTIONCALLINFODATA_ISNULL
#define INSTR_TIME_SET_CURRENT(t)
#define INSTR_TIME_ACCUM_DIFF(x, y, z)
LLVMTypeRef StructFunctionCallInfoData
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)
LLVMTypeRef llvm_pg_var_func_type(const char *varname)
LLVMTypeRef StructTupleTableSlot
LLVMTypeRef TypeStorageBool
LLVMModuleRef llvm_mutable_module(LLVMJitContext *context)
LLVMTypeRef StructAggState
LLVMValueRef AttributeTemplate
LLVMTypeRef StructExprContext
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)
void llvm_leave_fatal_on_oom(void)
static Datum ExecRunCompiledExpr(ExprState *state, ExprContext *econtext, bool *isNull)
#define build_EvalXFunc(b, mod, funcname, v_state, op,...)
bool llvm_compile_expr(ExprState *state)
static LLVMValueRef build_EvalXFuncInt(LLVMBuilderRef b, LLVMModuleRef mod, const char *funcname, LLVMValueRef v_state, ExprEvalStep *op, int natts, LLVMValueRef *v_args)
static LLVMValueRef create_LifetimeEnd(LLVMModuleRef mod)
static LLVMValueRef BuildV1Call(LLVMJitContext *context, LLVMBuilderRef b, LLVMModuleRef mod, FunctionCallInfo fcinfo, LLVMValueRef *v_fcinfo_isnull)
LLVMTypeRef LLVMGetFunctionType(LLVMValueRef r)
void pfree(void *pointer)
#define FIELDNO_AGGSTATEPERGROUPDATA_TRANSVALUE
#define FIELDNO_AGGSTATEPERGROUPDATA_TRANSVALUEISNULL
#define FIELDNO_AGGSTATEPERGROUPDATA_NOTRANSVALUE
#define castNode(_type_, nodeptr)
#define FIELDNO_NULLABLE_DATUM_ISNULL
FunctionCallInfo transfn_fcinfo
struct JitContext * es_jit
struct ExprEvalStep::@58::@103 agg_presorted_distinctcheck
WindowFuncExprState * wfstate
struct ExprEvalStep::@58::@96 aggref
ExecEvalBoolSubroutine subscriptfunc
struct ExprEvalStep::@58::@64 returningexpr
struct ExprEvalStep::@58::@67 boolexpr
struct ExprEvalStep::@58::@89 hashdatum_initvalue
struct ExprEvalStep::@58::@102 agg_plain_pergroup_nullcheck
AggStatePerTrans pertrans
struct ExprEvalStep::@58::@106 jsonexpr
struct ExprEvalStep::@58::@101 agg_strict_input_check
struct JsonExprState * jsestate
struct ExprEvalStep::@58::@66 func
struct ExprEvalStep::@58::@87 sbsref
struct ExprEvalStep::@58::@81 rowcompare_step
ExecEvalSubroutine paramfunc
FunctionCallInfo fcinfo_data_in
struct ExprEvalStep::@58::@62 assign_var
struct ExprEvalStep::@58::@90 hashdatum
const TupleTableSlotOps * kind
struct ExprEvalStep::@58::@73 casetest
struct ExprEvalStep::@58::@68 qualexpr
FunctionCallInfo fcinfo_data
struct ExprEvalStep::@58::@104 agg_trans
struct ExprEvalStep::@58::@69 jump
struct ExprEvalStep::@58::@82 rowcompare_final
struct ExprEvalStep::@58::@100 agg_deserialize
struct ExprEvalStep::@58::@65 constval
struct ExprEvalStep::@58::@72 cparam
struct ExprEvalStep::@58::@86 sbsref_subscript
FunctionCallInfo fcinfo_data_out
struct ExprEvalStep::@58::@74 make_readonly
struct ExprEvalStep::@58::@75 iocoerce
union ExprEvalStep::@58 d
struct ExprEvalStep::@58::@98 window_func
struct ExprEvalStep::@58::@59 fetch
struct ExprEvalStep::@58::@63 assign_tmp
struct ExprEvalStep::@58::@60 var
NullableDatum args[FLEXIBLE_ARRAY_MEMBER]
static void * fn(void *arg)
#define FIELDNO_TUPLETABLESLOT_ISNULL
#define FIELDNO_TUPLETABLESLOT_VALUES
#define FIELDNO_TUPLETABLESLOT_NVALID