xref: /aosp_15_r20/external/mesa3d/src/panfrost/compiler/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2018 Rob Clark
2# Copyright © 2019 Collabora
3# SPDX-License-Identifier: MIT
4
5subdir('valhall')
6
7inc_valhall = include_directories(['.', 'valhall'])
8
9libpanfrost_bifrost_files = files(
10  'bi_helper_invocations.c',
11  'bi_layout.c',
12  'bi_liveness.c',
13  'bi_lower_divergent_indirects.c',
14  'bi_lower_swizzle.c',
15  'bi_print.c',
16  'bi_opt_constant_fold.c',
17  'bi_opt_copy_prop.c',
18  'bi_opt_dce.c',
19  'bi_opt_cse.c',
20  'bi_opt_push_ubo.c',
21  'bi_opt_mod_props.c',
22  'bi_opt_dual_tex.c',
23  'bi_pressure_schedule.c',
24  'bi_ra.c',
25  'bi_validate.c',
26  'bir.c',
27  'bifrost_compile.c',
28  'bifrost/bi_opt_message_preload.c',
29  'bifrost/bi_pack.c',
30  'bifrost/bi_schedule.c',
31  'bifrost/bi_scoreboard.c',
32  'valhall/va_insert_flow.c',
33  'valhall/va_lower_constants.c',
34  'valhall/va_lower_isel.c',
35  'valhall/va_lower_split_64bit.c',
36  'valhall/va_optimize.c',
37  'valhall/va_mark_last.c',
38  'valhall/va_merge_flow.c',
39  'valhall/va_pack.c',
40  'valhall/va_perf.c',
41  'valhall/va_validate.c',
42)
43
44bifrost_gen_disasm_c = custom_target(
45  'bifrost_gen_disasm.c',
46  input : ['gen_disasm.py', 'bifrost/ISA.xml'],
47  output : 'bifrost_gen_disasm.c',
48  command : [prog_python, '@INPUT@'],
49  capture : true,
50  depend_files : files('bifrost_isa.py'),
51)
52
53bi_opcodes_c = custom_target(
54  'bi_opcodes.c',
55  input : ['bi_opcodes.c.py', 'IR_pseudo.xml', 'bifrost/ISA.xml', 'valhall/ISA.xml'],
56  output : 'bi_opcodes.c',
57  command : [prog_python, '@INPUT@'],
58  capture : true,
59  depend_files : files('bifrost_isa.py'),
60)
61
62bi_printer_c = custom_target(
63  'bi_printer.c',
64  input : ['bi_printer.c.py', 'IR_pseudo.xml', 'bifrost/ISA.xml', 'valhall/ISA.xml'],
65  output : 'bi_printer.c',
66  command : [prog_python, '@INPUT@'],
67  capture : true,
68  depend_files : files('bifrost_isa.py'),
69)
70
71bi_packer_c = custom_target(
72  'bi_packer.c',
73  input : ['bi_packer.c.py', 'IR_pseudo.xml', 'bifrost/ISA.xml', 'valhall/ISA.xml'],
74  output : 'bi_packer.c',
75  command : [prog_python, '@INPUT@'],
76  capture : true,
77  depend_files : files('bifrost_isa.py'),
78)
79
80bi_opcodes_h = custom_target(
81  'bi_opcodes.h',
82  input : ['bi_opcodes.h.py', 'IR_pseudo.xml', 'bifrost/ISA.xml', 'valhall/ISA.xml'],
83  output : 'bi_opcodes.h',
84  command : [prog_python, '@INPUT@'],
85  capture : true,
86  depend_files : files('bifrost_isa.py'),
87)
88
89idep_bi_opcodes_h = declare_dependency(
90  sources : [bi_opcodes_h],
91  include_directories : include_directories('.'),
92)
93
94bi_builder_h = custom_target(
95  'bi_builder.h',
96  input : ['bi_builder.h.py', 'IR_pseudo.xml', 'bifrost/ISA.xml', 'valhall/ISA.xml'],
97  output : 'bi_builder.h',
98  command : [prog_python, '@INPUT@'],
99  capture : true,
100  depend_files : files('bifrost_isa.py'),
101)
102
103idep_bi_builder_h = declare_dependency(
104  sources : [bi_builder_h],
105  include_directories : include_directories('.'),
106)
107
108bifrost_nir_algebraic_c = custom_target(
109  'bifrost_nir_algebraic.c',
110  input : 'bifrost_nir_algebraic.py',
111  output : 'bifrost_nir_algebraic.c',
112  command : [
113    prog_python, '@INPUT@', '-p', dir_compiler_nir,
114  ],
115  capture : true,
116  depend_files : nir_algebraic_depends,
117)
118
119libpanfrost_bifrost_disasm = static_library(
120  'panfrost_bifrost_disasm',
121  ['bifrost/disassemble.c', 'bi_print_common.c', bifrost_gen_disasm_c],
122  include_directories : [inc_include, inc_src, inc_panfrost_hw],
123  dependencies: [idep_nir],
124  link_with: [libpanfrost_util],
125  c_args : [no_override_init_args],
126  gnu_symbol_visibility : 'hidden',
127  build_by_default : false,
128)
129
130libpanfrost_bifrost = static_library(
131  'panfrost_bifrost',
132  [libpanfrost_bifrost_files, bi_opcodes_c, bi_printer_c, bi_packer_c, bifrost_nir_algebraic_c, valhall_c],
133  include_directories : [inc_include, inc_src, inc_panfrost_hw, inc_valhall],
134  dependencies: [idep_nir, idep_bi_opcodes_h, idep_bi_builder_h, idep_valhall_enums_h],
135  link_with: [libpanfrost_util, libpanfrost_bifrost_disasm, libpanfrost_valhall_disasm],
136  c_args : [no_override_init_args],
137  gnu_symbol_visibility : 'hidden',
138  build_by_default : false,
139)
140
141if with_tests
142  test(
143    'bifrost_tests',
144    executable(
145      'bifrost_tests',
146      files(
147        'test/test-constant-fold.cpp',
148        'test/test-dual-texture.cpp',
149        'test/test-lower-swizzle.cpp',
150        'test/test-message-preload.cpp',
151	'test/test-optimizer.cpp',
152	'test/test-pack-formats.cpp',
153	'test/test-packing.cpp',
154	'test/test-scheduler-predicates.cpp',
155        'valhall/test/test-add-imm.cpp',
156        'valhall/test/test-validate-fau.cpp',
157        'valhall/test/test-insert-flow.cpp',
158        'valhall/test/test-lower-isel.cpp',
159        'valhall/test/test-lower-constants.cpp',
160        'valhall/test/test-mark-last.cpp',
161        'valhall/test/test-merge-flow.cpp',
162        'valhall/test/test-packing.cpp',
163      ),
164      c_args : [c_msvc_compat_args, no_override_init_args],
165      gnu_symbol_visibility : 'hidden',
166      include_directories : [inc_include, inc_src, inc_valhall],
167      dependencies: [idep_gtest, idep_nir, idep_bi_opcodes_h, idep_bi_builder_h, idep_valhall_enums_h],
168      link_with : [libpanfrost_bifrost],
169    ),
170    suite : ['panfrost'],
171    protocol : 'gtest',
172  )
173endif
174