1 # Copyright (c) 2022-2024, PostgreSQL Global Development Group
7 # Build LLVM JIT backend module
12 llvmjit_sources += files(
20 llvmjit_sources += files(
25 if host_system == 'windows'
26 llvmjit_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
28 '--FILEDESC', 'llvmjit - JIT using LLVM',])
31 llvmjit = shared_module('llvmjit',
33 kwargs: pg_mod_args + {
34 'dependencies': pg_mod_args['dependencies'] + [llvm],
35 'cpp_args': pg_mod_args['cpp_args'] + llvm.get_variable(configtool: 'cxxflags').split(),
39 backend_targets += llvmjit
42 # Define a few bits and pieces used here and elsewhere to generate bitcode
45 '-c', '-o', '@OUTPUT@', '@INPUT@',
46 '-flto=thin', '-emit-llvm',
47 '-MD', '-MQ', '@OUTPUT@', '-MF', '@DEPFILE@',
49 '-Wno-ignored-attributes',
54 llvm_irgen_command = ccache
55 llvm_irgen_args = [clang.path()] + llvm_irgen_args
57 llvm_irgen_command = clang
61 # XXX: Need to determine proper version of the function cflags for clang
62 bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv']
63 bitcode_cflags += get_option('c_args')
64 bitcode_cflags += cppflags
66 # XXX: Worth improving on the logic to find directories here
67 bitcode_cflags += '-I@BUILD_ROOT@/src/include'
68 bitcode_cflags += '-I@BUILD_ROOT@/src/backend/utils/misc'
69 bitcode_cflags += '-I@SOURCE_ROOT@/src/include'
72 # Note this is intentionally not installed to bitcodedir, as it's not for
74 llvmjit_types = custom_target('llvmjit_types.bc',
75 command: [llvm_irgen_command] + llvm_irgen_args + bitcode_cflags,
76 input: 'llvmjit_types.c',
77 output: 'llvmjit_types.bc',
80 install_dir: dir_lib_pkg,
81 depfile: '@BASENAME@.c.bc.d',
83 backend_targets += llvmjit_types