1 # Copyright 2017 Intel Corporation 2 3 # Permission is hereby granted, free of charge, to any person obtaining a copy 4 # of this software and associated documentation files (the "Software"), to deal 5 # in the Software without restriction, including without limitation the rights 6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 # copies of the Software, and to permit persons to whom the Software is 8 # furnished to do so, subject to the following conditions: 9 10 # The above copyright notice and this permission notice shall be included in 11 # all copies or substantial portions of the Software. 12 13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 # SOFTWARE. 20 21 nir_depends = files('nir_opcodes.py') 22 23 nir_builder_opcodes_h = custom_target( 24 'nir_builder_opcodes.h', 25 input : 'nir_builder_opcodes_h.py', 26 output : 'nir_builder_opcodes.h', 27 command : [prog_python2, '@INPUT@'], 28 capture : true, 29 depend_files : nir_depends, 30 ) 31 32 nir_constant_expressions_c = custom_target( 33 'nir_constant_expressions.c', 34 input : 'nir_constant_expressions.py', 35 output : 'nir_constant_expressions.c', 36 command : [prog_python2, '@INPUT@'], 37 capture : true, 38 depend_files : nir_depends, 39 ) 40 41 nir_opcodes_h = custom_target( 42 'nir_opcodes.h', 43 input : 'nir_opcodes_h.py', 44 output : 'nir_opcodes.h', 45 command : [prog_python2, '@INPUT@'], 46 capture : true, 47 depend_files : nir_depends, 48 ) 49 50 nir_opcodes_c = custom_target( 51 'nir_opcodes.c', 52 input : 'nir_opcodes_c.py', 53 output : 'nir_opcodes.c', 54 command : [prog_python2, '@INPUT@'], 55 capture : true, 56 depend_files : nir_depends, 57 ) 58 59 nir_opt_algebraic_c = custom_target( 60 'nir_opt_algebraic.c', 61 input : 'nir_opt_algebraic.py', 62 output : 'nir_opt_algebraic.c', 63 command : [prog_python2, '@INPUT@'], 64 capture : true, 65 depend_files : files('nir_algebraic.py'), 66 ) 67 68 spirv_info_c = custom_target( 69 'spirv_info.c', 70 input : files('../spirv/spirv_info_c.py', '../spirv/spirv.core.grammar.json'), 71 output : 'spirv_info.c', 72 command : [prog_python2, '@INPUT0@', '@INPUT1@', '@OUTPUT@'], 73 ) 74 75 vtn_gather_types_c = custom_target( 76 'vtn_gather_types.c', 77 input : files('../spirv/vtn_gather_types_c.py', 78 '../spirv/spirv.core.grammar.json'), 79 output : 'vtn_gather_types.c', 80 command : [prog_python2, '@INPUT0@', '@INPUT1@', '@OUTPUT@'], 81 ) 82 83 files_libnir = files( 84 'nir.c', 85 'nir.h', 86 'nir_builder.h', 87 'nir_clone.c', 88 'nir_constant_expressions.h', 89 'nir_control_flow.c', 90 'nir_control_flow.h', 91 'nir_control_flow_private.h', 92 'nir_dominance.c', 93 'nir_from_ssa.c', 94 'nir_gather_info.c', 95 'nir_gs_count_vertices.c', 96 'nir_inline_functions.c', 97 'nir_instr_set.c', 98 'nir_instr_set.h', 99 'nir_intrinsics.c', 100 'nir_intrinsics.h', 101 'nir_linking_helpers.c', 102 'nir_liveness.c', 103 'nir_loop_analyze.c', 104 'nir_loop_analyze.h', 105 'nir_lower_64bit_packing.c', 106 'nir_lower_alu_to_scalar.c', 107 'nir_lower_alpha_test.c', 108 'nir_lower_atomics.c', 109 'nir_lower_atomics_to_ssbo.c', 110 'nir_lower_bitmap.c', 111 'nir_lower_clamp_color_outputs.c', 112 'nir_lower_clip.c', 113 'nir_lower_clip_cull_distance_arrays.c', 114 'nir_lower_constant_initializers.c', 115 'nir_lower_double_ops.c', 116 'nir_lower_drawpixels.c', 117 'nir_lower_global_vars_to_local.c', 118 'nir_lower_gs_intrinsics.c', 119 'nir_lower_load_const_to_scalar.c', 120 'nir_lower_locals_to_regs.c', 121 'nir_lower_idiv.c', 122 'nir_lower_indirect_derefs.c', 123 'nir_lower_int64.c', 124 'nir_lower_io.c', 125 'nir_lower_io_arrays_to_elements.c', 126 'nir_lower_io_to_temporaries.c', 127 'nir_lower_io_to_scalar.c', 128 'nir_lower_io_types.c', 129 'nir_lower_passthrough_edgeflags.c', 130 'nir_lower_patch_vertices.c', 131 'nir_lower_phis_to_scalar.c', 132 'nir_lower_regs_to_ssa.c', 133 'nir_lower_returns.c', 134 'nir_lower_samplers.c', 135 'nir_lower_samplers_as_deref.c', 136 'nir_lower_subgroups.c', 137 'nir_lower_system_values.c', 138 'nir_lower_tex.c', 139 'nir_lower_to_source_mods.c', 140 'nir_lower_two_sided_color.c', 141 'nir_lower_uniforms_to_ubo.c', 142 'nir_lower_vars_to_ssa.c', 143 'nir_lower_var_copies.c', 144 'nir_lower_vec_to_movs.c', 145 'nir_lower_wpos_center.c', 146 'nir_lower_wpos_ytransform.c', 147 'nir_metadata.c', 148 'nir_move_vec_src_uses_to_dest.c', 149 'nir_normalize_cubemap_coords.c', 150 'nir_opt_conditional_discard.c', 151 'nir_opt_constant_folding.c', 152 'nir_opt_copy_prop_vars.c', 153 'nir_opt_copy_propagate.c', 154 'nir_opt_cse.c', 155 'nir_opt_dce.c', 156 'nir_opt_dead_cf.c', 157 'nir_opt_gcm.c', 158 'nir_opt_global_to_local.c', 159 'nir_opt_if.c', 160 'nir_opt_intrinsics.c', 161 'nir_opt_loop_unroll.c', 162 'nir_opt_move_comparisons.c', 163 'nir_opt_peephole_select.c', 164 'nir_opt_remove_phis.c', 165 'nir_opt_trivial_continues.c', 166 'nir_opt_undef.c', 167 'nir_phi_builder.c', 168 'nir_phi_builder.h', 169 'nir_print.c', 170 'nir_propagate_invariant.c', 171 'nir_remove_dead_variables.c', 172 'nir_repair_ssa.c', 173 'nir_search.c', 174 'nir_search.h', 175 'nir_search_helpers.h', 176 'nir_serialize.c', 177 'nir_serialize.h', 178 'nir_split_var_copies.c', 179 'nir_sweep.c', 180 'nir_to_lcssa.c', 181 'nir_validate.c', 182 'nir_vla.h', 183 'nir_worklist.c', 184 'nir_worklist.h', 185 '../spirv/GLSL.std.450.h', 186 '../spirv/nir_spirv.h', 187 '../spirv/spirv.h', 188 '../spirv/spirv_info.h', 189 '../spirv/spirv_to_nir.c', 190 '../spirv/vtn_alu.c', 191 '../spirv/vtn_cfg.c', 192 '../spirv/vtn_glsl450.c', 193 '../spirv/vtn_private.h', 194 '../spirv/vtn_variables.c', 195 ) 196 197 libnir = static_library( 198 'nir', 199 [files_libnir, spirv_info_c, nir_opt_algebraic_c, nir_opcodes_c, 200 nir_opcodes_h, nir_constant_expressions_c, nir_builder_opcodes_h, 201 vtn_gather_types_c], 202 include_directories : [inc_common, inc_compiler, include_directories('../spirv')], 203 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 204 link_with : libcompiler, 205 build_by_default : false, 206 ) 207 208 # Headers-only dependency 209 idep_nir_headers = declare_dependency( 210 sources : [nir_opcodes_h, nir_builder_opcodes_h], 211 include_directories : include_directories('.'), 212 ) 213 214 # Also link with nir 215 idep_nir = declare_dependency( 216 dependencies : idep_nir_headers, 217 link_with : libnir, 218 ) 219 220 nir_algebraic_py = files('nir_algebraic.py') 221 222 if with_tests 223 test( 224 'nir_control_flow', 225 executable( 226 'nir_control_flow_test', 227 files('tests/control_flow_tests.cpp'), 228 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 229 include_directories : [inc_common], 230 dependencies : [dep_thread, idep_gtest, idep_nir], 231 link_with : libmesa_util, 232 ) 233 ) 234 endif 235