Virtual tuple table slots never need tuple deforming. Therefore, if we
know at expression compilation time, that a certain slot will always
be virtual, there's no need to create a tuple deforming routine for
it.
Author: Andres Freund
Discussion: https://postgr.es/m/
20181105210039.hh4vvi4vwoq5ba2q@alap3.anarazel.de
* Create a function that deforms a tuple of type desc up to natts columns.
*/
LLVMValueRef
-slot_compile_deform(LLVMJitContext *context, TupleDesc desc, int natts)
+slot_compile_deform(LLVMJitContext *context, TupleDesc desc,
+ const TupleTableSlotOps *ops, int natts)
{
char *funcname;
int attnum;
+ /* virtual tuples never need deforming, so don't generate code */
+ if (ops == &TTSOpsVirtual)
+ return NULL;
+
mod = llvm_mutable_module(context);
funcname = llvm_expand_funcname(context, "deform");
{
l_jit_deform =
slot_compile_deform(context, desc,
+ tts_ops,
op->d.fetch.last_var);
}
****************************************************************************
*/
extern bool llvm_compile_expr(struct ExprState *state);
-extern LLVMValueRef slot_compile_deform(struct LLVMJitContext *context, TupleDesc desc, int natts);
+struct TupleTableSlotOps;
+extern LLVMValueRef slot_compile_deform(struct LLVMJitContext *context, TupleDesc desc,
+ const struct TupleTableSlotOps *ops, int natts);
/*
****************************************************************************