diff options
| author | Andres Freund | 2018-03-23 05:15:51 +0000 |
|---|---|---|
| committer | Andres Freund | 2018-03-23 05:15:51 +0000 |
| commit | 2111a48a0c5e5198a68cba0c8fb82c4f61be5928 (patch) | |
| tree | 9023a35057ba617c55ff67d8648901bdf6b5b62e /src/include/jit | |
| parent | fdb78948d89b5cc018e3dbf851fafd1652cb5921 (diff) | |
Adapt expression JIT to stdbool.h introduction.
The LLVM JIT provider uses clang to synchronize types between normal C
code and runtime generated code. Clang represents stdbool.h style
booleans in return values & parameters differently from booleans
stored in variables.
Thus the expression compilation code from 2a0faed9d needs to be
adapted to 9a95a77d9. Instead of hardcoding i8 as the type for
booleans (which already was wrong on some edge case platforms!), use
postgres' notion of a boolean as used for storage and for parameters.
Per buildfarm animal xenodermus.
Author: Andres Freund
Diffstat (limited to 'src/include/jit')
| -rw-r--r-- | src/include/jit/llvmjit.h | 5 | ||||
| -rw-r--r-- | src/include/jit/llvmjit_emit.h | 18 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h index 0c97d231f1d..cc908477e8e 100644 --- a/src/include/jit/llvmjit.h +++ b/src/include/jit/llvmjit.h @@ -56,8 +56,11 @@ typedef struct LLVMJitContext /* type and struct definitions */ -extern LLVMTypeRef TypeSizeT; +extern LLVMTypeRef TypeParamBool; extern LLVMTypeRef TypePGFunction; +extern LLVMTypeRef TypeSizeT; +extern LLVMTypeRef TypeStorageBool; + extern LLVMTypeRef StructtupleDesc; extern LLVMTypeRef StructHeapTupleData; extern LLVMTypeRef StructTupleTableSlot; diff --git a/src/include/jit/llvmjit_emit.h b/src/include/jit/llvmjit_emit.h index 374c8335ba1..0d1b246f42a 100644 --- a/src/include/jit/llvmjit_emit.h +++ b/src/include/jit/llvmjit_emit.h @@ -79,6 +79,24 @@ l_sizet_const(size_t i) } /* + * Emit constant boolean, as used for storage (e.g. global vars, structs). + */ +static inline LLVMValueRef +l_sbool_const(bool i) +{ + return LLVMConstInt(TypeStorageBool, (int) i, false); +} + +/* + * Emit constant boolean, as used for parameters (e.g. function parameters). + */ +static inline LLVMValueRef +l_pbool_const(bool i) +{ + return LLVMConstInt(TypeParamBool, (int) i, false); +} + +/* * Load a pointer member idx from a struct. */ static inline LLVMValueRef |
