mesa/src/compiler/SConscript.nir
Rob Clark 76dfed8ae2 nir: mako all the intrinsics
I threatened to do this a long time ago.. I probably *should* have done
it a long time ago when there where many fewer intrinsics.  But the
system of macro/#include magic for dealing with intrinsics is a bit
annoying, and python has the nice property of optional fxn params,
making it possible to define new intrinsics while ignoring parameters
that are not applicable (and naming optional params).  And not having to
specify various array lengths explicitly is nice too.

I think the end result makes it easier to add new intrinsics.

v2: couple small fixes found with a test program to compare the old and
    new tables
v3: misc comments, don't rely on capture=true for meson.build, get rid
    of system_values table to avoid return value of intrinsic() and
    *mostly* remove side-effects, add autotools build support
v4: scons build

Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
2018-03-27 08:36:37 -04:00

90 lines
2 KiB
Text

import common
Import('*')
from sys import executable as python_cmd
env = env.Clone()
env.MSVC2013Compat()
env.Prepend(CPPPATH = [
'#include',
'#src',
'#src/mapi',
'#src/mesa',
'#src/gallium/include',
'#src/gallium/auxiliary',
'#src/compiler/nir',
])
# Make generated headers reachable from the include path.
env.Prepend(CPPPATH = [Dir('.').abspath, Dir('glsl').abspath])
env.Prepend(CPPPATH = [Dir('.').abspath, Dir('nir').abspath])
# nir generated sources
nir_builder_opcodes_h = env.CodeGenerate(
target = 'nir/nir_builder_opcodes.h',
script = 'nir/nir_builder_opcodes_h.py',
source = [],
command = python_cmd + ' $SCRIPT > $TARGET'
)
env.CodeGenerate(
target = 'nir/nir_constant_expressions.c',
script = 'nir/nir_constant_expressions.py',
source = [],
command = python_cmd + ' $SCRIPT > $TARGET'
)
env.CodeGenerate(
target = 'nir/nir_opcodes.h',
script = 'nir/nir_opcodes_h.py',
source = [],
command = python_cmd + ' $SCRIPT > $TARGET'
)
env.CodeGenerate(
target = 'nir/nir_opcodes.c',
script = 'nir/nir_opcodes_c.py',
source = [],
command = python_cmd + ' $SCRIPT > $TARGET'
)
env.CodeGenerate(
target = 'nir/nir_opt_algebraic.c',
script = 'nir/nir_opt_algebraic.py',
source = [],
command = python_cmd + ' $SCRIPT > $TARGET'
)
bldroot = Dir('.').abspath
env.CodeGenerate(
target = 'nir/nir_intrinsics.h',
script = 'nir/nir_intrinsics_h.py',
source = [],
command = python_cmd + ' $SCRIPT --outdir ' + bldroot + '/nir'
)
env.CodeGenerate(
target = 'nir/nir_intrinsics.c',
script = 'nir/nir_intrinsics_c.py',
source = [],
command = python_cmd + ' $SCRIPT --outdir ' + bldroot + '/nir'
)
# parse Makefile.sources
source_lists = env.ParseSourceList('Makefile.sources')
nir_sources = source_lists['NIR_FILES']
nir_sources += source_lists['NIR_GENERATED_FILES']
nir = env.ConvenienceLibrary(
target = 'nir',
source = nir_sources,
)
env.Alias('nir', nir)
Export('nir')