xref: /aosp_15_r20/external/mesa3d/src/compiler/nir/Android.bp (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1/*
2 * Copyright (C) 2024 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package {
18    // See: http://go/android-license-faq
19    default_applicable_licenses: ["external_mesa3d_license"],
20}
21
22filegroup {
23    name: "nir_opcodes_filegroup",
24    srcs: [
25        "nir_opcodes.py",
26        "nir_algebraic.py",
27    ],
28}
29
30python_binary_host {
31    name: "nir_builder_opcodes_gen",
32    main: "nir_builder_opcodes_h.py",
33    srcs: [
34        "nir_builder_opcodes_h.py",
35        "nir_opcodes.py",
36        "nir_intrinsics.py",
37    ],
38    libs: [
39        "mako",
40    ],
41}
42
43python_binary_host {
44    name: "nir_constant_expressions_gen",
45    main: "nir_constant_expressions.py",
46    srcs: [
47        "nir_constant_expressions.py",
48        "nir_opcodes.py",
49        "nir_intrinsics.py",
50    ],
51    libs: [
52        "mako",
53    ],
54}
55
56python_binary_host {
57    name: "nir_opcodes_header_gen",
58    main: "nir_opcodes_h.py",
59    srcs: [
60        "nir_opcodes_h.py",
61        "nir_opcodes.py",
62        "nir_intrinsics.py",
63    ],
64    libs: [
65        "mako",
66    ],
67}
68
69python_binary_host {
70    name: "nir_opcodes_impl_gen",
71    main: "nir_opcodes_c.py",
72    srcs: [
73        "nir_opcodes_c.py",
74        "nir_opcodes.py",
75        "nir_intrinsics.py",
76    ],
77    libs: [
78        "mako",
79    ],
80}
81
82python_binary_host {
83    name: "nir_opt_algebraic_gen",
84    main: "nir_opt_algebraic.py",
85    srcs: [
86        "nir_opt_algebraic.py",
87        "nir_opcodes.py",
88        "nir_algebraic.py",
89    ],
90    libs: [
91        "mako",
92    ],
93}
94
95python_binary_host {
96    name: "nir_intrinsics_header_gen",
97    main: "nir_intrinsics_h.py",
98    srcs: [
99        "nir_intrinsics.py",
100        "nir_intrinsics_h.py",
101    ],
102    libs: [
103        "mako",
104    ],
105}
106
107python_binary_host {
108    name: "nir_intrinsics_indices_gen",
109    main: "nir_intrinsics_indices_h.py",
110    srcs: [
111        "nir_intrinsics_indices_h.py",
112        "nir_intrinsics.py",
113    ],
114    libs: [
115        "mako",
116    ],
117}
118
119python_binary_host {
120    name: "nir_intrinsics_impl_gen",
121    main: "nir_intrinsics_c.py",
122    srcs: [
123        "nir_intrinsics.py",
124        "nir_intrinsics_c.py",
125    ],
126    libs: [
127        "mako",
128    ],
129}
130
131genrule {
132    name: "nir_builder_opcodes_header",
133    out: ["nir_builder_opcodes.h"],
134    tools: ["nir_builder_opcodes_gen"],
135    cmd: "python3 $(location nir_builder_opcodes_gen) " +
136        "&> $(location nir_builder_opcodes.h)",
137}
138
139genrule {
140    name: "nir_constant_expressions_impl",
141    out: ["nir_constant_expressions.c"],
142    tools: ["nir_constant_expressions_gen"],
143    cmd: "python3 $(location nir_constant_expressions_gen) " +
144        "&> $(location nir_constant_expressions.c)",
145}
146
147genrule {
148    name: "nir_opcodes_header",
149    out: ["nir_opcodes.h"],
150    tools: ["nir_opcodes_header_gen"],
151    cmd: "python3 $(location nir_opcodes_header_gen) " +
152        "&> $(location nir_opcodes.h)",
153}
154
155genrule {
156    name: "nir_opcodes_impl",
157    out: ["nir_opcodes.c"],
158    tools: ["nir_opcodes_impl_gen"],
159    cmd: "python3 $(location nir_opcodes_impl_gen) " +
160        "&> $(location nir_opcodes.c)",
161}
162
163genrule {
164    name: "nir_opt_algebraic_impl",
165    out: ["nir_opt_algebraic.c"],
166    tools: ["nir_opt_algebraic_gen"],
167    cmd: "python3 $(location nir_opt_algebraic_gen) " +
168        "--out $(location nir_opt_algebraic.c)",
169}
170
171genrule {
172    name: "nir_intrinsics_header",
173    out: ["nir_intrinsics.h"],
174    tools: ["nir_intrinsics_header_gen"],
175    cmd: "python3 $(location nir_intrinsics_header_gen) " +
176        "--outdir $(genDir)",
177}
178
179genrule {
180    name: "nir_intrinsics_indices_header",
181    out: ["nir_intrinsics_indices.h"],
182    tools: ["nir_intrinsics_indices_gen"],
183    cmd: "python3 $(location nir_intrinsics_indices_gen) " +
184        "--outdir $(genDir)",
185}
186
187genrule {
188    name: "nir_intrinsics_impl",
189    out: ["nir_intrinsics.c"],
190    tools: ["nir_intrinsics_impl_gen"],
191    cmd: "python3 $(location nir_intrinsics_impl_gen) " +
192        "--outdir $(genDir)",
193}
194
195cc_library_headers {
196    name: "mesa_nir_headers",
197    vendor: true,
198    host_supported: true,
199    export_include_dirs: [
200        ".",
201    ],
202}
203
204cc_library_static {
205    name: "mesa_nir",
206    vendor: true,
207    host_supported: true,
208    defaults: [
209        "mesa_common_defaults",
210    ],
211    generated_headers: [
212        "nir_builder_opcodes_header",
213        "nir_opcodes_header",
214        "nir_intrinsics_header",
215        "nir_intrinsics_indices_header",
216        "u_format_gen_header",
217        "builtin_types_header",
218    ],
219    generated_sources: [
220        "nir_constant_expressions_impl",
221        "nir_opcodes_impl",
222        "nir_opt_algebraic_impl",
223        "nir_intrinsics_impl",
224    ],
225    header_libs: [
226        "mesa_gallium_auxiliary_headers",
227        "mesa_gallium_headers",
228        "mesa_src_headers",
229        "mesa_compiler_headers",
230        "mesa_common_headers",
231    ],
232    srcs: [
233        "nir.c",
234        "nir_builder.c",
235        "nir_builtin_builder.c",
236        "nir_clone.c",
237        "nir_control_flow.c",
238        "nir_deref.c",
239        "nir_divergence_analysis.c",
240        "nir_dominance.c",
241        "nir_from_ssa.c",
242        "nir_gather_info.c",
243        "nir_gather_xfb_info.c",
244        "nir_gs_count_vertices.c",
245        "nir_instr_set.c",
246        "nir_linking_helpers.c",
247        "nir_liveness.c",
248        "nir_loop_analyze.c",
249        "nir_lower_alu_width.c",
250        "nir_lower_array_deref_of_vec.c",
251        "nir_lower_bit_size.c",
252        "nir_lower_bool_to_int32.c",
253        "nir_lower_clip.c",
254        "nir_lower_clip_cull_distance_arrays.c",
255        "nir_lower_convert_alu_types.c",
256        "nir_lower_double_ops.c",
257        "nir_lower_flrp.c",
258        "nir_lower_frexp.c",
259        "nir_lower_global_vars_to_local.c",
260        "nir_lower_goto_ifs.c",
261        "nir_lower_gs_intrinsics.c",
262        "nir_lower_idiv.c",
263        "nir_lower_image.c",
264        "nir_lower_indirect_derefs.c",
265        "nir_lower_input_attachments.c",
266        "nir_lower_int64.c",
267        "nir_lower_interpolation.c",
268        "nir_lower_io.c",
269        "nir_lower_io_arrays_to_elements.c",
270        "nir_lower_io_to_scalar.c",
271        "nir_lower_io_to_temporaries.c",
272        "nir_lower_io_to_vector.c",
273        "nir_lower_load_const_to_scalar.c",
274        "nir_lower_locals_to_regs.c",
275        "nir_lower_multiview.c",
276        "nir_lower_non_uniform_access.c",
277        "nir_lower_packing.c",
278        "nir_lower_patch_vertices.c",
279        "nir_lower_phis_to_scalar.c",
280        "nir_lower_returns.c",
281        "nir_lower_scratch.c",
282        "nir_lower_shader_calls.c",
283        "nir_lower_single_sampled.c",
284        "nir_lower_subgroups.c",
285        "nir_lower_system_values.c",
286        "nir_lower_sysvals_to_varyings.c",
287        "nir_lower_task_shader.c",
288        "nir_lower_tex.c",
289        "nir_lower_two_sided_color.c",
290        "nir_lower_var_copies.c",
291        "nir_lower_variable_initializers.c",
292        "nir_lower_vars_to_ssa.c",
293        "nir_lower_wpos_center.c",
294        "nir_metadata.c",
295        "nir_move_vec_src_uses_to_dest.c",
296        "nir_normalize_cubemap_coords.c",
297        "nir_opt_access.c",
298        "nir_opt_barriers.c",
299        "nir_opt_combine_stores.c",
300        "nir_opt_comparison_pre.c",
301        "nir_opt_conditional_discard.c",
302        "nir_opt_constant_folding.c",
303        "nir_opt_copy_prop_vars.c",
304        "nir_opt_copy_propagate.c",
305        "nir_opt_cse.c",
306        "nir_opt_dce.c",
307        "nir_opt_dead_cf.c",
308        "nir_opt_dead_write_vars.c",
309        "nir_opt_find_array_copies.c",
310        "nir_opt_gcm.c",
311        "nir_opt_idiv_const.c",
312        "nir_opt_if.c",
313        "nir_opt_intrinsics.c",
314        "nir_opt_memcpy.c",
315        "nir_opt_large_constants.c",
316        "nir_opt_load_store_vectorize.c",
317        "nir_opt_loop_unroll.c",
318        "nir_opt_move.c",
319        "nir_opt_non_uniform_access.c",
320        "nir_opt_peephole_select.c",
321        "nir_opt_rematerialize_compares.c",
322        "nir_opt_ray_queries.c",
323        "nir_opt_remove_phis.c",
324        "nir_opt_shrink_stores.c",
325        "nir_opt_shrink_vectors.c",
326        "nir_opt_sink.c",
327        "nir_opt_undef.c",
328        "nir_opt_uniform_atomics.c",
329        "nir_phi_builder.c",
330        "nir_print.c",
331        "nir_propagate_invariant.c",
332        "nir_range_analysis.c",
333        "nir_remove_dead_variables.c",
334        "nir_repair_ssa.c",
335        "nir_search.c",
336        "nir_serialize.c",
337        "nir_split_per_member_structs.c",
338        "nir_split_var_copies.c",
339        "nir_split_vars.c",
340        "nir_sweep.c",
341        "nir_to_lcssa.c",
342        "nir_validate.c",
343        "nir_worklist.c",
344    ],
345}
346