Commit 1ec7679f authored by Andres Freund's avatar Andres Freund

expression eval, jit: Minor code cleanups.

This mostly consists of using C99 style for loops, moving variables
into narrower scopes, and a smattering of other minor improvements.
Done separately to make it easier to review patches with actual
functional changes.

Author: Andres Freund
Discussion: https://postgr.es/m/20191023163849.sosqbfs5yenocez3@alap3.anarazel.de
parent 5ac4e9a1
...@@ -2779,12 +2779,7 @@ static void ...@@ -2779,12 +2779,7 @@ static void
ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest, ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest,
ExprState *state, Datum *resv, bool *resnull) ExprState *state, Datum *resv, bool *resnull)
{ {
ExprEvalStep scratch2 = {0};
DomainConstraintRef *constraint_ref; DomainConstraintRef *constraint_ref;
Datum *domainval = NULL;
bool *domainnull = NULL;
Datum *save_innermost_domainval;
bool *save_innermost_domainnull;
ListCell *l; ListCell *l;
scratch->d.domaincheck.resulttype = ctest->resulttype; scratch->d.domaincheck.resulttype = ctest->resulttype;
...@@ -2831,6 +2826,10 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest, ...@@ -2831,6 +2826,10 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest,
foreach(l, constraint_ref->constraints) foreach(l, constraint_ref->constraints)
{ {
DomainConstraintState *con = (DomainConstraintState *) lfirst(l); DomainConstraintState *con = (DomainConstraintState *) lfirst(l);
Datum *domainval = NULL;
bool *domainnull = NULL;
Datum *save_innermost_domainval;
bool *save_innermost_domainnull;
scratch->d.domaincheck.constraintname = con->name; scratch->d.domaincheck.constraintname = con->name;
...@@ -2862,6 +2861,8 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest, ...@@ -2862,6 +2861,8 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest,
*/ */
if (get_typlen(ctest->resulttype) == -1) if (get_typlen(ctest->resulttype) == -1)
{ {
ExprEvalStep scratch2 = {0};
/* Yes, so make output workspace for MAKE_READONLY */ /* Yes, so make output workspace for MAKE_READONLY */
domainval = (Datum *) palloc(sizeof(Datum)); domainval = (Datum *) palloc(sizeof(Datum));
domainnull = (bool *) palloc(sizeof(bool)); domainnull = (bool *) palloc(sizeof(bool));
...@@ -2932,8 +2933,6 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, ...@@ -2932,8 +2933,6 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
ExprState *state = makeNode(ExprState); ExprState *state = makeNode(ExprState);
PlanState *parent = &aggstate->ss.ps; PlanState *parent = &aggstate->ss.ps;
ExprEvalStep scratch = {0}; ExprEvalStep scratch = {0};
int transno = 0;
int setoff = 0;
bool isCombine = DO_AGGSPLIT_COMBINE(aggstate->aggsplit); bool isCombine = DO_AGGSPLIT_COMBINE(aggstate->aggsplit);
LastAttnumInfo deform = {0, 0, 0}; LastAttnumInfo deform = {0, 0, 0};
...@@ -2947,7 +2946,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, ...@@ -2947,7 +2946,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
* First figure out which slots, and how many columns from each, we're * First figure out which slots, and how many columns from each, we're
* going to need. * going to need.
*/ */
for (transno = 0; transno < aggstate->numtrans; transno++) for (int transno = 0; transno < aggstate->numtrans; transno++)
{ {
AggStatePerTrans pertrans = &aggstate->pertrans[transno]; AggStatePerTrans pertrans = &aggstate->pertrans[transno];
...@@ -2967,17 +2966,15 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, ...@@ -2967,17 +2966,15 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
/* /*
* Emit instructions for each transition value / grouping set combination. * Emit instructions for each transition value / grouping set combination.
*/ */
for (transno = 0; transno < aggstate->numtrans; transno++) for (int transno = 0; transno < aggstate->numtrans; transno++)
{ {
AggStatePerTrans pertrans = &aggstate->pertrans[transno]; AggStatePerTrans pertrans = &aggstate->pertrans[transno];
int argno;
int setno;
FunctionCallInfo trans_fcinfo = pertrans->transfn_fcinfo; FunctionCallInfo trans_fcinfo = pertrans->transfn_fcinfo;
ListCell *arg;
ListCell *bail;
List *adjust_bailout = NIL; List *adjust_bailout = NIL;
NullableDatum *strictargs = NULL; NullableDatum *strictargs = NULL;
bool *strictnulls = NULL; bool *strictnulls = NULL;
int argno;
ListCell *bail;
/* /*
* If filter present, emit. Do so before evaluating the input, to * If filter present, emit. Do so before evaluating the input, to
...@@ -3071,6 +3068,8 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, ...@@ -3071,6 +3068,8 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
} }
else if (pertrans->numSortCols == 0) else if (pertrans->numSortCols == 0)
{ {
ListCell *arg;
/* /*
* Normal transition function without ORDER BY / DISTINCT. * Normal transition function without ORDER BY / DISTINCT.
*/ */
...@@ -3113,6 +3112,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, ...@@ -3113,6 +3112,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
*/ */
Datum *values = pertrans->sortslot->tts_values; Datum *values = pertrans->sortslot->tts_values;
bool *nulls = pertrans->sortslot->tts_isnull; bool *nulls = pertrans->sortslot->tts_isnull;
ListCell *arg;
strictnulls = nulls; strictnulls = nulls;
...@@ -3152,12 +3152,12 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, ...@@ -3152,12 +3152,12 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
* grouping set). Do so for both sort and hash based computations, as * grouping set). Do so for both sort and hash based computations, as
* applicable. * applicable.
*/ */
setoff = 0;
if (doSort) if (doSort)
{ {
int processGroupingSets = Max(phase->numsets, 1); int processGroupingSets = Max(phase->numsets, 1);
int setoff = 0;
for (setno = 0; setno < processGroupingSets; setno++) for (int setno = 0; setno < processGroupingSets; setno++)
{ {
ExecBuildAggTransCall(state, aggstate, &scratch, trans_fcinfo, ExecBuildAggTransCall(state, aggstate, &scratch, trans_fcinfo,
pertrans, transno, setno, setoff, false); pertrans, transno, setno, setoff, false);
...@@ -3168,6 +3168,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, ...@@ -3168,6 +3168,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
if (doHash) if (doHash)
{ {
int numHashes = aggstate->num_hashes; int numHashes = aggstate->num_hashes;
int setoff;
/* in MIXED mode, there'll be preceding transition values */ /* in MIXED mode, there'll be preceding transition values */
if (aggstate->aggstrategy != AGG_HASHED) if (aggstate->aggstrategy != AGG_HASHED)
...@@ -3175,7 +3176,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, ...@@ -3175,7 +3176,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
else else
setoff = 0; setoff = 0;
for (setno = 0; setno < numHashes; setno++) for (int setno = 0; setno < numHashes; setno++)
{ {
ExecBuildAggTransCall(state, aggstate, &scratch, trans_fcinfo, ExecBuildAggTransCall(state, aggstate, &scratch, trans_fcinfo,
pertrans, transno, setno, setoff, true); pertrans, transno, setno, setoff, true);
...@@ -3204,6 +3205,8 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, ...@@ -3204,6 +3205,8 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
Assert(as->d.agg_deserialize.jumpnull == -1); Assert(as->d.agg_deserialize.jumpnull == -1);
as->d.agg_deserialize.jumpnull = state->steps_len; as->d.agg_deserialize.jumpnull = state->steps_len;
} }
else
Assert(false);
} }
} }
...@@ -3338,7 +3341,6 @@ ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, ...@@ -3338,7 +3341,6 @@ ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc,
{ {
ExprState *state = makeNode(ExprState); ExprState *state = makeNode(ExprState);
ExprEvalStep scratch = {0}; ExprEvalStep scratch = {0};
int natt;
int maxatt = -1; int maxatt = -1;
List *adjust_jumps = NIL; List *adjust_jumps = NIL;
ListCell *lc; ListCell *lc;
...@@ -3358,7 +3360,7 @@ ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, ...@@ -3358,7 +3360,7 @@ ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc,
scratch.resnull = &state->resnull; scratch.resnull = &state->resnull;
/* compute max needed attribute */ /* compute max needed attribute */
for (natt = 0; natt < numCols; natt++) for (int natt = 0; natt < numCols; natt++)
{ {
int attno = keyColIdx[natt]; int attno = keyColIdx[natt];
...@@ -3388,7 +3390,7 @@ ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, ...@@ -3388,7 +3390,7 @@ ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc,
* Start comparing at the last field (least significant sort key). That's * Start comparing at the last field (least significant sort key). That's
* the most likely to be different if we are dealing with sorted input. * the most likely to be different if we are dealing with sorted input.
*/ */
for (natt = numCols; --natt >= 0;) for (int natt = numCols; --natt >= 0;)
{ {
int attno = keyColIdx[natt]; int attno = keyColIdx[natt];
Form_pg_attribute latt = TupleDescAttr(ldesc, attno - 1); Form_pg_attribute latt = TupleDescAttr(ldesc, attno - 1);
......
...@@ -307,10 +307,7 @@ ExecReadyInterpretedExpr(ExprState *state) ...@@ -307,10 +307,7 @@ ExecReadyInterpretedExpr(ExprState *state)
* In the direct-threaded implementation, replace each opcode with the * In the direct-threaded implementation, replace each opcode with the
* address to jump to. (Use ExecEvalStepOp() to get back the opcode.) * address to jump to. (Use ExecEvalStepOp() to get back the opcode.)
*/ */
{ for (int off = 0; off < state->steps_len; off++)
int off;
for (off = 0; off < state->steps_len; off++)
{ {
ExprEvalStep *op = &state->steps[off]; ExprEvalStep *op = &state->steps[off];
...@@ -318,7 +315,6 @@ ExecReadyInterpretedExpr(ExprState *state) ...@@ -318,7 +315,6 @@ ExecReadyInterpretedExpr(ExprState *state)
} }
state->flags |= EEO_FLAG_DIRECT_THREADED; state->flags |= EEO_FLAG_DIRECT_THREADED;
}
#endif /* EEO_USE_COMPUTED_GOTO */ #endif /* EEO_USE_COMPUTED_GOTO */
state->evalfunc_private = (void *) ExecInterpExpr; state->evalfunc_private = (void *) ExecInterpExpr;
...@@ -673,11 +669,11 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) ...@@ -673,11 +669,11 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
{ {
FunctionCallInfo fcinfo = op->d.func.fcinfo_data; FunctionCallInfo fcinfo = op->d.func.fcinfo_data;
NullableDatum *args = fcinfo->args; NullableDatum *args = fcinfo->args;
int argno; int nargs = op->d.func.nargs;
Datum d; Datum d;
/* strict function, so check for NULL args */ /* strict function, so check for NULL args */
for (argno = 0; argno < op->d.func.nargs; argno++) for (int argno = 0; argno < nargs; argno++)
{ {
if (args[argno].isnull) if (args[argno].isnull)
{ {
...@@ -1568,29 +1564,28 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) ...@@ -1568,29 +1564,28 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
* Check that a strict aggregate transition / combination function's * Check that a strict aggregate transition / combination function's
* input is not NULL. * input is not NULL.
*/ */
EEO_CASE(EEOP_AGG_STRICT_INPUT_CHECK_NULLS)
EEO_CASE(EEOP_AGG_STRICT_INPUT_CHECK_ARGS)
{ {
int argno; NullableDatum *args = op->d.agg_strict_input_check.args;
bool *nulls = op->d.agg_strict_input_check.nulls;
int nargs = op->d.agg_strict_input_check.nargs; int nargs = op->d.agg_strict_input_check.nargs;
for (argno = 0; argno < nargs; argno++) for (int argno = 0; argno < nargs; argno++)
{ {
if (nulls[argno]) if (args[argno].isnull)
EEO_JUMP(op->d.agg_strict_input_check.jumpnull); EEO_JUMP(op->d.agg_strict_input_check.jumpnull);
} }
EEO_NEXT(); EEO_NEXT();
} }
EEO_CASE(EEOP_AGG_STRICT_INPUT_CHECK_ARGS) EEO_CASE(EEOP_AGG_STRICT_INPUT_CHECK_NULLS)
{ {
int argno; bool *nulls = op->d.agg_strict_input_check.nulls;
NullableDatum *args = op->d.agg_strict_input_check.args;
int nargs = op->d.agg_strict_input_check.nargs; int nargs = op->d.agg_strict_input_check.nargs;
for (argno = 0; argno < nargs; argno++) for (int argno = 0; argno < nargs; argno++)
{ {
if (args[argno].isnull) if (nulls[argno])
EEO_JUMP(op->d.agg_strict_input_check.jumpnull); EEO_JUMP(op->d.agg_strict_input_check.jumpnull);
} }
EEO_NEXT(); EEO_NEXT();
...@@ -1825,7 +1820,6 @@ ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull) ...@@ -1825,7 +1820,6 @@ ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull)
void void
CheckExprStillValid(ExprState *state, ExprContext *econtext) CheckExprStillValid(ExprState *state, ExprContext *econtext)
{ {
int i = 0;
TupleTableSlot *innerslot; TupleTableSlot *innerslot;
TupleTableSlot *outerslot; TupleTableSlot *outerslot;
TupleTableSlot *scanslot; TupleTableSlot *scanslot;
...@@ -1834,7 +1828,7 @@ CheckExprStillValid(ExprState *state, ExprContext *econtext) ...@@ -1834,7 +1828,7 @@ CheckExprStillValid(ExprState *state, ExprContext *econtext)
outerslot = econtext->ecxt_outertuple; outerslot = econtext->ecxt_outertuple;
scanslot = econtext->ecxt_scantuple; scanslot = econtext->ecxt_scantuple;
for (i = 0; i < state->steps_len; i++) for (int i = 0; i < state->steps_len; i++)
{ {
ExprEvalStep *op = &state->steps[i]; ExprEvalStep *op = &state->steps[i];
...@@ -2104,7 +2098,7 @@ ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull) ...@@ -2104,7 +2098,7 @@ ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull)
ExprEvalStep *op = &state->steps[0]; ExprEvalStep *op = &state->steps[0];
FunctionCallInfo fcinfo; FunctionCallInfo fcinfo;
NullableDatum *args; NullableDatum *args;
int argno; int nargs;
Datum d; Datum d;
/* /*
...@@ -2116,11 +2110,12 @@ ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull) ...@@ -2116,11 +2110,12 @@ ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull)
op++; op++;
nargs = op->d.func.nargs;
fcinfo = op->d.func.fcinfo_data; fcinfo = op->d.func.fcinfo_data;
args = fcinfo->args; args = fcinfo->args;
/* strict function, so check for NULL args */ /* strict function, so check for NULL args */
for (argno = 0; argno < op->d.func.nargs; argno++) for (int argno = 0; argno < nargs; argno++)
{ {
if (args[argno].isnull) if (args[argno].isnull)
{ {
...@@ -2258,13 +2253,11 @@ ExecInitInterpreter(void) ...@@ -2258,13 +2253,11 @@ ExecInitInterpreter(void)
/* Set up externally-visible pointer to dispatch table */ /* Set up externally-visible pointer to dispatch table */
if (dispatch_table == NULL) if (dispatch_table == NULL)
{ {
int i;
dispatch_table = (const void **) dispatch_table = (const void **)
DatumGetPointer(ExecInterpExpr(NULL, NULL, NULL)); DatumGetPointer(ExecInterpExpr(NULL, NULL, NULL));
/* build reverse lookup table */ /* build reverse lookup table */
for (i = 0; i < EEOP_LAST; i++) for (int i = 0; i < EEOP_LAST; i++)
{ {
reverse_dispatch_table[i].opcode = dispatch_table[i]; reverse_dispatch_table[i].opcode = dispatch_table[i];
reverse_dispatch_table[i].op = (ExprEvalOp) i; reverse_dispatch_table[i].op = (ExprEvalOp) i;
...@@ -2344,11 +2337,11 @@ ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op, ...@@ -2344,11 +2337,11 @@ ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op,
FunctionCallInfo fcinfo = op->d.func.fcinfo_data; FunctionCallInfo fcinfo = op->d.func.fcinfo_data;
PgStat_FunctionCallUsage fcusage; PgStat_FunctionCallUsage fcusage;
NullableDatum *args = fcinfo->args; NullableDatum *args = fcinfo->args;
int argno; int nargs = op->d.func.nargs;
Datum d; Datum d;
/* strict function, so check for NULL args */ /* strict function, so check for NULL args */
for (argno = 0; argno < op->d.func.nargs; argno++) for (int argno = 0; argno < nargs; argno++)
{ {
if (args[argno].isnull) if (args[argno].isnull)
{ {
...@@ -2568,7 +2561,6 @@ ExecEvalRowNullInt(ExprState *state, ExprEvalStep *op, ...@@ -2568,7 +2561,6 @@ ExecEvalRowNullInt(ExprState *state, ExprEvalStep *op,
int32 tupTypmod; int32 tupTypmod;
TupleDesc tupDesc; TupleDesc tupDesc;
HeapTupleData tmptup; HeapTupleData tmptup;
int att;
*op->resnull = false; *op->resnull = false;
...@@ -2611,7 +2603,7 @@ ExecEvalRowNullInt(ExprState *state, ExprEvalStep *op, ...@@ -2611,7 +2603,7 @@ ExecEvalRowNullInt(ExprState *state, ExprEvalStep *op,
tmptup.t_len = HeapTupleHeaderGetDatumLength(tuple); tmptup.t_len = HeapTupleHeaderGetDatumLength(tuple);
tmptup.t_data = tuple; tmptup.t_data = tuple;
for (att = 1; att <= tupDesc->natts; att++) for (int att = 1; att <= tupDesc->natts; att++)
{ {
/* ignore dropped columns */ /* ignore dropped columns */
if (TupleDescAttr(tupDesc, att - 1)->attisdropped) if (TupleDescAttr(tupDesc, att - 1)->attisdropped)
...@@ -2694,8 +2686,6 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op) ...@@ -2694,8 +2686,6 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
int32 dataoffset; int32 dataoffset;
char *dat; char *dat;
int iitem; int iitem;
int elemoff;
int i;
subdata = (char **) palloc(nelems * sizeof(char *)); subdata = (char **) palloc(nelems * sizeof(char *));
subbitmaps = (bits8 **) palloc(nelems * sizeof(bits8 *)); subbitmaps = (bits8 **) palloc(nelems * sizeof(bits8 *));
...@@ -2703,7 +2693,7 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op) ...@@ -2703,7 +2693,7 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
subnitems = (int *) palloc(nelems * sizeof(int)); subnitems = (int *) palloc(nelems * sizeof(int));
/* loop through and get data area from each element */ /* loop through and get data area from each element */
for (elemoff = 0; elemoff < nelems; elemoff++) for (int elemoff = 0; elemoff < nelems; elemoff++)
{ {
Datum arraydatum; Datum arraydatum;
bool eisnull; bool eisnull;
...@@ -2805,7 +2795,7 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op) ...@@ -2805,7 +2795,7 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
/* setup for multi-D array */ /* setup for multi-D array */
dims[0] = outer_nelems; dims[0] = outer_nelems;
lbs[0] = 1; lbs[0] = 1;
for (i = 1; i < ndims; i++) for (int i = 1; i < ndims; i++)
{ {
dims[i] = elem_dims[i - 1]; dims[i] = elem_dims[i - 1];
lbs[i] = elem_lbs[i - 1]; lbs[i] = elem_lbs[i - 1];
...@@ -2832,7 +2822,7 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op) ...@@ -2832,7 +2822,7 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
dat = ARR_DATA_PTR(result); dat = ARR_DATA_PTR(result);
iitem = 0; iitem = 0;
for (i = 0; i < outer_nelems; i++) for (int i = 0; i < outer_nelems; i++)
{ {
memcpy(dat, subdata[i], subbytes[i]); memcpy(dat, subdata[i], subbytes[i]);
dat += subbytes[i]; dat += subbytes[i];
...@@ -2920,7 +2910,6 @@ ExecEvalMinMax(ExprState *state, ExprEvalStep *op) ...@@ -2920,7 +2910,6 @@ ExecEvalMinMax(ExprState *state, ExprEvalStep *op)
bool *nulls = op->d.minmax.nulls; bool *nulls = op->d.minmax.nulls;
FunctionCallInfo fcinfo = op->d.minmax.fcinfo_data; FunctionCallInfo fcinfo = op->d.minmax.fcinfo_data;
MinMaxOp operator = op->d.minmax.op; MinMaxOp operator = op->d.minmax.op;
int off;
/* set at initialization */ /* set at initialization */
Assert(fcinfo->args[0].isnull == false); Assert(fcinfo->args[0].isnull == false);
...@@ -2929,7 +2918,7 @@ ExecEvalMinMax(ExprState *state, ExprEvalStep *op) ...@@ -2929,7 +2918,7 @@ ExecEvalMinMax(ExprState *state, ExprEvalStep *op)
/* default to null result */ /* default to null result */
*op->resnull = true; *op->resnull = true;
for (off = 0; off < op->d.minmax.nelems; off++) for (int off = 0; off < op->d.minmax.nelems; off++)
{ {
/* ignore NULL inputs */ /* ignore NULL inputs */
if (nulls[off]) if (nulls[off])
...@@ -3461,7 +3450,6 @@ ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op) ...@@ -3461,7 +3450,6 @@ ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op)
int nitems; int nitems;
Datum result; Datum result;
bool resultnull; bool resultnull;
int i;
int16 typlen; int16 typlen;
bool typbyval; bool typbyval;
char typalign; char typalign;
...@@ -3529,7 +3517,7 @@ ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op) ...@@ -3529,7 +3517,7 @@ ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op)
bitmap = ARR_NULLBITMAP(arr); bitmap = ARR_NULLBITMAP(arr);
bitmask = 1; bitmask = 1;
for (i = 0; i < nitems; i++) for (int i = 0; i < nitems; i++)
{ {
Datum elt; Datum elt;
Datum thisresult; Datum thisresult;
...@@ -3641,7 +3629,6 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) ...@@ -3641,7 +3629,6 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op)
{ {
XmlExpr *xexpr = op->d.xmlexpr.xexpr; XmlExpr *xexpr = op->d.xmlexpr.xexpr;
Datum value; Datum value;
int i;
*op->resnull = true; /* until we get a result */ *op->resnull = true; /* until we get a result */
*op->resvalue = (Datum) 0; *op->resvalue = (Datum) 0;
...@@ -3654,7 +3641,7 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) ...@@ -3654,7 +3641,7 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op)
bool *argnull = op->d.xmlexpr.argnull; bool *argnull = op->d.xmlexpr.argnull;
List *values = NIL; List *values = NIL;
for (i = 0; i < list_length(xexpr->args); i++) for (int i = 0; i < list_length(xexpr->args); i++)
{ {
if (!argnull[i]) if (!argnull[i])
values = lappend(values, DatumGetPointer(argvalue[i])); values = lappend(values, DatumGetPointer(argvalue[i]));
...@@ -3675,6 +3662,7 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) ...@@ -3675,6 +3662,7 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op)
StringInfoData buf; StringInfoData buf;
ListCell *lc; ListCell *lc;
ListCell *lc2; ListCell *lc2;
int i;
initStringInfo(&buf); initStringInfo(&buf);
...@@ -3968,7 +3956,6 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) ...@@ -3968,7 +3956,6 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
{ {
TupleDesc var_tupdesc; TupleDesc var_tupdesc;
TupleDesc slot_tupdesc; TupleDesc slot_tupdesc;
int i;
/* /*
* We really only care about numbers of attributes and data types. * We really only care about numbers of attributes and data types.
...@@ -4000,7 +3987,7 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) ...@@ -4000,7 +3987,7 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
slot_tupdesc->natts, slot_tupdesc->natts,
var_tupdesc->natts))); var_tupdesc->natts)));
for (i = 0; i < var_tupdesc->natts; i++) for (int i = 0; i < var_tupdesc->natts; i++)
{ {
Form_pg_attribute vattr = TupleDescAttr(var_tupdesc, i); Form_pg_attribute vattr = TupleDescAttr(var_tupdesc, i);
Form_pg_attribute sattr = TupleDescAttr(slot_tupdesc, i); Form_pg_attribute sattr = TupleDescAttr(slot_tupdesc, i);
...@@ -4095,11 +4082,10 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) ...@@ -4095,11 +4082,10 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
/* Check to see if any dropped attributes are non-null */ /* Check to see if any dropped attributes are non-null */
TupleDesc tupleDesc = slot->tts_tupleDescriptor; TupleDesc tupleDesc = slot->tts_tupleDescriptor;
TupleDesc var_tupdesc = op->d.wholerow.tupdesc; TupleDesc var_tupdesc = op->d.wholerow.tupdesc;
int i;
Assert(var_tupdesc->natts == tupleDesc->natts); Assert(var_tupdesc->natts == tupleDesc->natts);
for (i = 0; i < var_tupdesc->natts; i++) for (int i = 0; i < var_tupdesc->natts; i++)
{ {
Form_pg_attribute vattr = TupleDescAttr(var_tupdesc, i); Form_pg_attribute vattr = TupleDescAttr(var_tupdesc, i);
Form_pg_attribute sattr = TupleDescAttr(tupleDesc, i); Form_pg_attribute sattr = TupleDescAttr(tupleDesc, i);
......
...@@ -71,7 +71,6 @@ bool ...@@ -71,7 +71,6 @@ bool
llvm_compile_expr(ExprState *state) llvm_compile_expr(ExprState *state)
{ {
PlanState *parent = state->parent; PlanState *parent = state->parent;
int i;
char *funcname; char *funcname;
LLVMJitContext *context = NULL; LLVMJitContext *context = NULL;
...@@ -119,22 +118,21 @@ llvm_compile_expr(ExprState *state) ...@@ -119,22 +118,21 @@ llvm_compile_expr(ExprState *state)
llvm_enter_fatal_on_oom(); llvm_enter_fatal_on_oom();
/*
* Right now we don't support compiling expressions without a parent, as
* we need access to the EState.
*/
Assert(parent);
/* get or create JIT context */ /* get or create JIT context */
if (parent && parent->state->es_jit) if (parent->state->es_jit)
{
context = (LLVMJitContext *) parent->state->es_jit; context = (LLVMJitContext *) parent->state->es_jit;
}
else else
{ {
context = llvm_create_context(parent->state->es_jit_flags); context = llvm_create_context(parent->state->es_jit_flags);
if (parent)
{
parent->state->es_jit = &context->base; parent->state->es_jit = &context->base;
} }
}
INSTR_TIME_SET_CURRENT(starttime); INSTR_TIME_SET_CURRENT(starttime);
mod = llvm_mutable_module(context); mod = llvm_mutable_module(context);
...@@ -226,22 +224,22 @@ llvm_compile_expr(ExprState *state) ...@@ -226,22 +224,22 @@ llvm_compile_expr(ExprState *state)
/* allocate blocks for each op upfront, so we can do jumps easily */ /* allocate blocks for each op upfront, so we can do jumps easily */
opblocks = palloc(sizeof(LLVMBasicBlockRef) * state->steps_len); opblocks = palloc(sizeof(LLVMBasicBlockRef) * state->steps_len);
for (i = 0; i < state->steps_len; i++) for (int opno = 0; opno < state->steps_len; opno++)
opblocks[i] = l_bb_append_v(eval_fn, "b.op.%d.start", i); opblocks[opno] = l_bb_append_v(eval_fn, "b.op.%d.start", opno);
/* jump from entry to first block */ /* jump from entry to first block */
LLVMBuildBr(b, opblocks[0]); LLVMBuildBr(b, opblocks[0]);
for (i = 0; i < state->steps_len; i++) for (int opno = 0; opno < state->steps_len; opno++)
{ {
ExprEvalStep *op; ExprEvalStep *op;
ExprEvalOp opcode; ExprEvalOp opcode;
LLVMValueRef v_resvaluep; LLVMValueRef v_resvaluep;
LLVMValueRef v_resnullp; LLVMValueRef v_resnullp;
LLVMPositionBuilderAtEnd(b, opblocks[i]); LLVMPositionBuilderAtEnd(b, opblocks[opno]);
op = &state->steps[i]; op = &state->steps[opno];
opcode = ExecEvalStepOp(state, op); opcode = ExecEvalStepOp(state, op);
v_resvaluep = l_ptr_const(op->resvalue, l_ptr(TypeSizeT)); v_resvaluep = l_ptr_const(op->resvalue, l_ptr(TypeSizeT));
...@@ -251,8 +249,8 @@ llvm_compile_expr(ExprState *state) ...@@ -251,8 +249,8 @@ llvm_compile_expr(ExprState *state)
{ {
case EEOP_DONE: case EEOP_DONE:
{ {
LLVMValueRef v_tmpisnull, LLVMValueRef v_tmpisnull;
v_tmpvalue; LLVMValueRef v_tmpvalue;
v_tmpvalue = LLVMBuildLoad(b, v_tmpvaluep, ""); v_tmpvalue = LLVMBuildLoad(b, v_tmpvaluep, "");
v_tmpisnull = LLVMBuildLoad(b, v_tmpisnullp, ""); v_tmpisnull = LLVMBuildLoad(b, v_tmpisnullp, "");
...@@ -276,8 +274,8 @@ llvm_compile_expr(ExprState *state) ...@@ -276,8 +274,8 @@ llvm_compile_expr(ExprState *state)
LLVMValueRef l_jit_deform = NULL; LLVMValueRef l_jit_deform = NULL;
const TupleTableSlotOps *tts_ops = NULL; const TupleTableSlotOps *tts_ops = NULL;
b_fetch = l_bb_before_v(opblocks[i + 1], b_fetch = l_bb_before_v(opblocks[opno + 1],
"op.%d.fetch", i); "op.%d.fetch", opno);
if (op->d.fetch.known_desc) if (op->d.fetch.known_desc)
desc = op->d.fetch.known_desc; desc = op->d.fetch.known_desc;
...@@ -307,7 +305,7 @@ llvm_compile_expr(ExprState *state) ...@@ -307,7 +305,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildICmp(b, LLVMIntUGE, v_nvalid, LLVMBuildICmp(b, LLVMIntUGE, v_nvalid,
l_int16_const(op->d.fetch.last_var), l_int16_const(op->d.fetch.last_var),
""), ""),
opblocks[i + 1], b_fetch); opblocks[opno + 1], b_fetch);
LLVMPositionBuilderAtEnd(b, b_fetch); LLVMPositionBuilderAtEnd(b, b_fetch);
...@@ -346,7 +344,7 @@ llvm_compile_expr(ExprState *state) ...@@ -346,7 +344,7 @@ llvm_compile_expr(ExprState *state)
params, lengthof(params), ""); params, lengthof(params), "");
} }
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -382,7 +380,7 @@ llvm_compile_expr(ExprState *state) ...@@ -382,7 +380,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, value, v_resvaluep); LLVMBuildStore(b, value, v_resvaluep);
LLVMBuildStore(b, isnull, v_resnullp); LLVMBuildStore(b, isnull, v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -409,26 +407,26 @@ llvm_compile_expr(ExprState *state) ...@@ -409,26 +407,26 @@ llvm_compile_expr(ExprState *state)
llvm_get_decl(mod, FuncExecEvalSysVar), llvm_get_decl(mod, FuncExecEvalSysVar),
v_params, lengthof(v_params), ""); v_params, lengthof(v_params), "");
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_WHOLEROW: case EEOP_WHOLEROW:
build_EvalXFunc(b, mod, "ExecEvalWholeRowVar", build_EvalXFunc(b, mod, "ExecEvalWholeRowVar",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_ASSIGN_INNER_VAR: case EEOP_ASSIGN_INNER_VAR:
case EEOP_ASSIGN_OUTER_VAR: case EEOP_ASSIGN_OUTER_VAR:
case EEOP_ASSIGN_SCAN_VAR: case EEOP_ASSIGN_SCAN_VAR:
{ {
LLVMValueRef v_value, LLVMValueRef v_value;
v_isnull; LLVMValueRef v_isnull;
LLVMValueRef v_rvaluep, LLVMValueRef v_rvaluep;
v_risnullp; LLVMValueRef v_risnullp;
LLVMValueRef v_attnum, LLVMValueRef v_attnum;
v_resultnum; LLVMValueRef v_resultnum;
LLVMValueRef v_values; LLVMValueRef v_values;
LLVMValueRef v_nulls; LLVMValueRef v_nulls;
...@@ -464,7 +462,7 @@ llvm_compile_expr(ExprState *state) ...@@ -464,7 +462,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_value, v_rvaluep); LLVMBuildStore(b, v_value, v_rvaluep);
LLVMBuildStore(b, v_isnull, v_risnullp); LLVMBuildStore(b, v_isnull, v_risnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -492,7 +490,7 @@ llvm_compile_expr(ExprState *state) ...@@ -492,7 +490,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_value, v_rvaluep); LLVMBuildStore(b, v_value, v_rvaluep);
LLVMBuildStore(b, v_isnull, v_risnullp); LLVMBuildStore(b, v_isnull, v_risnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -508,8 +506,8 @@ llvm_compile_expr(ExprState *state) ...@@ -508,8 +506,8 @@ llvm_compile_expr(ExprState *state)
LLVMValueRef v_resultnum; LLVMValueRef v_resultnum;
size_t resultnum = op->d.assign_tmp.resultnum; size_t resultnum = op->d.assign_tmp.resultnum;
b_notnull = l_bb_before_v(opblocks[i + 1], b_notnull = l_bb_before_v(opblocks[opno + 1],
"op.%d.assign_tmp.notnull", i); "op.%d.assign_tmp.notnull", opno);
/* load data */ /* load data */
v_value = LLVMBuildLoad(b, v_tmpvaluep, ""); v_value = LLVMBuildLoad(b, v_tmpvaluep, "");
...@@ -529,7 +527,7 @@ llvm_compile_expr(ExprState *state) ...@@ -529,7 +527,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildCondBr(b, LLVMBuildCondBr(b,
LLVMBuildICmp(b, LLVMIntEQ, v_isnull, LLVMBuildICmp(b, LLVMIntEQ, v_isnull,
l_sbool_const(0), ""), l_sbool_const(0), ""),
b_notnull, opblocks[i + 1]); b_notnull, opblocks[opno + 1]);
/* if value is not null, convert to RO datum */ /* if value is not null, convert to RO datum */
LLVMPositionBuilderAtEnd(b, b_notnull); LLVMPositionBuilderAtEnd(b, b_notnull);
...@@ -542,7 +540,7 @@ llvm_compile_expr(ExprState *state) ...@@ -542,7 +540,7 @@ llvm_compile_expr(ExprState *state)
/* store value */ /* store value */
LLVMBuildStore(b, v_ret, v_rvaluep); LLVMBuildStore(b, v_ret, v_rvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -557,7 +555,7 @@ llvm_compile_expr(ExprState *state) ...@@ -557,7 +555,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_constvalue, v_resvaluep); LLVMBuildStore(b, v_constvalue, v_resvaluep);
LLVMBuildStore(b, v_constnull, v_resnullp); LLVMBuildStore(b, v_constnull, v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -565,7 +563,6 @@ llvm_compile_expr(ExprState *state) ...@@ -565,7 +563,6 @@ llvm_compile_expr(ExprState *state)
{ {
FunctionCallInfo fcinfo = op->d.func.fcinfo_data; FunctionCallInfo fcinfo = op->d.func.fcinfo_data;
LLVMBasicBlockRef b_nonull; LLVMBasicBlockRef b_nonull;
int argno;
LLVMValueRef v_fcinfo; LLVMValueRef v_fcinfo;
LLVMBasicBlockRef *b_checkargnulls; LLVMBasicBlockRef *b_checkargnulls;
...@@ -573,8 +570,8 @@ llvm_compile_expr(ExprState *state) ...@@ -573,8 +570,8 @@ llvm_compile_expr(ExprState *state)
* Block for the actual function call, if args are * Block for the actual function call, if args are
* non-NULL. * non-NULL.
*/ */
b_nonull = l_bb_before_v(opblocks[i + 1], b_nonull = l_bb_before_v(opblocks[opno + 1],
"b.%d.no-null-args", i); "b.%d.no-null-args", opno);
/* should make sure they're optimized beforehand */ /* should make sure they're optimized beforehand */
if (op->d.func.nargs == 0) if (op->d.func.nargs == 0)
...@@ -592,15 +589,15 @@ llvm_compile_expr(ExprState *state) ...@@ -592,15 +589,15 @@ llvm_compile_expr(ExprState *state)
/* create blocks for checking args, one for each */ /* create blocks for checking args, one for each */
b_checkargnulls = b_checkargnulls =
palloc(sizeof(LLVMBasicBlockRef *) * op->d.func.nargs); palloc(sizeof(LLVMBasicBlockRef *) * op->d.func.nargs);
for (argno = 0; argno < op->d.func.nargs; argno++) for (int argno = 0; argno < op->d.func.nargs; argno++)
b_checkargnulls[argno] = b_checkargnulls[argno] =
l_bb_before_v(b_nonull, "b.%d.isnull.%d", i, argno); l_bb_before_v(b_nonull, "b.%d.isnull.%d", opno, argno);
/* jump to check of first argument */ /* jump to check of first argument */
LLVMBuildBr(b, b_checkargnulls[0]); LLVMBuildBr(b, b_checkargnulls[0]);
/* check each arg for NULLness */ /* check each arg for NULLness */
for (argno = 0; argno < op->d.func.nargs; argno++) for (int argno = 0; argno < op->d.func.nargs; argno++)
{ {
LLVMValueRef v_argisnull; LLVMValueRef v_argisnull;
LLVMBasicBlockRef b_argnotnull; LLVMBasicBlockRef b_argnotnull;
...@@ -620,7 +617,7 @@ llvm_compile_expr(ExprState *state) ...@@ -620,7 +617,7 @@ llvm_compile_expr(ExprState *state)
v_argisnull, v_argisnull,
l_sbool_const(1), l_sbool_const(1),
""), ""),
opblocks[i + 1], opblocks[opno + 1],
b_argnotnull); b_argnotnull);
} }
...@@ -639,21 +636,21 @@ llvm_compile_expr(ExprState *state) ...@@ -639,21 +636,21 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_retval, v_resvaluep); LLVMBuildStore(b, v_retval, v_resvaluep);
LLVMBuildStore(b, v_fcinfo_isnull, v_resnullp); LLVMBuildStore(b, v_fcinfo_isnull, v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_FUNCEXPR_FUSAGE: case EEOP_FUNCEXPR_FUSAGE:
build_EvalXFunc(b, mod, "ExecEvalFuncExprFusage", build_EvalXFunc(b, mod, "ExecEvalFuncExprFusage",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_FUNCEXPR_STRICT_FUSAGE: case EEOP_FUNCEXPR_STRICT_FUSAGE:
build_EvalXFunc(b, mod, "ExecEvalFuncExprStrictFusage", build_EvalXFunc(b, mod, "ExecEvalFuncExprStrictFusage",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_BOOL_AND_STEP_FIRST: case EEOP_BOOL_AND_STEP_FIRST:
...@@ -685,16 +682,16 @@ llvm_compile_expr(ExprState *state) ...@@ -685,16 +682,16 @@ llvm_compile_expr(ExprState *state)
LLVMBasicBlockRef b_boolcont; LLVMBasicBlockRef b_boolcont;
LLVMBasicBlockRef b_boolisanynull; LLVMBasicBlockRef b_boolisanynull;
b_boolisnull = l_bb_before_v(opblocks[i + 1], b_boolisnull = l_bb_before_v(opblocks[opno + 1],
"b.%d.boolisnull", i); "b.%d.boolisnull", opno);
b_boolcheckfalse = l_bb_before_v(opblocks[i + 1], b_boolcheckfalse = l_bb_before_v(opblocks[opno + 1],
"b.%d.boolcheckfalse", i); "b.%d.boolcheckfalse", opno);
b_boolisfalse = l_bb_before_v(opblocks[i + 1], b_boolisfalse = l_bb_before_v(opblocks[opno + 1],
"b.%d.boolisfalse", i); "b.%d.boolisfalse", opno);
b_boolisanynull = l_bb_before_v(opblocks[i + 1], b_boolisanynull = l_bb_before_v(opblocks[opno + 1],
"b.%d.boolisanynull", i); "b.%d.boolisanynull", opno);
b_boolcont = l_bb_before_v(opblocks[i + 1], b_boolcont = l_bb_before_v(opblocks[opno + 1],
"b.%d.boolcont", i); "b.%d.boolcont", opno);
v_boolanynullp = l_ptr_const(op->d.boolexpr.anynull, v_boolanynullp = l_ptr_const(op->d.boolexpr.anynull,
l_ptr(TypeStorageBool)); l_ptr(TypeStorageBool));
...@@ -747,7 +744,7 @@ llvm_compile_expr(ExprState *state) ...@@ -747,7 +744,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildCondBr(b, LLVMBuildCondBr(b,
LLVMBuildICmp(b, LLVMIntEQ, v_boolanynull, LLVMBuildICmp(b, LLVMIntEQ, v_boolanynull,
l_sbool_const(0), ""), l_sbool_const(0), ""),
opblocks[i + 1], b_boolisanynull); opblocks[opno + 1], b_boolisanynull);
LLVMPositionBuilderAtEnd(b, b_boolisanynull); LLVMPositionBuilderAtEnd(b, b_boolisanynull);
/* set resnull to true */ /* set resnull to true */
...@@ -755,7 +752,7 @@ llvm_compile_expr(ExprState *state) ...@@ -755,7 +752,7 @@ llvm_compile_expr(ExprState *state)
/* reset resvalue */ /* reset resvalue */
LLVMBuildStore(b, l_sizet_const(0), v_resvaluep); LLVMBuildStore(b, l_sizet_const(0), v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_BOOL_OR_STEP_FIRST: case EEOP_BOOL_OR_STEP_FIRST:
...@@ -787,16 +784,16 @@ llvm_compile_expr(ExprState *state) ...@@ -787,16 +784,16 @@ llvm_compile_expr(ExprState *state)
LLVMBasicBlockRef b_boolcont; LLVMBasicBlockRef b_boolcont;
LLVMBasicBlockRef b_boolisanynull; LLVMBasicBlockRef b_boolisanynull;
b_boolisnull = l_bb_before_v(opblocks[i + 1], b_boolisnull = l_bb_before_v(opblocks[opno + 1],
"b.%d.boolisnull", i); "b.%d.boolisnull", opno);
b_boolchecktrue = l_bb_before_v(opblocks[i + 1], b_boolchecktrue = l_bb_before_v(opblocks[opno + 1],
"b.%d.boolchecktrue", i); "b.%d.boolchecktrue", opno);
b_boolistrue = l_bb_before_v(opblocks[i + 1], b_boolistrue = l_bb_before_v(opblocks[opno + 1],
"b.%d.boolistrue", i); "b.%d.boolistrue", opno);
b_boolisanynull = l_bb_before_v(opblocks[i + 1], b_boolisanynull = l_bb_before_v(opblocks[opno + 1],
"b.%d.boolisanynull", i); "b.%d.boolisanynull", opno);
b_boolcont = l_bb_before_v(opblocks[i + 1], b_boolcont = l_bb_before_v(opblocks[opno + 1],
"b.%d.boolcont", i); "b.%d.boolcont", opno);
v_boolanynullp = l_ptr_const(op->d.boolexpr.anynull, v_boolanynullp = l_ptr_const(op->d.boolexpr.anynull,
l_ptr(TypeStorageBool)); l_ptr(TypeStorageBool));
...@@ -848,7 +845,7 @@ llvm_compile_expr(ExprState *state) ...@@ -848,7 +845,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildCondBr(b, LLVMBuildCondBr(b,
LLVMBuildICmp(b, LLVMIntEQ, v_boolanynull, LLVMBuildICmp(b, LLVMIntEQ, v_boolanynull,
l_sbool_const(0), ""), l_sbool_const(0), ""),
opblocks[i + 1], b_boolisanynull); opblocks[opno + 1], b_boolisanynull);
LLVMPositionBuilderAtEnd(b, b_boolisanynull); LLVMPositionBuilderAtEnd(b, b_boolisanynull);
/* set resnull to true */ /* set resnull to true */
...@@ -856,7 +853,7 @@ llvm_compile_expr(ExprState *state) ...@@ -856,7 +853,7 @@ llvm_compile_expr(ExprState *state)
/* reset resvalue */ /* reset resvalue */
LLVMBuildStore(b, l_sizet_const(0), v_resvaluep); LLVMBuildStore(b, l_sizet_const(0), v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -880,7 +877,7 @@ llvm_compile_expr(ExprState *state) ...@@ -880,7 +877,7 @@ llvm_compile_expr(ExprState *state)
/* set revalue to !boolvalue */ /* set revalue to !boolvalue */
LLVMBuildStore(b, v_negbool, v_resvaluep); LLVMBuildStore(b, v_negbool, v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -891,8 +888,8 @@ llvm_compile_expr(ExprState *state) ...@@ -891,8 +888,8 @@ llvm_compile_expr(ExprState *state)
LLVMValueRef v_nullorfalse; LLVMValueRef v_nullorfalse;
LLVMBasicBlockRef b_qualfail; LLVMBasicBlockRef b_qualfail;
b_qualfail = l_bb_before_v(opblocks[i + 1], b_qualfail = l_bb_before_v(opblocks[opno + 1],
"op.%d.qualfail", i); "op.%d.qualfail", opno);
v_resvalue = LLVMBuildLoad(b, v_resvaluep, ""); v_resvalue = LLVMBuildLoad(b, v_resvaluep, "");
v_resnull = LLVMBuildLoad(b, v_resnullp, ""); v_resnull = LLVMBuildLoad(b, v_resnullp, "");
...@@ -908,7 +905,7 @@ llvm_compile_expr(ExprState *state) ...@@ -908,7 +905,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildCondBr(b, LLVMBuildCondBr(b,
v_nullorfalse, v_nullorfalse,
b_qualfail, b_qualfail,
opblocks[i + 1]); opblocks[opno + 1]);
/* build block handling NULL or false */ /* build block handling NULL or false */
LLVMPositionBuilderAtEnd(b, b_qualfail); LLVMPositionBuilderAtEnd(b, b_qualfail);
...@@ -939,7 +936,7 @@ llvm_compile_expr(ExprState *state) ...@@ -939,7 +936,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildICmp(b, LLVMIntEQ, v_resnull, LLVMBuildICmp(b, LLVMIntEQ, v_resnull,
l_sbool_const(1), ""), l_sbool_const(1), ""),
opblocks[op->d.jump.jumpdone], opblocks[op->d.jump.jumpdone],
opblocks[i + 1]); opblocks[opno + 1]);
break; break;
} }
...@@ -955,7 +952,7 @@ llvm_compile_expr(ExprState *state) ...@@ -955,7 +952,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildICmp(b, LLVMIntEQ, v_resnull, LLVMBuildICmp(b, LLVMIntEQ, v_resnull,
l_sbool_const(0), ""), l_sbool_const(0), ""),
opblocks[op->d.jump.jumpdone], opblocks[op->d.jump.jumpdone],
opblocks[i + 1]); opblocks[opno + 1]);
break; break;
} }
...@@ -982,7 +979,7 @@ llvm_compile_expr(ExprState *state) ...@@ -982,7 +979,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildCondBr(b, LLVMBuildCondBr(b,
v_nullorfalse, v_nullorfalse,
opblocks[op->d.jump.jumpdone], opblocks[op->d.jump.jumpdone],
opblocks[i + 1]); opblocks[opno + 1]);
break; break;
} }
...@@ -1001,7 +998,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1001,7 +998,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_resvalue, v_resvaluep); LLVMBuildStore(b, v_resvalue, v_resvaluep);
LLVMBuildStore(b, l_sbool_const(0), v_resnullp); LLVMBuildStore(b, l_sbool_const(0), v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -1020,20 +1017,20 @@ llvm_compile_expr(ExprState *state) ...@@ -1020,20 +1017,20 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_resvalue, v_resvaluep); LLVMBuildStore(b, v_resvalue, v_resvaluep);
LLVMBuildStore(b, l_sbool_const(0), v_resnullp); LLVMBuildStore(b, l_sbool_const(0), v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_NULLTEST_ROWISNULL: case EEOP_NULLTEST_ROWISNULL:
build_EvalXFunc(b, mod, "ExecEvalRowNull", build_EvalXFunc(b, mod, "ExecEvalRowNull",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_NULLTEST_ROWISNOTNULL: case EEOP_NULLTEST_ROWISNOTNULL:
build_EvalXFunc(b, mod, "ExecEvalRowNotNull", build_EvalXFunc(b, mod, "ExecEvalRowNotNull",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_BOOLTEST_IS_TRUE: case EEOP_BOOLTEST_IS_TRUE:
...@@ -1045,10 +1042,10 @@ llvm_compile_expr(ExprState *state) ...@@ -1045,10 +1042,10 @@ llvm_compile_expr(ExprState *state)
b_notnull; b_notnull;
LLVMValueRef v_resnull = LLVMBuildLoad(b, v_resnullp, ""); LLVMValueRef v_resnull = LLVMBuildLoad(b, v_resnullp, "");
b_isnull = l_bb_before_v(opblocks[i + 1], b_isnull = l_bb_before_v(opblocks[opno + 1],
"op.%d.isnull", i); "op.%d.isnull", opno);
b_notnull = l_bb_before_v(opblocks[i + 1], b_notnull = l_bb_before_v(opblocks[opno + 1],
"op.%d.isnotnull", i); "op.%d.isnotnull", opno);
/* check if value is NULL */ /* check if value is NULL */
LLVMBuildCondBr(b, LLVMBuildCondBr(b,
...@@ -1072,7 +1069,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1072,7 +1069,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, l_sizet_const(1), v_resvaluep); LLVMBuildStore(b, l_sizet_const(1), v_resvaluep);
} }
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
LLVMPositionBuilderAtEnd(b, b_notnull); LLVMPositionBuilderAtEnd(b, b_notnull);
...@@ -1097,20 +1094,20 @@ llvm_compile_expr(ExprState *state) ...@@ -1097,20 +1094,20 @@ llvm_compile_expr(ExprState *state)
TypeSizeT, ""); TypeSizeT, "");
LLVMBuildStore(b, v_value, v_resvaluep); LLVMBuildStore(b, v_value, v_resvaluep);
} }
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_PARAM_EXEC: case EEOP_PARAM_EXEC:
build_EvalXFunc(b, mod, "ExecEvalParamExec", build_EvalXFunc(b, mod, "ExecEvalParamExec",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_PARAM_EXTERN: case EEOP_PARAM_EXTERN:
build_EvalXFunc(b, mod, "ExecEvalParamExtern", build_EvalXFunc(b, mod, "ExecEvalParamExtern",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_PARAM_CALLBACK: case EEOP_PARAM_CALLBACK:
...@@ -1138,26 +1135,26 @@ llvm_compile_expr(ExprState *state) ...@@ -1138,26 +1135,26 @@ llvm_compile_expr(ExprState *state)
v_func, v_func,
v_params, lengthof(v_params), ""); v_params, lengthof(v_params), "");
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_SBSREF_OLD: case EEOP_SBSREF_OLD:
build_EvalXFunc(b, mod, "ExecEvalSubscriptingRefOld", build_EvalXFunc(b, mod, "ExecEvalSubscriptingRefOld",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_SBSREF_ASSIGN: case EEOP_SBSREF_ASSIGN:
build_EvalXFunc(b, mod, "ExecEvalSubscriptingRefAssign", build_EvalXFunc(b, mod, "ExecEvalSubscriptingRefAssign",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_SBSREF_FETCH: case EEOP_SBSREF_FETCH:
build_EvalXFunc(b, mod, "ExecEvalSubscriptingRefFetch", build_EvalXFunc(b, mod, "ExecEvalSubscriptingRefFetch",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_CASE_TESTVAL: case EEOP_CASE_TESTVAL:
...@@ -1170,10 +1167,10 @@ llvm_compile_expr(ExprState *state) ...@@ -1170,10 +1167,10 @@ llvm_compile_expr(ExprState *state)
v_casenull; v_casenull;
LLVMValueRef v_casevaluenull; LLVMValueRef v_casevaluenull;
b_avail = l_bb_before_v(opblocks[i + 1], b_avail = l_bb_before_v(opblocks[opno + 1],
"op.%d.avail", i); "op.%d.avail", opno);
b_notavail = l_bb_before_v(opblocks[i + 1], b_notavail = l_bb_before_v(opblocks[opno + 1],
"op.%d.notavail", i); "op.%d.notavail", opno);
v_casevaluep = l_ptr_const(op->d.casetest.value, v_casevaluep = l_ptr_const(op->d.casetest.value,
l_ptr(TypeSizeT)); l_ptr(TypeSizeT));
...@@ -1193,7 +1190,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1193,7 +1190,7 @@ llvm_compile_expr(ExprState *state)
v_casenull = LLVMBuildLoad(b, v_casenullp, ""); v_casenull = LLVMBuildLoad(b, v_casenullp, "");
LLVMBuildStore(b, v_casevalue, v_resvaluep); LLVMBuildStore(b, v_casevalue, v_resvaluep);
LLVMBuildStore(b, v_casenull, v_resnullp); LLVMBuildStore(b, v_casenull, v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
/* if casetest == NULL */ /* if casetest == NULL */
LLVMPositionBuilderAtEnd(b, b_notavail); LLVMPositionBuilderAtEnd(b, b_notavail);
...@@ -1206,7 +1203,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1206,7 +1203,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_casevalue, v_resvaluep); LLVMBuildStore(b, v_casevalue, v_resvaluep);
LLVMBuildStore(b, v_casenull, v_resnullp); LLVMBuildStore(b, v_casenull, v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -1220,8 +1217,8 @@ llvm_compile_expr(ExprState *state) ...@@ -1220,8 +1217,8 @@ llvm_compile_expr(ExprState *state)
LLVMValueRef v_null; LLVMValueRef v_null;
LLVMValueRef v_value; LLVMValueRef v_value;
b_notnull = l_bb_before_v(opblocks[i + 1], b_notnull = l_bb_before_v(opblocks[opno + 1],
"op.%d.readonly.notnull", i); "op.%d.readonly.notnull", opno);
v_nullp = l_ptr_const(op->d.make_readonly.isnull, v_nullp = l_ptr_const(op->d.make_readonly.isnull,
l_ptr(TypeStorageBool)); l_ptr(TypeStorageBool));
...@@ -1235,7 +1232,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1235,7 +1232,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildCondBr(b, LLVMBuildCondBr(b,
LLVMBuildICmp(b, LLVMIntEQ, v_null, LLVMBuildICmp(b, LLVMIntEQ, v_null,
l_sbool_const(1), ""), l_sbool_const(1), ""),
opblocks[i + 1], b_notnull); opblocks[opno + 1], b_notnull);
/* if value is not null, convert to RO datum */ /* if value is not null, convert to RO datum */
LLVMPositionBuilderAtEnd(b, b_notnull); LLVMPositionBuilderAtEnd(b, b_notnull);
...@@ -1252,7 +1249,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1252,7 +1249,7 @@ llvm_compile_expr(ExprState *state)
v_params, lengthof(v_params), ""); v_params, lengthof(v_params), "");
LLVMBuildStore(b, v_ret, v_resvaluep); LLVMBuildStore(b, v_ret, v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -1280,14 +1277,14 @@ llvm_compile_expr(ExprState *state) ...@@ -1280,14 +1277,14 @@ llvm_compile_expr(ExprState *state)
fcinfo_out = op->d.iocoerce.fcinfo_data_out; fcinfo_out = op->d.iocoerce.fcinfo_data_out;
fcinfo_in = op->d.iocoerce.fcinfo_data_in; fcinfo_in = op->d.iocoerce.fcinfo_data_in;
b_skipoutput = l_bb_before_v(opblocks[i + 1], b_skipoutput = l_bb_before_v(opblocks[opno + 1],
"op.%d.skipoutputnull", i); "op.%d.skipoutputnull", opno);
b_calloutput = l_bb_before_v(opblocks[i + 1], b_calloutput = l_bb_before_v(opblocks[opno + 1],
"op.%d.calloutput", i); "op.%d.calloutput", opno);
b_input = l_bb_before_v(opblocks[i + 1], b_input = l_bb_before_v(opblocks[opno + 1],
"op.%d.input", i); "op.%d.input", opno);
b_inputcall = l_bb_before_v(opblocks[i + 1], b_inputcall = l_bb_before_v(opblocks[opno + 1],
"op.%d.inputcall", i); "op.%d.inputcall", opno);
v_fcinfo_out = l_ptr_const(fcinfo_out, l_ptr(StructFunctionCallInfoData)); v_fcinfo_out = l_ptr_const(fcinfo_out, l_ptr(StructFunctionCallInfoData));
v_fcinfo_in = l_ptr_const(fcinfo_in, l_ptr(StructFunctionCallInfoData)); v_fcinfo_in = l_ptr_const(fcinfo_in, l_ptr(StructFunctionCallInfoData));
...@@ -1355,7 +1352,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1355,7 +1352,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildCondBr(b, LLVMBuildCondBr(b,
LLVMBuildICmp(b, LLVMIntEQ, v_output, LLVMBuildICmp(b, LLVMIntEQ, v_output,
l_sizet_const(0), ""), l_sizet_const(0), ""),
opblocks[i + 1], opblocks[opno + 1],
b_inputcall); b_inputcall);
} }
else else
...@@ -1382,7 +1379,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1382,7 +1379,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_retval, v_resvaluep); LLVMBuildStore(b, v_retval, v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -1409,10 +1406,10 @@ llvm_compile_expr(ExprState *state) ...@@ -1409,10 +1406,10 @@ llvm_compile_expr(ExprState *state)
LLVMBasicBlockRef b_bothargnull; LLVMBasicBlockRef b_bothargnull;
LLVMBasicBlockRef b_anyargnull; LLVMBasicBlockRef b_anyargnull;
b_noargnull = l_bb_before_v(opblocks[i + 1], "op.%d.noargnull", i); b_noargnull = l_bb_before_v(opblocks[opno + 1], "op.%d.noargnull", opno);
b_checkbothargnull = l_bb_before_v(opblocks[i + 1], "op.%d.checkbothargnull", i); b_checkbothargnull = l_bb_before_v(opblocks[opno + 1], "op.%d.checkbothargnull", opno);
b_bothargnull = l_bb_before_v(opblocks[i + 1], "op.%d.bothargnull", i); b_bothargnull = l_bb_before_v(opblocks[opno + 1], "op.%d.bothargnull", opno);
b_anyargnull = l_bb_before_v(opblocks[i + 1], "op.%d.anyargnull", i); b_anyargnull = l_bb_before_v(opblocks[opno + 1], "op.%d.anyargnull", opno);
v_fcinfo = l_ptr_const(fcinfo, l_ptr(StructFunctionCallInfoData)); v_fcinfo = l_ptr_const(fcinfo, l_ptr(StructFunctionCallInfoData));
...@@ -1451,7 +1448,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1451,7 +1448,7 @@ llvm_compile_expr(ExprState *state)
else else
LLVMBuildStore(b, l_sizet_const(0), v_resvaluep); LLVMBuildStore(b, l_sizet_const(0), v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
/* Only one is NULL? Then is distinct... */ /* Only one is NULL? Then is distinct... */
LLVMPositionBuilderAtEnd(b, b_anyargnull); LLVMPositionBuilderAtEnd(b, b_anyargnull);
...@@ -1460,7 +1457,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1460,7 +1457,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, l_sizet_const(0), v_resvaluep); LLVMBuildStore(b, l_sizet_const(0), v_resvaluep);
else else
LLVMBuildStore(b, l_sizet_const(1), v_resvaluep); LLVMBuildStore(b, l_sizet_const(1), v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
/* neither argument is null: compare */ /* neither argument is null: compare */
LLVMPositionBuilderAtEnd(b, b_noargnull); LLVMPositionBuilderAtEnd(b, b_noargnull);
...@@ -1482,7 +1479,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1482,7 +1479,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_fcinfo_isnull, v_resnullp); LLVMBuildStore(b, v_fcinfo_isnull, v_resnullp);
LLVMBuildStore(b, v_result, v_resvaluep); LLVMBuildStore(b, v_result, v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
...@@ -1502,12 +1499,12 @@ llvm_compile_expr(ExprState *state) ...@@ -1502,12 +1499,12 @@ llvm_compile_expr(ExprState *state)
LLVMValueRef v_retval; LLVMValueRef v_retval;
LLVMValueRef v_argsequal; LLVMValueRef v_argsequal;
b_hasnull = l_bb_before_v(opblocks[i + 1], b_hasnull = l_bb_before_v(opblocks[opno + 1],
"b.%d.null-args", i); "b.%d.null-args", opno);
b_nonull = l_bb_before_v(opblocks[i + 1], b_nonull = l_bb_before_v(opblocks[opno + 1],
"b.%d.no-null-args", i); "b.%d.no-null-args", opno);
b_argsequal = l_bb_before_v(opblocks[i + 1], b_argsequal = l_bb_before_v(opblocks[opno + 1],
"b.%d.argsequal", i); "b.%d.argsequal", opno);
v_fcinfo = l_ptr_const(fcinfo, l_ptr(StructFunctionCallInfoData)); v_fcinfo = l_ptr_const(fcinfo, l_ptr(StructFunctionCallInfoData));
...@@ -1530,7 +1527,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1530,7 +1527,7 @@ llvm_compile_expr(ExprState *state)
v_arg0 = l_funcvalue(b, v_fcinfo, 0); v_arg0 = l_funcvalue(b, v_fcinfo, 0);
LLVMBuildStore(b, v_argnull0, v_resnullp); LLVMBuildStore(b, v_argnull0, v_resnullp);
LLVMBuildStore(b, v_arg0, v_resvaluep); LLVMBuildStore(b, v_arg0, v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
/* build block to invoke function and check result */ /* build block to invoke function and check result */
LLVMPositionBuilderAtEnd(b, b_nonull); LLVMPositionBuilderAtEnd(b, b_nonull);
...@@ -1560,44 +1557,44 @@ llvm_compile_expr(ExprState *state) ...@@ -1560,44 +1557,44 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, l_sizet_const(0), v_resvaluep); LLVMBuildStore(b, l_sizet_const(0), v_resvaluep);
LLVMBuildStore(b, v_retval, v_resvaluep); LLVMBuildStore(b, v_retval, v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_SQLVALUEFUNCTION: case EEOP_SQLVALUEFUNCTION:
build_EvalXFunc(b, mod, "ExecEvalSQLValueFunction", build_EvalXFunc(b, mod, "ExecEvalSQLValueFunction",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_CURRENTOFEXPR: case EEOP_CURRENTOFEXPR:
build_EvalXFunc(b, mod, "ExecEvalCurrentOfExpr", build_EvalXFunc(b, mod, "ExecEvalCurrentOfExpr",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_NEXTVALUEEXPR: case EEOP_NEXTVALUEEXPR:
build_EvalXFunc(b, mod, "ExecEvalNextValueExpr", build_EvalXFunc(b, mod, "ExecEvalNextValueExpr",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_ARRAYEXPR: case EEOP_ARRAYEXPR:
build_EvalXFunc(b, mod, "ExecEvalArrayExpr", build_EvalXFunc(b, mod, "ExecEvalArrayExpr",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_ARRAYCOERCE: case EEOP_ARRAYCOERCE:
build_EvalXFunc(b, mod, "ExecEvalArrayCoerce", build_EvalXFunc(b, mod, "ExecEvalArrayCoerce",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_ROW: case EEOP_ROW:
build_EvalXFunc(b, mod, "ExecEvalRow", build_EvalXFunc(b, mod, "ExecEvalRow",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_ROWCOMPARE_STEP: case EEOP_ROWCOMPARE_STEP:
...@@ -1610,14 +1607,14 @@ llvm_compile_expr(ExprState *state) ...@@ -1610,14 +1607,14 @@ llvm_compile_expr(ExprState *state)
LLVMValueRef v_retval; LLVMValueRef v_retval;
b_null = l_bb_before_v(opblocks[i + 1], b_null = l_bb_before_v(opblocks[opno + 1],
"op.%d.row-null", i); "op.%d.row-null", opno);
b_compare = l_bb_before_v(opblocks[i + 1], b_compare = l_bb_before_v(opblocks[opno + 1],
"op.%d.row-compare", i); "op.%d.row-compare", opno);
b_compare_result = b_compare_result =
l_bb_before_v(opblocks[i + 1], l_bb_before_v(opblocks[opno + 1],
"op.%d.row-compare-result", "op.%d.row-compare-result",
i); opno);
/* /*
* If function is strict, and either arg is null, we're * If function is strict, and either arg is null, we're
...@@ -1682,7 +1679,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1682,7 +1679,7 @@ llvm_compile_expr(ExprState *state)
LLVMIntEQ, LLVMIntEQ,
v_retval, v_retval,
l_sizet_const(0), ""), l_sizet_const(0), ""),
opblocks[i + 1], opblocks[opno + 1],
opblocks[op->d.rowcompare_step.jumpdone]); opblocks[op->d.rowcompare_step.jumpdone]);
/* /*
...@@ -1745,53 +1742,52 @@ llvm_compile_expr(ExprState *state) ...@@ -1745,53 +1742,52 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, l_sbool_const(0), v_resnullp); LLVMBuildStore(b, l_sbool_const(0), v_resnullp);
LLVMBuildStore(b, v_result, v_resvaluep); LLVMBuildStore(b, v_result, v_resvaluep);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_MINMAX: case EEOP_MINMAX:
build_EvalXFunc(b, mod, "ExecEvalMinMax", build_EvalXFunc(b, mod, "ExecEvalMinMax",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_FIELDSELECT: case EEOP_FIELDSELECT:
build_EvalXFunc(b, mod, "ExecEvalFieldSelect", build_EvalXFunc(b, mod, "ExecEvalFieldSelect",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_FIELDSTORE_DEFORM: case EEOP_FIELDSTORE_DEFORM:
build_EvalXFunc(b, mod, "ExecEvalFieldStoreDeForm", build_EvalXFunc(b, mod, "ExecEvalFieldStoreDeForm",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_FIELDSTORE_FORM: case EEOP_FIELDSTORE_FORM:
build_EvalXFunc(b, mod, "ExecEvalFieldStoreForm", build_EvalXFunc(b, mod, "ExecEvalFieldStoreForm",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_SBSREF_SUBSCRIPT: case EEOP_SBSREF_SUBSCRIPT:
{ {
LLVMValueRef v_fn;
int jumpdone = op->d.sbsref_subscript.jumpdone; int jumpdone = op->d.sbsref_subscript.jumpdone;
LLVMValueRef v_params[2]; LLVMValueRef v_params[2];
LLVMValueRef v_ret; LLVMValueRef v_ret;
v_fn = llvm_get_decl(mod, FuncExecEvalSubscriptingRef);
v_params[0] = v_state; v_params[0] = v_state;
v_params[1] = l_ptr_const(op, l_ptr(StructExprEvalStep)); v_params[1] = l_ptr_const(op, l_ptr(StructExprEvalStep));
v_ret = LLVMBuildCall(b, v_fn, v_ret =
LLVMBuildCall(b,
llvm_get_decl(mod, FuncExecEvalSubscriptingRef),
v_params, lengthof(v_params), ""); v_params, lengthof(v_params), "");
v_ret = LLVMBuildZExt(b, v_ret, TypeStorageBool, ""); v_ret = LLVMBuildZExt(b, v_ret, TypeStorageBool, "");
LLVMBuildCondBr(b, LLVMBuildCondBr(b,
LLVMBuildICmp(b, LLVMIntEQ, v_ret, LLVMBuildICmp(b, LLVMIntEQ, v_ret,
l_sbool_const(1), ""), l_sbool_const(1), ""),
opblocks[i + 1], opblocks[opno + 1],
opblocks[jumpdone]); opblocks[jumpdone]);
break; break;
} }
...@@ -1806,10 +1802,10 @@ llvm_compile_expr(ExprState *state) ...@@ -1806,10 +1802,10 @@ llvm_compile_expr(ExprState *state)
v_casenull; v_casenull;
LLVMValueRef v_casevaluenull; LLVMValueRef v_casevaluenull;
b_avail = l_bb_before_v(opblocks[i + 1], b_avail = l_bb_before_v(opblocks[opno + 1],
"op.%d.avail", i); "op.%d.avail", opno);
b_notavail = l_bb_before_v(opblocks[i + 1], b_notavail = l_bb_before_v(opblocks[opno + 1],
"op.%d.notavail", i); "op.%d.notavail", opno);
v_casevaluep = l_ptr_const(op->d.casetest.value, v_casevaluep = l_ptr_const(op->d.casetest.value,
l_ptr(TypeSizeT)); l_ptr(TypeSizeT));
...@@ -1831,7 +1827,7 @@ llvm_compile_expr(ExprState *state) ...@@ -1831,7 +1827,7 @@ llvm_compile_expr(ExprState *state)
v_casenull = LLVMBuildLoad(b, v_casenullp, ""); v_casenull = LLVMBuildLoad(b, v_casenullp, "");
LLVMBuildStore(b, v_casevalue, v_resvaluep); LLVMBuildStore(b, v_casevalue, v_resvaluep);
LLVMBuildStore(b, v_casenull, v_resnullp); LLVMBuildStore(b, v_casenull, v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
/* if casetest == NULL */ /* if casetest == NULL */
LLVMPositionBuilderAtEnd(b, b_notavail); LLVMPositionBuilderAtEnd(b, b_notavail);
...@@ -1846,38 +1842,38 @@ llvm_compile_expr(ExprState *state) ...@@ -1846,38 +1842,38 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_casevalue, v_resvaluep); LLVMBuildStore(b, v_casevalue, v_resvaluep);
LLVMBuildStore(b, v_casenull, v_resnullp); LLVMBuildStore(b, v_casenull, v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_DOMAIN_NOTNULL: case EEOP_DOMAIN_NOTNULL:
build_EvalXFunc(b, mod, "ExecEvalConstraintNotNull", build_EvalXFunc(b, mod, "ExecEvalConstraintNotNull",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_DOMAIN_CHECK: case EEOP_DOMAIN_CHECK:
build_EvalXFunc(b, mod, "ExecEvalConstraintCheck", build_EvalXFunc(b, mod, "ExecEvalConstraintCheck",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_CONVERT_ROWTYPE: case EEOP_CONVERT_ROWTYPE:
build_EvalXFunc(b, mod, "ExecEvalConvertRowtype", build_EvalXFunc(b, mod, "ExecEvalConvertRowtype",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_SCALARARRAYOP: case EEOP_SCALARARRAYOP:
build_EvalXFunc(b, mod, "ExecEvalScalarArrayOp", build_EvalXFunc(b, mod, "ExecEvalScalarArrayOp",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_XMLEXPR: case EEOP_XMLEXPR:
build_EvalXFunc(b, mod, "ExecEvalXmlExpr", build_EvalXFunc(b, mod, "ExecEvalXmlExpr",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_AGGREF: case EEOP_AGGREF:
...@@ -1905,14 +1901,14 @@ llvm_compile_expr(ExprState *state) ...@@ -1905,14 +1901,14 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, value, v_resvaluep); LLVMBuildStore(b, value, v_resvaluep);
LLVMBuildStore(b, isnull, v_resnullp); LLVMBuildStore(b, isnull, v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_GROUPING_FUNC: case EEOP_GROUPING_FUNC:
build_EvalXFunc(b, mod, "ExecEvalGroupingFunc", build_EvalXFunc(b, mod, "ExecEvalGroupingFunc",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_WINDOW_FUNC: case EEOP_WINDOW_FUNC:
...@@ -1941,20 +1937,20 @@ llvm_compile_expr(ExprState *state) ...@@ -1941,20 +1937,20 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, value, v_resvaluep); LLVMBuildStore(b, value, v_resvaluep);
LLVMBuildStore(b, isnull, v_resnullp); LLVMBuildStore(b, isnull, v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_SUBPLAN: case EEOP_SUBPLAN:
build_EvalXFunc(b, mod, "ExecEvalSubPlan", build_EvalXFunc(b, mod, "ExecEvalSubPlan",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_ALTERNATIVE_SUBPLAN: case EEOP_ALTERNATIVE_SUBPLAN:
build_EvalXFunc(b, mod, "ExecEvalAlternativeSubPlan", build_EvalXFunc(b, mod, "ExecEvalAlternativeSubPlan",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_AGG_STRICT_DESERIALIZE: case EEOP_AGG_STRICT_DESERIALIZE:
...@@ -1964,8 +1960,8 @@ llvm_compile_expr(ExprState *state) ...@@ -1964,8 +1960,8 @@ llvm_compile_expr(ExprState *state)
LLVMValueRef v_argnull0; LLVMValueRef v_argnull0;
LLVMBasicBlockRef b_deserialize; LLVMBasicBlockRef b_deserialize;
b_deserialize = l_bb_before_v(opblocks[i + 1], b_deserialize = l_bb_before_v(opblocks[opno + 1],
"op.%d.deserialize", i); "op.%d.deserialize", opno);
v_fcinfo = l_ptr_const(fcinfo, v_fcinfo = l_ptr_const(fcinfo,
l_ptr(StructFunctionCallInfoData)); l_ptr(StructFunctionCallInfoData));
...@@ -2007,18 +2003,17 @@ llvm_compile_expr(ExprState *state) ...@@ -2007,18 +2003,17 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_retval, v_resvaluep); LLVMBuildStore(b, v_retval, v_resvaluep);
LLVMBuildStore(b, v_fcinfo_isnull, v_resnullp); LLVMBuildStore(b, v_fcinfo_isnull, v_resnullp);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_AGG_STRICT_INPUT_CHECK_NULLS:
case EEOP_AGG_STRICT_INPUT_CHECK_ARGS: case EEOP_AGG_STRICT_INPUT_CHECK_ARGS:
case EEOP_AGG_STRICT_INPUT_CHECK_NULLS:
{ {
int nargs = op->d.agg_strict_input_check.nargs; int nargs = op->d.agg_strict_input_check.nargs;
NullableDatum *args = op->d.agg_strict_input_check.args; NullableDatum *args = op->d.agg_strict_input_check.args;
bool *nulls = op->d.agg_strict_input_check.nulls; bool *nulls = op->d.agg_strict_input_check.nulls;
int jumpnull; int jumpnull;
int argno;
LLVMValueRef v_argsp; LLVMValueRef v_argsp;
LLVMValueRef v_nullsp; LLVMValueRef v_nullsp;
...@@ -2032,18 +2027,18 @@ llvm_compile_expr(ExprState *state) ...@@ -2032,18 +2027,18 @@ llvm_compile_expr(ExprState *state)
/* create blocks for checking args */ /* create blocks for checking args */
b_checknulls = palloc(sizeof(LLVMBasicBlockRef *) * nargs); b_checknulls = palloc(sizeof(LLVMBasicBlockRef *) * nargs);
for (argno = 0; argno < nargs; argno++) for (int argno = 0; argno < nargs; argno++)
{ {
b_checknulls[argno] = b_checknulls[argno] =
l_bb_before_v(opblocks[i + 1], l_bb_before_v(opblocks[opno + 1],
"op.%d.check-null.%d", "op.%d.check-null.%d",
i, argno); opno, argno);
} }
LLVMBuildBr(b, b_checknulls[0]); LLVMBuildBr(b, b_checknulls[0]);
/* strict function, check for NULL args */ /* strict function, check for NULL args */
for (argno = 0; argno < nargs; argno++) for (int argno = 0; argno < nargs; argno++)
{ {
LLVMValueRef v_argno = l_int32_const(argno); LLVMValueRef v_argno = l_int32_const(argno);
LLVMValueRef v_argisnull; LLVMValueRef v_argisnull;
...@@ -2052,7 +2047,7 @@ llvm_compile_expr(ExprState *state) ...@@ -2052,7 +2047,7 @@ llvm_compile_expr(ExprState *state)
LLVMPositionBuilderAtEnd(b, b_checknulls[argno]); LLVMPositionBuilderAtEnd(b, b_checknulls[argno]);
if (argno + 1 == nargs) if (argno + 1 == nargs)
b_argnotnull = opblocks[i + 1]; b_argnotnull = opblocks[opno + 1];
else else
b_argnotnull = b_checknulls[argno + 1]; b_argnotnull = b_checknulls[argno + 1];
...@@ -2129,14 +2124,14 @@ llvm_compile_expr(ExprState *state) ...@@ -2129,14 +2124,14 @@ llvm_compile_expr(ExprState *state)
FIELDNO_AGGSTATEPERGROUPDATA_NOTRANSVALUE, FIELDNO_AGGSTATEPERGROUPDATA_NOTRANSVALUE,
"notransvalue"); "notransvalue");
b_init = l_bb_before_v(opblocks[i + 1], b_init = l_bb_before_v(opblocks[opno + 1],
"op.%d.inittrans", i); "op.%d.inittrans", opno);
LLVMBuildCondBr(b, LLVMBuildCondBr(b,
LLVMBuildICmp(b, LLVMIntEQ, v_notransvalue, LLVMBuildICmp(b, LLVMIntEQ, v_notransvalue,
l_sbool_const(1), ""), l_sbool_const(1), ""),
b_init, b_init,
opblocks[i + 1]); opblocks[opno + 1]);
LLVMPositionBuilderAtEnd(b, b_init); LLVMPositionBuilderAtEnd(b, b_init);
...@@ -2223,7 +2218,7 @@ llvm_compile_expr(ExprState *state) ...@@ -2223,7 +2218,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildICmp(b, LLVMIntEQ, v_transnull, LLVMBuildICmp(b, LLVMIntEQ, v_transnull,
l_sbool_const(1), ""), l_sbool_const(1), ""),
opblocks[jumpnull], opblocks[jumpnull],
opblocks[i + 1]); opblocks[opno + 1]);
break; break;
} }
...@@ -2360,10 +2355,10 @@ llvm_compile_expr(ExprState *state) ...@@ -2360,10 +2355,10 @@ llvm_compile_expr(ExprState *state)
LLVMValueRef v_newval; LLVMValueRef v_newval;
LLVMValueRef params[6]; LLVMValueRef params[6];
b_call = l_bb_before_v(opblocks[i + 1], b_call = l_bb_before_v(opblocks[opno + 1],
"op.%d.transcall", i); "op.%d.transcall", opno);
b_nocall = l_bb_before_v(opblocks[i + 1], b_nocall = l_bb_before_v(opblocks[opno + 1],
"op.%d.transnocall", i); "op.%d.transnocall", opno);
v_transvalue = LLVMBuildLoad(b, v_transvaluep, ""); v_transvalue = LLVMBuildLoad(b, v_transvaluep, "");
v_transnull = LLVMBuildLoad(b, v_transnullp, ""); v_transnull = LLVMBuildLoad(b, v_transnullp, "");
...@@ -2401,7 +2396,7 @@ llvm_compile_expr(ExprState *state) ...@@ -2401,7 +2396,7 @@ llvm_compile_expr(ExprState *state)
LLVMBuildStore(b, v_fcinfo_isnull, v_transnullp); LLVMBuildStore(b, v_fcinfo_isnull, v_transnullp);
l_mcxt_switch(mod, b, v_oldcontext); l_mcxt_switch(mod, b, v_oldcontext);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
/* returned datum passed datum, no need to reparent */ /* returned datum passed datum, no need to reparent */
LLVMPositionBuilderAtEnd(b, b_nocall); LLVMPositionBuilderAtEnd(b, b_nocall);
...@@ -2413,20 +2408,20 @@ llvm_compile_expr(ExprState *state) ...@@ -2413,20 +2408,20 @@ llvm_compile_expr(ExprState *state)
l_mcxt_switch(mod, b, v_oldcontext); l_mcxt_switch(mod, b, v_oldcontext);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
} }
case EEOP_AGG_ORDERED_TRANS_DATUM: case EEOP_AGG_ORDERED_TRANS_DATUM:
build_EvalXFunc(b, mod, "ExecEvalAggOrderedTransDatum", build_EvalXFunc(b, mod, "ExecEvalAggOrderedTransDatum",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_AGG_ORDERED_TRANS_TUPLE: case EEOP_AGG_ORDERED_TRANS_TUPLE:
build_EvalXFunc(b, mod, "ExecEvalAggOrderedTransTuple", build_EvalXFunc(b, mod, "ExecEvalAggOrderedTransTuple",
v_state, v_econtext, op); v_state, v_econtext, op);
LLVMBuildBr(b, opblocks[i + 1]); LLVMBuildBr(b, opblocks[opno + 1]);
break; break;
case EEOP_LAST: case EEOP_LAST:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment