Add expression compilation support to LLVM JIT provider.
authorAndres Freund <andres@anarazel.de>
Tue, 20 Mar 2018 09:20:46 +0000 (02:20 -0700)
committerAndres Freund <andres@anarazel.de>
Thu, 22 Mar 2018 21:45:59 +0000 (14:45 -0700)
commit2a0faed9d7028e3830998bd6ca900be651274e27
tree0ab54ad8ac5c5d97d7a4dcee4c2d99c7959af2f6
parent7ced1d1247286399df53823eb76cacaf6d7fdb22
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
13 files changed:
src/backend/executor/execExpr.c
src/backend/executor/nodeValuesscan.c
src/backend/jit/jit.c
src/backend/jit/llvm/Makefile
src/backend/jit/llvm/llvmjit.c
src/backend/jit/llvm/llvmjit_expr.c [new file with mode: 0644]
src/backend/optimizer/plan/planner.c
src/backend/utils/fmgr/fmgr.c
src/backend/utils/misc/guc.c
src/include/fmgr.h
src/include/jit/jit.h
src/include/jit/llvmjit.h
src/tools/pgindent/typedefs.list