/* types & functions commonly needed for JITing */
LLVMTypeRef TypeSizeT;
+LLVMTypeRef TypePGFunction;
+LLVMTypeRef StructHeapTupleFieldsField3;
+LLVMTypeRef StructHeapTupleFields;
+LLVMTypeRef StructHeapTupleHeaderData;
+LLVMTypeRef StructHeapTupleDataChoice;
+LLVMTypeRef StructHeapTupleData;
+LLVMTypeRef StructMinimalTupleData;
+LLVMTypeRef StructItemPointerData;
+LLVMTypeRef StructBlockId;
+LLVMTypeRef StructFormPgAttribute;
+LLVMTypeRef StructTupleConstr;
+LLVMTypeRef StructtupleDesc;
+LLVMTypeRef StructTupleTableSlot;
+LLVMTypeRef StructMemoryContextData;
+LLVMTypeRef StructPGFinfoRecord;
+LLVMTypeRef StructFmgrInfo;
+LLVMTypeRef StructFunctionCallInfoData;
+LLVMTypeRef StructExprContext;
+LLVMTypeRef StructExprEvalStep;
+LLVMTypeRef StructExprState;
+LLVMTypeRef StructAggState;
+LLVMTypeRef StructAggStatePerGroupData;
+LLVMTypeRef StructAggStatePerTransData;
LLVMValueRef AttributeTemplate;
LLVMValueRef FuncStrlen;
+LLVMValueRef FuncSlotGetsomeattrs;
+LLVMValueRef FuncHeapGetsysattr;
+LLVMValueRef FuncMakeExpandedObjectReadOnlyInternal;
+LLVMValueRef FuncExecEvalArrayRefSubscript;
+LLVMValueRef FuncExecAggTransReparent;
+LLVMValueRef FuncExecAggInitGroup;
static bool llvm_session_initialized = false;
llvm_layout = pstrdup(LLVMGetDataLayoutStr(mod));
TypeSizeT = load_type(mod, "TypeSizeT");
+ TypePGFunction = load_type(mod, "TypePGFunction");
+ StructExprContext = load_type(mod, "StructExprContext");
+ StructExprEvalStep = load_type(mod, "StructExprEvalStep");
+ StructExprState = load_type(mod, "StructExprState");
+ StructFunctionCallInfoData = load_type(mod, "StructFunctionCallInfoData");
+ StructMemoryContextData = load_type(mod, "StructMemoryContextData");
+ StructTupleTableSlot = load_type(mod, "StructTupleTableSlot");
+ StructHeapTupleData = load_type(mod, "StructHeapTupleData");
+ StructtupleDesc = load_type(mod, "StructtupleDesc");
+ StructAggState = load_type(mod, "StructAggState");
+ StructAggStatePerGroupData = load_type(mod, "StructAggStatePerGroupData");
+ StructAggStatePerTransData = load_type(mod, "StructAggStatePerTransData");
AttributeTemplate = LLVMGetNamedFunction(mod, "AttributeTemplate");
FuncStrlen = LLVMGetNamedFunction(mod, "strlen");
+ FuncSlotGetsomeattrs = LLVMGetNamedFunction(mod, "slot_getsomeattrs");
+ FuncHeapGetsysattr = LLVMGetNamedFunction(mod, "heap_getsysattr");
+ FuncMakeExpandedObjectReadOnlyInternal = LLVMGetNamedFunction(mod, "MakeExpandedObjectReadOnlyInternal");
+ FuncExecEvalArrayRefSubscript = LLVMGetNamedFunction(mod, "ExecEvalArrayRefSubscript");
+ FuncExecAggTransReparent = LLVMGetNamedFunction(mod, "ExecAggTransReparent");
+ FuncExecAggInitGroup = LLVMGetNamedFunction(mod, "ExecAggInitGroup");
/*
* Leave the module alive, otherwise references to function would be
#include "postgres.h"
+#include "access/htup.h"
+#include "access/htup_details.h"
+#include "access/tupdesc.h"
+#include "catalog/pg_attribute.h"
+#include "executor/execExpr.h"
+#include "executor/nodeAgg.h"
+#include "executor/tuptable.h"
+#include "fmgr.h"
+#include "nodes/execnodes.h"
+#include "nodes/memnodes.h"
+#include "utils/expandeddatum.h"
+#include "utils/palloc.h"
/*
* List of types needed for JITing. These have to be non-static, otherwise
* anything, that's harmless.
*/
size_t TypeSizeT;
+PGFunction TypePGFunction;
+
+AggState StructAggState;
+AggStatePerGroupData StructAggStatePerGroupData;
+AggStatePerTransData StructAggStatePerTransData;
+ExprContext StructExprContext;
+ExprEvalStep StructExprEvalStep;
+ExprState StructExprState;
+FunctionCallInfoData StructFunctionCallInfoData;
+HeapTupleData StructHeapTupleData;
+MemoryContextData StructMemoryContextData;
+TupleTableSlot StructTupleTableSlot;
+struct tupleDesc StructtupleDesc;
/*
*/
void *referenced_functions[] =
{
- strlen
+ strlen,
+ slot_getsomeattrs,
+ heap_getsysattr,
+ MakeExpandedObjectReadOnlyInternal,
+ ExecEvalArrayRefSubscript,
+ ExecAggTransReparent,
+ ExecAggInitGroup
};
/* type and struct definitions */
extern LLVMTypeRef TypeSizeT;
+extern LLVMTypeRef TypePGFunction;
+extern LLVMTypeRef StructtupleDesc;
+extern LLVMTypeRef StructHeapTupleData;
+extern LLVMTypeRef StructTupleTableSlot;
+extern LLVMTypeRef StructMemoryContextData;
+extern LLVMTypeRef StructFunctionCallInfoData;
+extern LLVMTypeRef StructExprContext;
+extern LLVMTypeRef StructExprEvalStep;
+extern LLVMTypeRef StructExprState;
+extern LLVMTypeRef StructAggState;
+extern LLVMTypeRef StructAggStatePerTransData;
+extern LLVMTypeRef StructAggStatePerGroupData;
extern LLVMValueRef AttributeTemplate;
extern LLVMValueRef FuncStrlen;
+extern LLVMValueRef FuncSlotGetsomeattrs;
+extern LLVMValueRef FuncHeapGetsysattr;
+extern LLVMValueRef FuncMakeExpandedObjectReadOnlyInternal;
+extern LLVMValueRef FuncExecEvalArrayRefSubscript;
+extern LLVMValueRef FuncExecAggTransReparent;
+extern LLVMValueRef FuncExecAggInitGroup;
extern void llvm_enter_fatal_on_oom(void);