mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Add expression compilation support to LLVM JIT provider.
In addition to the interpretation of expressions (which back evaluation of WHERE clauses, target list projection, aggregates transition values etc) support compiling expressions to native code, using the infrastructure added in earlier commits. To avoid duplicating a lot of code, only support emitting code for cases that are likely to be performance critical. For expression steps that aren't deemed that, use the existing interpreter. The generated code isn't great - some architectural changes are required to address that. But this already yields a significant speedup for some analytics queries, particularly with WHERE clauses filtering a lot, or computing multiple aggregates. Author: Andres Freund Tested-By: Thomas Munro Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de Disable JITing for VALUES() nodes. VALUES() nodes are only ever executed once. This is primarily helpful for debugging, when forcing JITing even for cheap queries. Author: Andres Freund Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
This commit is contained in:
@ -29,6 +29,7 @@ extern "C"
|
||||
#endif
|
||||
|
||||
|
||||
#include "fmgr.h"
|
||||
#include "jit/jit.h"
|
||||
#include "nodes/pg_list.h"
|
||||
|
||||
@ -91,8 +92,19 @@ 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 void llvm_copy_attributes(LLVMValueRef from, LLVMValueRef to);
|
||||
extern LLVMValueRef llvm_function_reference(LLVMJitContext *context,
|
||||
LLVMBuilderRef builder,
|
||||
LLVMModuleRef mod,
|
||||
FunctionCallInfo fcinfo);
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* Code ceneration functions.
|
||||
****************************************************************************
|
||||
*/
|
||||
extern bool llvm_compile_expr(struct ExprState *state);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* Extensions / Backward compatibility section of the LLVM C API
|
||||
|
Reference in New Issue
Block a user