mesa/src/intel/compiler/elk
Alyssa Rosenzweig b824ef83ab util/dynarray: infer type in append
Most of the time, we can infer the type to append in
util_dynarray_append using __typeof__, which is standardized in C23 and
support in Jesse's MSMSVCV. This patch drops the type argument most of
the time, making util_dynarray a little more ergonomic to use.

This is done in four steps.

First, rename util_dynarray_append -> util_dynarray_append_typed

    bash -c "find . -type f -exec sed -i -e 's/util_dynarray_append(/util_dynarray_append_typed(/g' \{} \;"

Then, add a new append that infers the type. This is much more ergonomic
for what you want most of the time.

Next, use type-inferred append as much as possible, via Coccinelle
patch (plus manual fixup):

    @@
    expression dynarray, element;
    type type;
    @@

    -util_dynarray_append_typed(dynarray, type, element);
    +util_dynarray_append(dynarray, element);

Finally, hand fixup cases that Coccinelle missed or incorrectly
translated, of which there were several because we can't used the
untyped append with a literal (since the sizeof won't do what you want).

All four steps are squashed to produce a single patch changing every
util_dynarray_append call site in tree to either drop a type parameter
(if possible) or insert a _typed suffix (if we can't infer). As such,
the final patch is best reviewed by hand even though it was
tool-assisted.

No Long Linguine Meals were involved in the making of this patch.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38038>
2025-10-24 18:32:07 +00:00
..
tests intel/compiler tests: fix path-to-string conversion 2025-06-23 08:26:29 +00:00
elk_asm.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_asm_tool.c treewide: don't check before free 2025-10-15 23:01:33 +00:00
elk_cfg.cpp util/dynarray: infer type in append 2025-10-24 18:32:07 +00:00
elk_cfg.h intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_clip.h intel: Move devinfo->has_negative_rhw_bug into the elk compiler 2025-03-10 17:23:07 -07:00
elk_clip_line.c intel: Re-unify brw_prim.h and elk_prim.h 2025-10-09 07:01:46 +00:00
elk_clip_point.c
elk_clip_tri.c intel: Re-unify brw_prim.h and elk_prim.h 2025-10-09 07:01:46 +00:00
elk_clip_unfilled.c intel: Re-unify brw_prim.h and elk_prim.h 2025-10-09 07:01:46 +00:00
elk_clip_util.c
elk_compile_clip.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_compile_ff_gs.c intel: Re-unify brw_prim.h and elk_prim.h 2025-10-09 07:01:46 +00:00
elk_compile_sf.c intel: Re-unify brw_prim.h and elk_prim.h 2025-10-09 07:01:46 +00:00
elk_compiler.c intel: Move intel_shader_reloc to common code and drop elk_shader_reloc 2025-10-09 07:01:46 +00:00
elk_compiler.h intel: Move intel_shader_reloc to common code and drop elk_shader_reloc 2025-10-09 07:01:46 +00:00
elk_dead_control_flow.cpp
elk_dead_control_flow.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_debug_recompile.c intel: drop legacy flatshade handling 2025-09-18 14:14:11 +00:00
elk_disasm.c intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_disasm.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_disasm_info.c intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_disasm_info.h brw: Move into a new src/intel/compiler/brw subdirectory 2025-10-09 07:01:47 +00:00
elk_disasm_tool.c util/dynarray: infer type in append 2025-10-24 18:32:07 +00:00
elk_eu.c intel: Move intel_shader_reloc to common code and drop elk_shader_reloc 2025-10-09 07:01:46 +00:00
elk_eu.h intel: Move intel_shader_reloc to common code and drop elk_shader_reloc 2025-10-09 07:01:46 +00:00
elk_eu_compact.c intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_eu_defines.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_eu_emit.c intel: Move intel_shader_reloc to common code and drop elk_shader_reloc 2025-10-09 07:01:46 +00:00
elk_eu_opcodes.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_eu_util.c
elk_eu_validate.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_fs.cpp nir: Use nir_def_as_* in more places 2025-08-24 14:03:09 +00:00
elk_fs.h all: rename gl_shader_stage_uses_workgroup to mesa_shader_stage_uses_workgroup 2025-08-06 10:28:41 +08:00
elk_fs_bank_conflicts.cpp util: crib SWAP macro from freedreno 2025-07-21 11:42:18 +00:00
elk_fs_builder.h intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_fs_cmod_propagation.cpp
elk_fs_combine_constants.cpp elk: Increase the size of some structure fields in combine_constants 2025-09-22 20:02:25 +00:00
elk_fs_copy_propagation.cpp ralloc/linalloc: allow adding custom code to LINEAR_ALLOC new operator 2025-08-04 02:07:00 +00:00
elk_fs_cse.cpp intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_fs_dead_code_eliminate.cpp
elk_fs_generator.cpp all: rename gl_shader_stage to mesa_shader_stage 2025-08-06 10:28:40 +08:00
elk_fs_live_variables.cpp intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_fs_live_variables.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_fs_lower_pack.cpp build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_fs_lower_regioning.cpp build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_fs_nir.cpp brw: elk: Fix name of function in comment 2025-10-10 17:25:11 +00:00
elk_fs_reg_allocate.cpp intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_fs_register_coalesce.cpp
elk_fs_saturate_propagation.cpp intel/elk: Don't propagate saturate to an instruction that writes flags 2024-08-09 14:26:01 -07:00
elk_fs_sel_peephole.cpp intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_fs_thread_payload.cpp all: rename gl_shader_stage_is_compute to mesa_shader_stage_is_compute 2025-08-06 10:28:41 +08:00
elk_fs_validate.cpp
elk_fs_visitor.cpp build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_gfx6_gs_visitor.cpp intel: Re-unify brw_prim.h and elk_prim.h 2025-10-09 07:01:46 +00:00
elk_gfx6_gs_visitor.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_gram.y intel/elk_asm: Add BranchCtrl support 2024-11-02 18:01:20 +00:00
elk_inst.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_interpolation_map.c
elk_ir.h brw: Move into a new src/intel/compiler/brw subdirectory 2025-10-09 07:01:47 +00:00
elk_ir_allocator.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_ir_analysis.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_ir_fs.h build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_ir_performance.cpp
elk_ir_performance.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_ir_vec4.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_isa_info.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_lex.l intel/elk_asm: Add BranchCtrl support 2024-11-02 18:01:20 +00:00
elk_lower_logical_sends.cpp intel: drop clamp_fragment_color handling 2025-09-18 14:14:11 +00:00
elk_nir.c nir: remove manual nir_load_global_constant 2025-10-21 12:39:53 +02:00
elk_nir.h treewide: use nir_def_as_* 2025-08-01 15:34:24 +00:00
elk_nir_analyze_boolean_resolves.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_nir_analyze_ubo_ranges.c
elk_nir_attribute_workarounds.c treewide: simplify nir_def_rewrite_uses_after 2025-08-01 15:34:24 +00:00
elk_nir_lower_alpha_to_coverage.c nir: rename nir_lower_io_to_temporaries -> nir_lower_io_vars_to_temporaries 2025-06-26 18:20:54 +00:00
elk_nir_lower_cs_intrinsics.c all: rename gl_shader_stage_uses_workgroup to mesa_shader_stage_uses_workgroup 2025-08-06 10:28:41 +08:00
elk_nir_lower_storage_image.c build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_nir_options.c elk: Enable saturating float to integer conversion opcodes 2025-10-10 17:25:06 +00:00
elk_nir_options.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_nir_private.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_nir_trig_workarounds.py
elk_packed_float.c
elk_predicated_break.cpp intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_private.h intel: Move unlit centroid workaround into the elk compiler 2025-03-10 17:23:07 -07:00
elk_reg.h build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_reg_type.c
elk_reg_type.h build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_schedule_instructions.cpp intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_shader.cpp intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_shader.h all: rename gl_shader_stage to mesa_shader_stage 2025-08-06 10:28:40 +08:00
elk_simd_selection.cpp intel: switch to new subgroup size info 2025-09-12 21:05:17 +00:00
elk_spirv.c nir: add nir_vectorize_cb callback parameter to nir_lower_phis_to_scalar() 2025-07-08 15:33:59 +00:00
elk_test_eu_compact.cpp build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_test_eu_validate.cpp intel: Convert getenv() to os_get_option() 2025-09-25 17:01:18 -06:00
elk_test_fs_cmod_propagation.cpp intel: Convert getenv() to os_get_option() 2025-09-25 17:01:18 -06:00
elk_test_fs_combine_constants.cpp intel: Convert getenv() to os_get_option() 2025-09-25 17:01:18 -06:00
elk_test_fs_copy_propagation.cpp intel: Convert getenv() to os_get_option() 2025-09-25 17:01:18 -06:00
elk_test_fs_saturate_propagation.cpp nir: remove unused shader_info param in nir_create_shader 2025-09-12 21:05:17 +00:00
elk_test_predicated_break.cpp intel: Convert getenv() to os_get_option() 2025-09-25 17:01:18 -06:00
elk_test_simd_selection.cpp intel: Switch uint64_t intel_debug to a bitset 2025-04-22 23:09:26 +00:00
elk_test_vec4_cmod_propagation.cpp intel: Convert getenv() to os_get_option() 2025-09-25 17:01:18 -06:00
elk_test_vec4_copy_propagation.cpp intel: Convert getenv() to os_get_option() 2025-09-25 17:01:18 -06:00
elk_test_vec4_dead_code_eliminate.cpp intel: Convert getenv() to os_get_option() 2025-09-25 17:01:18 -06:00
elk_test_vec4_register_coalesce.cpp intel: Convert getenv() to os_get_option() 2025-09-25 17:01:18 -06:00
elk_test_vf_float_conversions.cpp
elk_vec4.cpp build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_vec4.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_vec4_builder.h intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_vec4_cmod_propagation.cpp build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_vec4_copy_propagation.cpp intel/elk: Fix wrong destination to memset 2025-01-24 01:09:26 +00:00
elk_vec4_cse.cpp intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_vec4_dead_code_eliminate.cpp
elk_vec4_generator.cpp all: rename gl_shader_stage to mesa_shader_stage 2025-08-06 10:28:40 +08:00
elk_vec4_gs_nir.cpp build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_vec4_gs_visitor.cpp intel: Re-unify brw_prim.h and elk_prim.h 2025-10-09 07:01:46 +00:00
elk_vec4_gs_visitor.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_vec4_live_variables.cpp intel: fork exec_node/list -> brw_exec_node/list as a private Intel utility 2025-07-31 20:23:02 +00:00
elk_vec4_live_variables.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_vec4_nir.cpp elk: Enable saturating float to integer conversion opcodes 2025-10-10 17:25:06 +00:00
elk_vec4_reg_allocate.cpp intel/elk: Remove uses of VLAs 2025-01-10 07:05:35 +00:00
elk_vec4_surface_builder.cpp
elk_vec4_surface_builder.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_vec4_tcs.cpp brw: add support for separate tessellation shader compilation 2025-09-05 07:46:17 +00:00
elk_vec4_tcs.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_vec4_tes.cpp
elk_vec4_tes.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_vec4_visitor.cpp build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
elk_vec4_vs.h intel/compiler: Use #pragma once instead of header guards 2024-12-11 19:47:44 +00:00
elk_vec4_vs_visitor.cpp
elk_vue_map.c all: rename gl_shader_stage to mesa_shader_stage 2025-08-06 10:28:40 +08:00
meson.build brw: Move into a new src/intel/compiler/brw subdirectory 2025-10-09 07:01:47 +00:00