xref: /aosp_15_r20/external/mesa3d/src/intel/compiler/elk/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2017 Intel Corporation
2# SPDX-License-Identifier: MIT
3
4libintel_compiler_elk_files = files(
5  'elk_cfg.cpp',
6  'elk_cfg.h',
7  'elk_clip.h',
8  'elk_clip_line.c',
9  'elk_clip_point.c',
10  'elk_clip_tri.c',
11  'elk_clip_unfilled.c',
12  'elk_clip_util.c',
13  'elk_compile_clip.c',
14  'elk_compile_ff_gs.c',
15  'elk_compile_sf.c',
16  'elk_compiler.c',
17  'elk_compiler.h',
18  'elk_dead_control_flow.cpp',
19  'elk_dead_control_flow.h',
20  'elk_debug_recompile.c',
21  'elk_disasm.c',
22  'elk_disasm.h',
23  'elk_disasm_info.c',
24  'elk_disasm_info.h',
25  'elk_eu.c',
26  'elk_eu_compact.c',
27  'elk_eu_defines.h',
28  'elk_eu_emit.c',
29  'elk_eu_opcodes.h',
30  'elk_eu.h',
31  'elk_eu_util.c',
32  'elk_eu_validate.c',
33  'elk_fs_bank_conflicts.cpp',
34  'elk_fs_builder.h',
35  'elk_fs_cmod_propagation.cpp',
36  'elk_fs_combine_constants.cpp',
37  'elk_fs_copy_propagation.cpp',
38  'elk_fs.cpp',
39  'elk_fs_cse.cpp',
40  'elk_fs_dead_code_eliminate.cpp',
41  'elk_fs_generator.cpp',
42  'elk_fs.h',
43  'elk_fs_live_variables.cpp',
44  'elk_fs_live_variables.h',
45  'elk_fs_lower_pack.cpp',
46  'elk_fs_lower_regioning.cpp',
47  'elk_fs_nir.cpp',
48  'elk_fs_reg_allocate.cpp',
49  'elk_fs_register_coalesce.cpp',
50  'elk_fs_saturate_propagation.cpp',
51  'elk_fs_sel_peephole.cpp',
52  'elk_fs_thread_payload.cpp',
53  'elk_fs_validate.cpp',
54  'elk_fs_visitor.cpp',
55  'elk_inst.h',
56  'elk_interpolation_map.c',
57  'elk_ir.h',
58  'elk_ir_allocator.h',
59  'elk_ir_analysis.h',
60  'elk_ir_fs.h',
61  'elk_ir_performance.h',
62  'elk_ir_performance.cpp',
63  'elk_ir_vec4.h',
64  'elk_isa_info.h',
65  'elk_lower_logical_sends.cpp',
66  'elk_nir.h',
67  'elk_nir.c',
68  'elk_nir_analyze_boolean_resolves.c',
69  'elk_nir_analyze_ubo_ranges.c',
70  'elk_nir_attribute_workarounds.c',
71  'elk_nir_lower_alpha_to_coverage.c',
72  'elk_nir_lower_cs_intrinsics.c',
73  'elk_nir_lower_storage_image.c',
74  'elk_nir_options.h',
75  'elk_nir_options.c',
76  'elk_nir_private.h',
77  'elk_packed_float.c',
78  'elk_predicated_break.cpp',
79  'elk_prim.h',
80  'elk_private.h',
81  'elk_reg.h',
82  'elk_reg_type.c',
83  'elk_reg_type.h',
84  'elk_schedule_instructions.cpp',
85  'elk_shader.cpp',
86  'elk_shader.h',
87  'elk_simd_selection.cpp',
88  'elk_vec4_builder.h',
89  'elk_vec4_cmod_propagation.cpp',
90  'elk_vec4_copy_propagation.cpp',
91  'elk_vec4.cpp',
92  'elk_vec4_cse.cpp',
93  'elk_vec4_dead_code_eliminate.cpp',
94  'elk_vec4_generator.cpp',
95  'elk_vec4_gs_visitor.cpp',
96  'elk_vec4_gs_visitor.h',
97  'elk_vec4.h',
98  'elk_vec4_live_variables.cpp',
99  'elk_vec4_live_variables.h',
100  'elk_vec4_nir.cpp',
101  'elk_vec4_gs_nir.cpp',
102  'elk_vec4_reg_allocate.cpp',
103  'elk_vec4_surface_builder.cpp',
104  'elk_vec4_surface_builder.h',
105  'elk_vec4_tcs.cpp',
106  'elk_vec4_tcs.h',
107  'elk_vec4_tes.cpp',
108  'elk_vec4_tes.h',
109  'elk_vec4_visitor.cpp',
110  'elk_vec4_vs_visitor.cpp',
111  'elk_vec4_vs.h',
112  'elk_vue_map.c',
113  'elk_gfx6_gs_visitor.cpp',
114  'elk_gfx6_gs_visitor.h',
115)
116
117elk_nir_trig = custom_target(
118  'elk_nir_trig_workarounds.c',
119  input : 'elk_nir_trig_workarounds.py',
120  output : 'elk_nir_trig_workarounds.c',
121  command : [
122    prog_python, '@INPUT@', '-p', dir_compiler_nir,
123  ],
124  depend_files : nir_algebraic_depends,
125  capture : true,
126)
127
128libintel_compiler_elk = static_library(
129  'intel_compiler_elk',
130  [libintel_compiler_elk_files, intel_nir_files, elk_nir_trig, ir_expression_operation_h],
131  include_directories : [inc_include, inc_src, inc_intel],
132  c_args : [no_override_init_args],
133  gnu_symbol_visibility : 'hidden',
134  dependencies : [idep_nir_headers, idep_mesautil, idep_intel_dev],
135  build_by_default : false,
136)
137
138idep_intel_compiler_elk = declare_dependency(
139  link_with : [libintel_compiler_elk],
140  dependencies : [
141    idep_nir,
142  ],
143)
144
145if with_tests
146  test(
147    'intel_compiler_elk_tests',
148    executable(
149      'intel_compiler_elk_tests',
150      files(
151        'elk_test_predicated_break.cpp',
152        'elk_test_eu_compact.cpp',
153        'elk_test_eu_validate.cpp',
154        'elk_test_fs_cmod_propagation.cpp',
155        'elk_test_fs_combine_constants.cpp',
156        'elk_test_fs_copy_propagation.cpp',
157        'elk_test_fs_saturate_propagation.cpp',
158        'elk_test_simd_selection.cpp',
159        'elk_test_vec4_cmod_propagation.cpp',
160        'elk_test_vec4_copy_propagation.cpp',
161        'elk_test_vec4_dead_code_eliminate.cpp',
162        'elk_test_vec4_register_coalesce.cpp',
163        'elk_test_vf_float_conversions.cpp',
164      ),
165      ir_expression_operation_h,
166      include_directories : [inc_include, inc_src, inc_intel],
167      link_with : [
168        libintel_common, libisl
169      ],
170      dependencies : [idep_gtest, idep_nir, idep_mesautil, idep_intel_dev,
171                      idep_intel_compiler_elk],
172    ),
173    suite : ['intel'],
174    protocol : 'gtest',
175  )
176endif
177
178if with_intel_tools
179
180elk_gram_tab = custom_target(
181  'elk_gram.tab.[ch]',
182  input : 'elk_gram.y',
183  output : ['elk_gram.tab.c', 'elk_gram.tab.h'],
184  command : bison_command
185)
186
187elk_lex_yy_c = custom_target(
188  'elk_lex.yy.c',
189  input : 'elk_lex.l',
190  output : 'elk_lex.yy.c',
191  command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@']
192)
193
194elk_asm_tool = executable(
195  'elk_asm',
196  ['elk_asm_tool.c', elk_gram_tab[0], elk_gram_tab[1], elk_lex_yy_c],
197  dependencies : [idep_mesautil, dep_thread, idep_intel_dev, idep_intel_compiler_elk],
198  include_directories : [inc_include, inc_src, inc_intel],
199  link_with : [libintel_common],
200  c_args : [no_override_init_args],
201  gnu_symbol_visibility : 'hidden',
202  install : true
203)
204
205asm_testcases = [
206  ['brw', 'gfx4'],
207  ['g4x', 'gfx4.5'],
208  ['ilk', 'gfx5'],
209  ['snb', 'gfx6'],
210  ['ivb', 'gfx7'],
211  ['hsw', 'gfx7.5'],
212  ['bdw', 'gfx8'],
213]
214
215test_runner = find_program('tests/run-test.py')
216foreach testcase : asm_testcases
217  _gen_name = testcase[0]
218  _gen_num = testcase[1]
219  _gen_folder = join_paths(meson.current_source_dir(), 'tests',
220                           _gen_num.replace('gfx', 'gen'))
221  test(
222    'elk_asm_' + _gen_num, test_runner,
223    args : [
224      '--elk_asm', elk_asm_tool,
225      '--gen_name', _gen_name,
226      '--gen_folder', _gen_folder,
227    ],
228    suite : 'intel',
229  )
230endforeach
231
232elk_disasm_tool = executable(
233  'elk_disasm',
234  files('elk_disasm_tool.c'),
235  dependencies : [idep_mesautil, dep_thread, idep_intel_dev, idep_intel_compiler_elk],
236  include_directories : [inc_include, inc_src, inc_intel],
237  link_with : [libintel_common],
238  c_args : [no_override_init_args],
239  gnu_symbol_visibility : 'hidden',
240  install : true
241)
242
243endif
244
245