Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 09-Feb-2022 | - | ||||
tests/ | H | 09-Feb-2022 | - | 6,974 | 4,501 | |
README | H A D | 09-Feb-2022 | 5.7 KiB | 119 | 98 | |
meson.build | H A D | 09-Feb-2022 | 15.9 KiB | 538 | 501 | |
nir.c | H A D | 09-Feb-2022 | 79 KiB | 2,811 | 2,184 | |
nir.h | H A D | 09-Feb-2022 | 179 KiB | 5,686 | 3,173 | |
nir_algebraic.py | H A D | 09-Feb-2022 | 46.7 KiB | 1,206 | 896 | |
nir_builder.h | H A D | 09-Feb-2022 | 57 KiB | 1,885 | 1,485 | |
nir_builder_opcodes_h.py | H A D | 09-Feb-2022 | 5.4 KiB | 159 | 141 | |
nir_builtin_builder.c | H A D | 09-Feb-2022 | 14.8 KiB | 415 | 250 | |
nir_builtin_builder.h | H A D | 09-Feb-2022 | 7.6 KiB | 258 | 187 | |
nir_clone.c | H A D | 09-Feb-2022 | 24.3 KiB | 816 | 557 | |
nir_constant_expressions.h | H A D | 09-Feb-2022 | 1.6 KiB | 39 | 8 | |
nir_constant_expressions.py | H A D | 09-Feb-2022 | 15.9 KiB | 519 | 482 | |
nir_control_flow.c | H A D | 09-Feb-2022 | 24.4 KiB | 815 | 549 | |
nir_control_flow.h | H A D | 09-Feb-2022 | 6.9 KiB | 182 | 63 | |
nir_control_flow_private.h | H A D | 09-Feb-2022 | 1.5 KiB | 42 | 6 | |
nir_conversion_builder.h | H A D | 09-Feb-2022 | 18.1 KiB | 524 | 396 | |
nir_convert_ycbcr.c | H A D | 09-Feb-2022 | 5.6 KiB | 143 | 107 | |
nir_deref.c | H A D | 09-Feb-2022 | 45.4 KiB | 1,425 | 969 | |
nir_deref.h | H A D | 09-Feb-2022 | 3 KiB | 83 | 39 | |
nir_divergence_analysis.c | H A D | 09-Feb-2022 | 36 KiB | 1,019 | 833 | |
nir_dominance.c | H A D | 09-Feb-2022 | 9.3 KiB | 347 | 218 | |
nir_format_convert.h | H A D | 09-Feb-2022 | 15.7 KiB | 467 | 342 | |
nir_from_ssa.c | H A D | 09-Feb-2022 | 37.3 KiB | 1,116 | 647 | |
nir_gather_info.c | H A D | 09-Feb-2022 | 35.5 KiB | 939 | 776 | |
nir_gather_ssa_types.c | H A D | 09-Feb-2022 | 8.6 KiB | 235 | 169 | |
nir_gather_xfb_info.c | H A D | 09-Feb-2022 | 10.4 KiB | 288 | 199 | |
nir_gs_count_vertices.c | H A D | 09-Feb-2022 | 4.2 KiB | 118 | 60 | |
nir_inline_functions.c | H A D | 09-Feb-2022 | 10.9 KiB | 288 | 129 | |
nir_inline_helpers.h | H A D | 09-Feb-2022 | 4.7 KiB | 165 | 145 | |
nir_inline_uniforms.c | H A D | 09-Feb-2022 | 15.6 KiB | 428 | 240 | |
nir_instr_set.c | H A D | 09-Feb-2022 | 25.5 KiB | 854 | 624 | |
nir_instr_set.h | H A D | 09-Feb-2022 | 2.8 KiB | 71 | 10 | |
nir_intrinsics.py | H A D | 09-Feb-2022 | 58.5 KiB | 1,347 | 593 | |
nir_intrinsics_c.py | H A D | 09-Feb-2022 | 2.9 KiB | 89 | 78 | |
nir_intrinsics_h.py | H A D | 09-Feb-2022 | 2.2 KiB | 70 | 54 | |
nir_intrinsics_indices_h.py | H A D | 09-Feb-2022 | 3.1 KiB | 95 | 80 | |
nir_linking_helpers.c | H A D | 09-Feb-2022 | 56.3 KiB | 1,643 | 1,132 | |
nir_liveness.c | H A D | 09-Feb-2022 | 13.7 KiB | 416 | 235 | |
nir_loop_analyze.c | H A D | 09-Feb-2022 | 44.7 KiB | 1,384 | 968 | |
nir_loop_analyze.h | H A D | 09-Feb-2022 | 3.5 KiB | 108 | 58 | |
nir_lower_alpha_test.c | H A D | 09-Feb-2022 | 4.7 KiB | 122 | 73 | |
nir_lower_alu.c | H A D | 09-Feb-2022 | 10.1 KiB | 260 | 165 | |
nir_lower_alu_to_scalar.c | H A D | 09-Feb-2022 | 13 KiB | 369 | 272 | |
nir_lower_amul.c | H A D | 09-Feb-2022 | 10 KiB | 331 | 212 | |
nir_lower_array_deref_of_vec.c | H A D | 09-Feb-2022 | 7.5 KiB | 198 | 131 | |
nir_lower_atomics_to_ssbo.c | H A D | 09-Feb-2022 | 8.6 KiB | 244 | 154 | |
nir_lower_bit_size.c | H A D | 09-Feb-2022 | 12.7 KiB | 376 | 267 | |
nir_lower_bitmap.c | H A D | 09-Feb-2022 | 4.8 KiB | 143 | 71 | |
nir_lower_blend.c | H A D | 09-Feb-2022 | 11.7 KiB | 393 | 281 | |
nir_lower_blend.h | H A D | 09-Feb-2022 | 2.1 KiB | 70 | 26 | |
nir_lower_bool_to_bitsize.c | H A D | 09-Feb-2022 | 14.4 KiB | 463 | 338 | |
nir_lower_bool_to_float.c | H A D | 09-Feb-2022 | 6.4 KiB | 206 | 152 | |
nir_lower_bool_to_int32.c | H A D | 09-Feb-2022 | 6.1 KiB | 196 | 142 | |
nir_lower_clamp_color_outputs.c | H A D | 09-Feb-2022 | 3.9 KiB | 141 | 99 | |
nir_lower_clip.c | H A D | 09-Feb-2022 | 15.5 KiB | 497 | 340 | |
nir_lower_clip_cull_distance_arrays.c | H A D | 09-Feb-2022 | 4.7 KiB | 152 | 82 | |
nir_lower_clip_disable.c | H A D | 09-Feb-2022 | 5.5 KiB | 147 | 84 | |
nir_lower_clip_halfz.c | H A D | 09-Feb-2022 | 2.9 KiB | 80 | 47 | |
nir_lower_convert_alu_types.c | H A D | 09-Feb-2022 | 6.3 KiB | 210 | 152 | |
nir_lower_discard_or_demote.c | H A D | 09-Feb-2022 | 7.8 KiB | 202 | 133 | |
nir_lower_double_ops.c | H A D | 09-Feb-2022 | 25 KiB | 769 | 447 | |
nir_lower_drawpixels.c | H A D | 09-Feb-2022 | 10.2 KiB | 308 | 223 | |
nir_lower_fb_read.c | H A D | 09-Feb-2022 | 4.3 KiB | 122 | 52 | |
nir_lower_flatshade.c | H A D | 09-Feb-2022 | 1.7 KiB | 51 | 22 | |
nir_lower_flrp.c | H A D | 09-Feb-2022 | 21.4 KiB | 661 | 314 | |
nir_lower_fp16_conv.c | H A D | 09-Feb-2022 | 9.6 KiB | 238 | 161 | |
nir_lower_fragcolor.c | H A D | 09-Feb-2022 | 4.2 KiB | 108 | 49 | |
nir_lower_fragcoord_wtrans.c | H A D | 09-Feb-2022 | 2.7 KiB | 79 | 37 | |
nir_lower_frexp.c | H A D | 09-Feb-2022 | 6.9 KiB | 209 | 119 | |
nir_lower_global_vars_to_local.c | H A D | 09-Feb-2022 | 3.7 KiB | 116 | 64 | |
nir_lower_goto_ifs.c | H A D | 09-Feb-2022 | 33.3 KiB | 997 | 699 | |
nir_lower_gs_intrinsics.c | H A D | 09-Feb-2022 | 15 KiB | 429 | 242 | |
nir_lower_idiv.c | H A D | 09-Feb-2022 | 9.4 KiB | 291 | 194 | |
nir_lower_image.c | H A D | 09-Feb-2022 | 3.4 KiB | 96 | 55 | |
nir_lower_indirect_derefs.c | H A D | 09-Feb-2022 | 8.8 KiB | 253 | 170 | |
nir_lower_input_attachments.c | H A D | 09-Feb-2022 | 7.5 KiB | 226 | 155 | |
nir_lower_int64.c | H A D | 09-Feb-2022 | 42.7 KiB | 1,312 | 1,016 | |
nir_lower_int_to_float.c | H A D | 09-Feb-2022 | 6.3 KiB | 190 | 135 | |
nir_lower_interpolation.c | H A D | 09-Feb-2022 | 5.3 KiB | 161 | 99 | |
nir_lower_io.c | H A D | 09-Feb-2022 | 96 KiB | 2,734 | 2,162 | |
nir_lower_io_arrays_to_elements.c | H A D | 09-Feb-2022 | 15.2 KiB | 441 | 298 | |
nir_lower_io_to_scalar.c | H A D | 09-Feb-2022 | 13.6 KiB | 415 | 277 | |
nir_lower_io_to_temporaries.c | H A D | 09-Feb-2022 | 13.6 KiB | 389 | 238 | |
nir_lower_io_to_vector.c | H A D | 09-Feb-2022 | 22.8 KiB | 690 | 504 | |
nir_lower_is_helper_invocation.c | H A D | 09-Feb-2022 | 4.4 KiB | 127 | 73 | |
nir_lower_load_const_to_scalar.c | H A D | 09-Feb-2022 | 3.4 KiB | 102 | 53 | |
nir_lower_locals_to_regs.c | H A D | 09-Feb-2022 | 8.9 KiB | 291 | 194 | |
nir_lower_mediump.c | H A D | 09-Feb-2022 | 21.8 KiB | 648 | 462 | |
nir_lower_memcpy.c | H A D | 09-Feb-2022 | 6.9 KiB | 196 | 136 | |
nir_lower_memory_model.c | H A D | 09-Feb-2022 | 9.5 KiB | 289 | 240 | |
nir_lower_multiview.c | H A D | 09-Feb-2022 | 12.2 KiB | 352 | 216 | |
nir_lower_non_uniform_access.c | H A D | 09-Feb-2022 | 12.7 KiB | 373 | 268 | |
nir_lower_packing.c | H A D | 09-Feb-2022 | 5 KiB | 157 | 105 | |
nir_lower_passthrough_edgeflags.c | H A D | 09-Feb-2022 | 3.7 KiB | 105 | 58 | |
nir_lower_patch_vertices.c | H A D | 09-Feb-2022 | 3.9 KiB | 110 | 57 | |
nir_lower_phis_to_scalar.c | H A D | 09-Feb-2022 | 11.3 KiB | 326 | 164 | |
nir_lower_pntc_ytransform.c | H A D | 09-Feb-2022 | 4.9 KiB | 137 | 88 | |
nir_lower_point_size.c | H A D | 09-Feb-2022 | 3.7 KiB | 114 | 59 | |
nir_lower_point_size_mov.c | H A D | 09-Feb-2022 | 2.9 KiB | 82 | 42 | |
nir_lower_printf.c | H A D | 09-Feb-2022 | 5.9 KiB | 144 | 88 | |
nir_lower_readonly_images_to_tex.c | H A D | 09-Feb-2022 | 7.4 KiB | 215 | 144 | |
nir_lower_regs_to_ssa.c | H A D | 09-Feb-2022 | 9.8 KiB | 312 | 195 | |
nir_lower_returns.c | H A D | 09-Feb-2022 | 10 KiB | 309 | 182 | |
nir_lower_samplers.c | H A D | 09-Feb-2022 | 5.7 KiB | 179 | 103 | |
nir_lower_scratch.c | H A D | 09-Feb-2022 | 7.7 KiB | 235 | 153 | |
nir_lower_shader_calls.c | H A D | 09-Feb-2022 | 40.1 KiB | 1,130 | 659 | |
nir_lower_ssbo.c | H A D | 09-Feb-2022 | 7 KiB | 219 | 146 | |
nir_lower_subgroups.c | H A D | 09-Feb-2022 | 28.7 KiB | 766 | 544 | |
nir_lower_system_values.c | H A D | 09-Feb-2022 | 20.5 KiB | 526 | 334 | |
nir_lower_sysvals_to_varyings.c | H A D | 09-Feb-2022 | 2.5 KiB | 73 | 30 | |
nir_lower_tex.c | H A D | 09-Feb-2022 | 51.5 KiB | 1,514 | 1,099 | |
nir_lower_texcoord_replace.c | H A D | 09-Feb-2022 | 5.5 KiB | 154 | 100 | |
nir_lower_to_source_mods.c | H A D | 09-Feb-2022 | 7.1 KiB | 234 | 143 | |
nir_lower_two_sided_color.c | H A D | 09-Feb-2022 | 6.9 KiB | 236 | 158 | |
nir_lower_ubo_vec4.c | H A D | 09-Feb-2022 | 7.6 KiB | 194 | 94 | |
nir_lower_undef_to_zero.c | H A D | 09-Feb-2022 | 2.5 KiB | 64 | 20 | |
nir_lower_uniforms_to_ubo.c | H A D | 09-Feb-2022 | 6.9 KiB | 170 | 101 | |
nir_lower_var_copies.c | H A D | 09-Feb-2022 | 5.9 KiB | 174 | 111 | |
nir_lower_variable_initializers.c | H A D | 09-Feb-2022 | 7.1 KiB | 201 | 131 | |
nir_lower_vars_to_ssa.c | H A D | 09-Feb-2022 | 26.4 KiB | 822 | 503 | |
nir_lower_vec3_to_vec4.c | H A D | 09-Feb-2022 | 5.5 KiB | 170 | 119 | |
nir_lower_vec_to_movs.c | H A D | 09-Feb-2022 | 10.4 KiB | 319 | 179 | |
nir_lower_viewport_transform.c | H A D | 09-Feb-2022 | 4.3 KiB | 106 | 44 | |
nir_lower_wpos_center.c | H A D | 09-Feb-2022 | 3.9 KiB | 116 | 59 | |
nir_lower_wpos_ytransform.c | H A D | 09-Feb-2022 | 13.3 KiB | 365 | 227 | |
nir_lower_wrmasks.c | H A D | 09-Feb-2022 | 7.5 KiB | 234 | 123 | |
nir_metadata.c | H A D | 09-Feb-2022 | 3.3 KiB | 108 | 56 | |
nir_move_vec_src_uses_to_dest.c | H A D | 09-Feb-2022 | 6.7 KiB | 214 | 111 | |
nir_normalize_cubemap_coords.c | H A D | 09-Feb-2022 | 3.8 KiB | 117 | 62 | |
nir_opcodes.py | H A D | 09-Feb-2022 | 55.1 KiB | 1,483 | 1,066 | |
nir_opcodes_c.py | H A D | 09-Feb-2022 | 4.9 KiB | 129 | 97 | |
nir_opcodes_h.py | H A D | 09-Feb-2022 | 1.6 KiB | 46 | 39 | |
nir_opt_access.c | H A D | 09-Feb-2022 | 13 KiB | 370 | 279 | |
nir_opt_algebraic.py | H A D | 09-Feb-2022 | 145.9 KiB | 2,762 | 1,711 | |
nir_opt_barriers.c | H A D | 09-Feb-2022 | 2.7 KiB | 86 | 50 | |
nir_opt_combine_stores.c | H A D | 09-Feb-2022 | 15.9 KiB | 473 | 327 | |
nir_opt_comparison_pre.c | H A D | 09-Feb-2022 | 12.5 KiB | 385 | 201 | |
nir_opt_conditional_discard.c | H A D | 09-Feb-2022 | 4.7 KiB | 149 | 92 | |
nir_opt_constant_folding.c | H A D | 09-Feb-2022 | 11.5 KiB | 346 | 253 | |
nir_opt_copy_prop_vars.c | H A D | 09-Feb-2022 | 45.2 KiB | 1,332 | 942 | |
nir_opt_copy_propagate.c | H A D | 09-Feb-2022 | 5.4 KiB | 198 | 126 | |
nir_opt_cse.c | H A D | 09-Feb-2022 | 2.3 KiB | 80 | 36 | |
nir_opt_dce.c | H A D | 09-Feb-2022 | 7.9 KiB | 252 | 181 | |
nir_opt_dead_cf.c | H A D | 09-Feb-2022 | 14.2 KiB | 431 | 231 | |
nir_opt_dead_write_vars.c | H A D | 09-Feb-2022 | 9.7 KiB | 286 | 183 | |
nir_opt_find_array_copies.c | H A D | 09-Feb-2022 | 22.2 KiB | 686 | 453 | |
nir_opt_fragdepth.c | H A D | 09-Feb-2022 | 3.8 KiB | 112 | 59 | |
nir_opt_gcm.c | H A D | 09-Feb-2022 | 27.2 KiB | 806 | 491 | |
nir_opt_idiv_const.c | H A D | 09-Feb-2022 | 8.7 KiB | 262 | 200 | |
nir_opt_if.c | H A D | 09-Feb-2022 | 51.4 KiB | 1,560 | 807 | |
nir_opt_intrinsics.c | H A D | 09-Feb-2022 | 7 KiB | 231 | 153 | |
nir_opt_large_constants.c | H A D | 09-Feb-2022 | 13.6 KiB | 409 | 282 | |
nir_opt_load_store_vectorize.c | H A D | 09-Feb-2022 | 49.3 KiB | 1,427 | 1,097 | |
nir_opt_loop_unroll.c | H A D | 09-Feb-2022 | 38.4 KiB | 1,093 | 614 | |
nir_opt_memcpy.c | H A D | 09-Feb-2022 | 6.7 KiB | 225 | 153 | |
nir_opt_move.c | H A D | 09-Feb-2022 | 6 KiB | 173 | 78 | |
nir_opt_move_discards_to_top.c | H A D | 09-Feb-2022 | 8.3 KiB | 253 | 155 | |
nir_opt_offsets.c | H A D | 09-Feb-2022 | 5.2 KiB | 161 | 101 | |
nir_opt_peephole_select.c | H A D | 09-Feb-2022 | 16.7 KiB | 524 | 325 | |
nir_opt_phi_precision.c | H A D | 09-Feb-2022 | 14.1 KiB | 493 | 262 | |
nir_opt_rematerialize_compares.c | H A D | 09-Feb-2022 | 5.9 KiB | 199 | 125 | |
nir_opt_remove_phis.c | H A D | 09-Feb-2022 | 5.8 KiB | 187 | 96 | |
nir_opt_shrink_vectors.c | H A D | 09-Feb-2022 | 9.8 KiB | 323 | 218 | |
nir_opt_sink.c | H A D | 09-Feb-2022 | 7.6 KiB | 238 | 144 | |
nir_opt_trivial_continues.c | H A D | 09-Feb-2022 | 4.8 KiB | 140 | 83 | |
nir_opt_undef.c | H A D | 09-Feb-2022 | 5.7 KiB | 193 | 119 | |
nir_opt_uniform_atomics.c | H A D | 09-Feb-2022 | 10.9 KiB | 329 | 237 | |
nir_opt_vectorize.c | H A D | 09-Feb-2022 | 14.1 KiB | 447 | 305 | |
nir_phi_builder.c | H A D | 09-Feb-2022 | 10.9 KiB | 302 | 144 | |
nir_phi_builder.h | H A D | 09-Feb-2022 | 4.7 KiB | 120 | 17 | |
nir_print.c | H A D | 09-Feb-2022 | 48.9 KiB | 1,714 | 1,411 | |
nir_propagate_invariant.c | H A D | 09-Feb-2022 | 6.7 KiB | 233 | 163 | |
nir_range_analysis.c | H A D | 09-Feb-2022 | 68.3 KiB | 1,870 | 1,257 | |
nir_range_analysis.h | H A D | 09-Feb-2022 | 1.9 KiB | 64 | 29 | |
nir_remove_dead_variables.c | H A D | 09-Feb-2022 | 7 KiB | 229 | 154 | |
nir_repair_ssa.c | H A D | 09-Feb-2022 | 6.6 KiB | 211 | 135 | |
nir_schedule.c | H A D | 09-Feb-2022 | 34.9 KiB | 1,188 | 763 | |
nir_schedule.h | H A D | 09-Feb-2022 | 3.1 KiB | 85 | 27 | |
nir_search.c | H A D | 09-Feb-2022 | 31.3 KiB | 972 | 697 | |
nir_search.h | H A D | 09-Feb-2022 | 6.8 KiB | 216 | 94 | |
nir_search_helpers.h | H A D | 09-Feb-2022 | 17.3 KiB | 550 | 417 | |
nir_serialize.c | H A D | 09-Feb-2022 | 64.3 KiB | 2,135 | 1,674 | |
nir_serialize.h | H A D | 09-Feb-2022 | 1.6 KiB | 44 | 15 | |
nir_split_per_member_structs.c | H A D | 09-Feb-2022 | 6.5 KiB | 202 | 144 | |
nir_split_var_copies.c | H A D | 09-Feb-2022 | 5.5 KiB | 142 | 67 | |
nir_split_vars.c | H A D | 09-Feb-2022 | 58.5 KiB | 1,719 | 1,254 | |
nir_sweep.c | H A D | 09-Feb-2022 | 4.8 KiB | 170 | 96 | |
nir_to_lcssa.c | H A D | 09-Feb-2022 | 13.1 KiB | 423 | 282 | |
nir_validate.c | H A D | 09-Feb-2022 | 60.9 KiB | 1,810 | 1,338 | |
nir_vla.h | H A D | 09-Feb-2022 | 2.1 KiB | 57 | 10 | |
nir_vulkan.h | H A D | 09-Feb-2022 | 374 | 13 | 9 | |
nir_worklist.c | H A D | 09-Feb-2022 | 3.8 KiB | 156 | 95 | |
nir_worklist.h | H A D | 09-Feb-2022 | 4.8 KiB | 167 | 82 | |
nir_xfb_info.h | H A D | 09-Feb-2022 | 2.4 KiB | 81 | 45 |
README
1New IR, or NIR, is an IR for Mesa intended to sit below GLSL IR and Mesa IR. 2Its design inherits from the various IRs that Mesa has used in the past, as 3well as Direct3D assembly, and it includes a few new ideas as well. It is a 4flat (in terms of using instructions instead of expressions), typeless IR, 5similar to TGSI and Mesa IR. It also supports SSA (although it doesn't require 6it). 7 8Variables 9========= 10 11NIR includes support for source-level GLSL variables through a structure mostly 12copied from GLSL IR. These will be used for linking and conversion from GLSL IR 13(and later, from an AST), but for the most part, they will be lowered to 14registers (see below) and loads/stores. 15 16Registers 17========= 18 19Registers are light-weight; they consist of a structure that only contains its 20size, its index for liveness analysis, and an optional name for debugging. In 21addition, registers can be local to a function or global to the entire shader; 22the latter will be used in ARB_shader_subroutine for passing parameters and 23getting return values from subroutines. Registers can also be an array, in which 24case they can be accessed indirectly. Each ALU instruction (add, subtract, etc.) 25works directly with registers or SSA values (see below). 26 27SSA 28======== 29 30Everywhere a register can be loaded/stored, an SSA value can be used instead. 31The only exception is that arrays/indirect addressing are not supported with 32SSA; although research has been done on extensions of SSA to arrays before, it's 33usually for the purpose of parallelization (which we're not interested in), and 34adds some overhead in the form of adding copies or extra arrays (which is much 35more expensive than introducing copies between non-array registers). SSA uses 36point directly to their corresponding definition, which in turn points to the 37instruction it is part of. This creates an implicit use-def chain and avoids the 38need for an external structure for each SSA register. 39 40Functions 41========= 42 43Support for function calls is mostly similar to GLSL IR. Each shader contains a 44list of functions, and each function has a list of overloads. Each overload 45contains a list of parameters, and may contain an implementation which specifies 46the variables that correspond to the parameters and return value. Inlining a 47function, assuming it has a single return point, is as simple as copying its 48instructions, registers, and local variables into the target function and then 49inserting copies to and from the new parameters as appropriate. After functions 50are inlined and any non-subroutine functions are deleted, parameters and return 51variables will be converted to global variables and then global registers. We 52don't do this lowering earlier (i.e. the fortranizer idea) for a few reasons: 53 54- If we want to do optimizations before link time, we need to have the function 55signature available during link-time. 56 57- If we do any inlining before link time, then we might wind up with the 58inlined function and the non-inlined function using the same global 59variables/registers which would preclude optimization. 60 61Intrinsics 62========= 63 64Any operation (other than function calls and textures) which touches a variable 65or is not referentially transparent is represented by an intrinsic. Intrinsics 66are similar to the idea of a "builtin function," i.e. a function declaration 67whose implementation is provided by the backend, except they are more powerful 68in the following ways: 69 70- They can also load and store registers when appropriate, which limits the 71number of variables needed in later stages of the IR while obviating the need 72for a separate load/store variable instruction. 73 74- Intrinsics can be marked as side-effect free, which permits them to be 75treated like any other instruction when it comes to optimizations. This allows 76load intrinsics to be represented as intrinsics while still being optimized 77away by dead code elimination, common subexpression elimination, etc. 78 79Intrinsics are used for: 80 81- Atomic operations 82- Memory barriers 83- Subroutine calls 84- Geometry shader emitVertex and endPrimitive 85- Loading and storing variables (before lowering) 86- Loading and storing uniforms, shader inputs and outputs, etc (after lowering) 87- Copying variables (cases where in GLSL the destination is a structure or 88array) 89- The kitchen sink 90- ... 91 92Textures 93========= 94 95Unfortunately, there are far too many texture operations to represent each one 96of them with an intrinsic, so there's a special texture instruction similar to 97the GLSL IR one. The biggest difference is that, while the texture instruction 98has a sampler dereference field used just like in GLSL IR, this gets lowered to 99a texture unit index (with a possible indirect offset) while the type 100information of the original sampler is kept around for backends. Also, all the 101non-constant sources are stored in a single array to make it easier for 102optimization passes to iterate over all the sources. 103 104Control Flow 105========= 106 107Like in GLSL IR, control flow consists of a tree of "control flow nodes", which 108include if statements and loops, and jump instructions (break, continue, and 109return). Unlike GLSL IR, though, the leaves of the tree aren't statements but 110basic blocks. Each basic block also keeps track of its successors and 111predecessors, and function implementations keep track of the beginning basic 112block (the first basic block of the function) and the ending basic block (a fake 113basic block that every return statement points to). Together, these elements 114make up the control flow graph, in this case a redundant piece of information on 115top of the control flow tree that will be used by almost all the optimizations. 116There are helper functions to add and remove control flow nodes that also update 117the control flow graph, and so usually it doesn't need to be touched by passes 118that modify control flow nodes. 119