1bf215546Sopenharmony_ci# Copyright © 2018 Rob Clark
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy
4bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal
5bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights
6bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is
8bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions:
9bf215546Sopenharmony_ci
10bf215546Sopenharmony_ci# The above copyright notice and this permission notice shall be included in
11bf215546Sopenharmony_ci# all copies or substantial portions of the Software.
12bf215546Sopenharmony_ci
13bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19bf215546Sopenharmony_ci# SOFTWARE.
20bf215546Sopenharmony_ci
21bf215546Sopenharmony_ciir3_nir_trig_c = custom_target(
22bf215546Sopenharmony_ci  'ir3_nir_trig.c',
23bf215546Sopenharmony_ci  input : 'ir3_nir_trig.py',
24bf215546Sopenharmony_ci  output : 'ir3_nir_trig.c',
25bf215546Sopenharmony_ci  command : [
26bf215546Sopenharmony_ci    prog_python, '@INPUT@',
27bf215546Sopenharmony_ci    '-p', join_paths(meson.source_root(), 'src/compiler/nir/'),
28bf215546Sopenharmony_ci  ],
29bf215546Sopenharmony_ci  capture : true,
30bf215546Sopenharmony_ci  depend_files : nir_algebraic_depends,
31bf215546Sopenharmony_ci)
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ciir3_nir_imul_c = custom_target(
34bf215546Sopenharmony_ci  'ir3_nir_imul.c',
35bf215546Sopenharmony_ci  input : 'ir3_nir_imul.py',
36bf215546Sopenharmony_ci  output : 'ir3_nir_imul.c',
37bf215546Sopenharmony_ci  command : [
38bf215546Sopenharmony_ci    prog_python, '@INPUT@',
39bf215546Sopenharmony_ci    '-p', join_paths(meson.source_root(), 'src/compiler/nir/'),
40bf215546Sopenharmony_ci  ],
41bf215546Sopenharmony_ci  capture : true,
42bf215546Sopenharmony_ci  depend_files : nir_algebraic_depends,
43bf215546Sopenharmony_ci)
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_ciir3_parser = custom_target(
46bf215546Sopenharmony_ci  'ir3_parser.[ch]',
47bf215546Sopenharmony_ci  input: 'ir3_parser.y',
48bf215546Sopenharmony_ci  output: ['ir3_parser.c', 'ir3_parser.h'],
49bf215546Sopenharmony_ci  command: [
50bf215546Sopenharmony_ci    prog_bison, '@INPUT@', '--name-prefix=ir3_yy', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'
51bf215546Sopenharmony_ci  ]
52bf215546Sopenharmony_ci)
53bf215546Sopenharmony_ci
54bf215546Sopenharmony_ciir3_lexer = custom_target(
55bf215546Sopenharmony_ci  'ir3_lexer.c',
56bf215546Sopenharmony_ci  input: 'ir3_lexer.l',
57bf215546Sopenharmony_ci  output: 'ir3_lexer.c',
58bf215546Sopenharmony_ci  command: [
59bf215546Sopenharmony_ci    prog_flex, '-o', '@OUTPUT@', '@INPUT@'
60bf215546Sopenharmony_ci  ]
61bf215546Sopenharmony_ci)
62bf215546Sopenharmony_ci
63bf215546Sopenharmony_cilibfreedreno_ir3_files = files(
64bf215546Sopenharmony_ci  'disasm-a3xx.c',
65bf215546Sopenharmony_ci  'instr-a3xx.h',
66bf215546Sopenharmony_ci  'ir3.c',
67bf215546Sopenharmony_ci  'ir3_a4xx.c',
68bf215546Sopenharmony_ci  'ir3_a6xx.c',
69bf215546Sopenharmony_ci  'ir3_array_to_ssa.c',
70bf215546Sopenharmony_ci  'ir3_assembler.c',
71bf215546Sopenharmony_ci  'ir3_assembler.h',
72bf215546Sopenharmony_ci  'ir3_compiler_nir.c',
73bf215546Sopenharmony_ci  'ir3_compiler.c',
74bf215546Sopenharmony_ci  'ir3_compiler.h',
75bf215546Sopenharmony_ci  'ir3_context.c',
76bf215546Sopenharmony_ci  'ir3_context.h',
77bf215546Sopenharmony_ci  'ir3_cf.c',
78bf215546Sopenharmony_ci  'ir3_cp.c',
79bf215546Sopenharmony_ci  'ir3_cse.c',
80bf215546Sopenharmony_ci  'ir3_dce.c',
81bf215546Sopenharmony_ci  'ir3_delay.c',
82bf215546Sopenharmony_ci  'ir3_dominance.c',
83bf215546Sopenharmony_ci  'ir3_disk_cache.c',
84bf215546Sopenharmony_ci  'ir3_image.c',
85bf215546Sopenharmony_ci  'ir3_image.h',
86bf215546Sopenharmony_ci  'ir3.h',
87bf215546Sopenharmony_ci  'ir3_legalize.c',
88bf215546Sopenharmony_ci  'ir3_legalize_relative.c',
89bf215546Sopenharmony_ci  'ir3_liveness.c',
90bf215546Sopenharmony_ci  'ir3_lower_parallelcopy.c',
91bf215546Sopenharmony_ci  'ir3_lower_spill.c',
92bf215546Sopenharmony_ci  'ir3_lower_subgroups.c',
93bf215546Sopenharmony_ci  'ir3_merge_regs.c',
94bf215546Sopenharmony_ci  'ir3_nir.c',
95bf215546Sopenharmony_ci  'ir3_nir.h',
96bf215546Sopenharmony_ci  'ir3_nir_analyze_ubo_ranges.c',
97bf215546Sopenharmony_ci  'ir3_nir_lower_64b.c',
98bf215546Sopenharmony_ci  'ir3_nir_lower_load_barycentric_at_sample.c',
99bf215546Sopenharmony_ci  'ir3_nir_lower_load_barycentric_at_offset.c',
100bf215546Sopenharmony_ci  'ir3_nir_lower_io_offsets.c',
101bf215546Sopenharmony_ci  'ir3_nir_lower_tess.c',
102bf215546Sopenharmony_ci  'ir3_nir_lower_tex_prefetch.c',
103bf215546Sopenharmony_ci  'ir3_nir_lower_wide_load_store.c',
104bf215546Sopenharmony_ci  'ir3_nir_move_varying_inputs.c',
105bf215546Sopenharmony_ci  'ir3_nir_opt_preamble.c',
106bf215546Sopenharmony_ci  'ir3_postsched.c',
107bf215546Sopenharmony_ci  'ir3_print.c',
108bf215546Sopenharmony_ci  'ir3_ra.c',
109bf215546Sopenharmony_ci  'ir3_ra.h',
110bf215546Sopenharmony_ci  'ir3_ra_validate.c',
111bf215546Sopenharmony_ci  'ir3_remove_unreachable.c',
112bf215546Sopenharmony_ci  'ir3_sched.c',
113bf215546Sopenharmony_ci  'ir3_shader.c',
114bf215546Sopenharmony_ci  'ir3_shader.h',
115bf215546Sopenharmony_ci  'ir3_spill.c',
116bf215546Sopenharmony_ci  'ir3_validate.c',
117bf215546Sopenharmony_ci)
118bf215546Sopenharmony_ci
119bf215546Sopenharmony_cilibfreedreno_ir3 = static_library(
120bf215546Sopenharmony_ci  'freedreno_ir3',
121bf215546Sopenharmony_ci  [libfreedreno_ir3_files, ir3_nir_trig_c, ir3_nir_imul_c, ir3_parser[0], ir3_parser[1], ir3_lexer],
122bf215546Sopenharmony_ci  include_directories : [inc_freedreno, inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
123bf215546Sopenharmony_ci  c_args : [no_override_init_args],
124bf215546Sopenharmony_ci  gnu_symbol_visibility : 'hidden',
125bf215546Sopenharmony_ci  link_with: [libir3decode, libir3encode, libfreedreno_common],
126bf215546Sopenharmony_ci  dependencies : [idep_nir_headers, dep_dl, idep_mesautil],
127bf215546Sopenharmony_ci  build_by_default : false,
128bf215546Sopenharmony_ci)
129bf215546Sopenharmony_ci
130bf215546Sopenharmony_citest('ir3_disasm',
131bf215546Sopenharmony_ci  executable(
132bf215546Sopenharmony_ci    'ir3_disasm',
133bf215546Sopenharmony_ci    'tests/disasm.c',
134bf215546Sopenharmony_ci    link_args : [ld_args_build_id],
135bf215546Sopenharmony_ci    link_with: [libfreedreno_ir3, libir3decode],
136bf215546Sopenharmony_ci    dependencies: [idep_mesautil, idep_nir],
137bf215546Sopenharmony_ci    include_directories: [inc_freedreno, inc_include, inc_src, inc_gallium],
138bf215546Sopenharmony_ci  ),
139bf215546Sopenharmony_ci  suite: ['freedreno'],
140bf215546Sopenharmony_ci)
141bf215546Sopenharmony_ci
142bf215546Sopenharmony_citest('ir3_delay_test',
143bf215546Sopenharmony_ci  executable(
144bf215546Sopenharmony_ci    'ir3_delay_test',
145bf215546Sopenharmony_ci    'tests/delay.c',
146bf215546Sopenharmony_ci    link_with: libfreedreno_ir3,
147bf215546Sopenharmony_ci    link_args: ld_args_build_id,
148bf215546Sopenharmony_ci    dependencies: [idep_mesautil, idep_nir],
149bf215546Sopenharmony_ci    include_directories: [inc_freedreno, inc_include, inc_src, inc_mesa, inc_gallium],
150bf215546Sopenharmony_ci  ),
151bf215546Sopenharmony_ci  suite: ['freedreno'],
152bf215546Sopenharmony_ci)
153