From b059d2f45685a946da061ee15692fa306bd67f12 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Thu, 6 Feb 2020 22:13:52 -0800 Subject: jit: Reference expression step functions via llvmjit_types. The main benefit of doing so is that this allows llvm to ensure that types match - previously that'd only be detected by a crash within the called function. There were a number of cases where we passed a superfluous parameter... To avoid needing to add all the functions to llvmjit.{c,h}, instead get them from the llvm module for llvmjit_types.c. Also use that for the functions from llvmjit_types already in llvmjit.h. Author: Soumyadeep Chakraborty and Andres Freund Discussion: https://postgr.es/m/CADwEdooww3wZv-sXSfatzFRwMuwa186LyTwkBfwEW6NjtooBPA@mail.gmail.com --- src/include/jit/llvmjit.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/include') diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h index a4eaa827354..706906c1cc8 100644 --- a/src/include/jit/llvmjit.h +++ b/src/include/jit/llvmjit.h @@ -55,6 +55,8 @@ typedef struct LLVMJitContext List *handles; } LLVMJitContext; +/* llvm module containing information about types */ +extern LLVMModuleRef llvm_types_module; /* type and struct definitions */ extern LLVMTypeRef TypeParamBool; @@ -78,15 +80,6 @@ extern LLVMTypeRef StructAggStatePerTransData; extern LLVMTypeRef StructAggStatePerGroupData; extern LLVMValueRef AttributeTemplate; -extern LLVMValueRef FuncStrlen; -extern LLVMValueRef FuncVarsizeAny; -extern LLVMValueRef FuncSlotGetmissingattrs; -extern LLVMValueRef FuncSlotGetsomeattrsInt; -extern LLVMValueRef FuncMakeExpandedObjectReadOnlyInternal; -extern LLVMValueRef FuncExecEvalSubscriptingRef; -extern LLVMValueRef FuncExecEvalSysVar; -extern LLVMValueRef FuncExecAggTransReparent; -extern LLVMValueRef FuncExecAggInitGroup; extern void llvm_enter_fatal_on_oom(void); @@ -99,7 +92,7 @@ extern LLVMModuleRef llvm_mutable_module(LLVMJitContext *context); extern char *llvm_expand_funcname(LLVMJitContext *context, const char *basename); extern void *llvm_get_function(LLVMJitContext *context, const char *funcname); extern void llvm_split_symbol_name(const char *name, char **modname, char **funcname); -extern LLVMValueRef llvm_get_decl(LLVMModuleRef mod, LLVMValueRef f); +extern LLVMValueRef llvm_pg_func(LLVMModuleRef mod, const char *funcname); extern void llvm_copy_attributes(LLVMValueRef from, LLVMValueRef to); extern LLVMValueRef llvm_function_reference(LLVMJitContext *context, LLVMBuilderRef builder, -- cgit v1.2.3