From e9f83185a221b446717c96c4df8dc64ced43e24f Mon Sep 17 00:00:00 2001 From: Arcady Goldmints-Orlov Date: Fri, 7 Feb 2020 14:18:49 -0600 Subject: [PATCH] Rename nir_lower_constant_initializers to nir_lower_variable_initalizers This is naming is more clear as nir_variables can be initializes not just with a nir_constant but with a pointer to another nir_variable. Reviewed-by: Caio Marcelo de Oliveira Filho Tested-by: Marge Bot Part-of: --- src/amd/vulkan/radv_shader.c | 6 +++--- src/compiler/Makefile.sources | 2 +- src/compiler/glsl/glsl_to_nir.cpp | 4 ++-- src/compiler/nir/meson.build | 2 +- src/compiler/nir/nir.h | 2 +- src/compiler/nir/nir_inline_functions.c | 4 ++-- ...ant_initializers.c => nir_lower_variable_initializers.c} | 2 +- src/compiler/spirv/spirv_to_nir.c | 2 +- src/freedreno/vulkan/tu_shader.c | 4 ++-- src/gallium/state_trackers/clover/nir/invocation.cpp | 4 ++-- src/intel/vulkan/anv_pipeline.c | 4 ++-- src/mesa/main/glspirv.c | 2 +- 12 files changed, 19 insertions(+), 19 deletions(-) rename src/compiler/nir/{nir_lower_constant_initializers.c => nir_lower_variable_initializers.c} (98%) diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 7a413646987..f20a8849c8a 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -402,7 +402,7 @@ radv_shader_compile_to_nir(struct radv_device *device, * inline functions. That way they get properly initialized at the top * of the function and not at the top of its caller. */ - NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp); + NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); NIR_PASS_V(nir, nir_lower_returns); NIR_PASS_V(nir, nir_inline_functions); NIR_PASS_V(nir, nir_opt_deref); @@ -419,12 +419,12 @@ radv_shader_compile_to_nir(struct radv_device *device, /* Make sure we lower constant initializers on output variables so that * nir_remove_dead_variables below sees the corresponding stores */ - NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_shader_out); + NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_shader_out); /* Now that we've deleted all but the main function, we can go ahead and * lower the rest of the constant initializers. */ - NIR_PASS_V(nir, nir_lower_constant_initializers, ~0); + NIR_PASS_V(nir, nir_lower_variable_initializers, ~0); /* Split member structs. We do this before lower_io_to_temporaries so that * it doesn't lower system values to temporaries by accident. diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index 1b10e3e4bb7..a21d6d25ae3 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -243,7 +243,7 @@ NIR_FILES = \ nir/nir_lower_clip.c \ nir/nir_lower_clip_cull_distance_arrays.c \ nir/nir_lower_clip_halfz.c \ - nir/nir_lower_constant_initializers.c \ + nir/nir_lower_variable_initializers.c \ nir/nir_lower_double_ops.c \ nir/nir_lower_drawpixels.c \ nir/nir_lower_fb_read.c \ diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index fdc14bfe507..fed456a36ea 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -219,7 +219,7 @@ glsl_to_nir(struct gl_context *ctx, * inline functions. That way they get properly initialized at the top * of the function and not at the top of its caller. */ - nir_lower_constant_initializers(shader, (nir_variable_mode)~0); + nir_lower_variable_initializers(shader, (nir_variable_mode)~0); nir_lower_returns(shader); nir_inline_functions(shader); nir_opt_deref(shader); @@ -2784,7 +2784,7 @@ glsl_float64_funcs_to_nir(struct gl_context *ctx, nir_validate_shader(nir, "float64_funcs_to_nir"); - NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp); + NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); NIR_PASS_V(nir, nir_lower_returns); NIR_PASS_V(nir, nir_inline_functions); NIR_PASS_V(nir, nir_opt_deref); diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build index 315112759e9..8101dc8c870 100644 --- a/src/compiler/nir/meson.build +++ b/src/compiler/nir/meson.build @@ -124,7 +124,7 @@ files_libnir = files( 'nir_lower_clip.c', 'nir_lower_clip_cull_distance_arrays.c', 'nir_lower_clip_halfz.c', - 'nir_lower_constant_initializers.c', + 'nir_lower_variable_initializers.c', 'nir_lower_double_ops.c', 'nir_lower_drawpixels.c', 'nir_lower_fb_read.c', diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 969fbac60e5..4939240653b 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3848,7 +3848,7 @@ bool nir_lower_vars_to_ssa(nir_shader *shader); bool nir_remove_dead_derefs(nir_shader *shader); bool nir_remove_dead_derefs_impl(nir_function_impl *impl); bool nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes); -bool nir_lower_constant_initializers(nir_shader *shader, +bool nir_lower_variable_initializers(nir_shader *shader, nir_variable_mode modes); bool nir_move_vec_src_uses_to_dest(nir_shader *shader); diff --git a/src/compiler/nir/nir_inline_functions.c b/src/compiler/nir/nir_inline_functions.c index 8226d50b44b..b1f83d6e03f 100644 --- a/src/compiler/nir/nir_inline_functions.c +++ b/src/compiler/nir/nir_inline_functions.c @@ -158,7 +158,7 @@ inline_function_impl(nir_function_impl *impl, struct set *inlined) * For most use-cases, function inlining is a multi-step process. The general * pattern employed by SPIR-V consumers and others is as follows: * - * 1. nir_lower_constant_initializers(shader, nir_var_function_temp) + * 1. nir_lower_variable_initializers(shader, nir_var_function_temp) * * This is needed because local variables from the callee are simply added * to the locals list for the caller and the information about where the @@ -213,7 +213,7 @@ inline_function_impl(nir_function_impl *impl, struct set *inlined) * spirv_to_nir returns the root function and so we can just use == whereas * with GL, you may have to look for a function named "main". * - * 6. nir_lower_constant_initializers(shader, ~nir_var_function_temp) + * 6. nir_lower_variable_initializers(shader, ~nir_var_function_temp) * * Lowering constant initializers on inputs, outputs, global variables, * etc. requires that we know the main entrypoint so that we know where to diff --git a/src/compiler/nir/nir_lower_constant_initializers.c b/src/compiler/nir/nir_lower_variable_initializers.c similarity index 98% rename from src/compiler/nir/nir_lower_constant_initializers.c rename to src/compiler/nir/nir_lower_variable_initializers.c index 03f5a2f404c..b2a17d0584b 100644 --- a/src/compiler/nir/nir_lower_constant_initializers.c +++ b/src/compiler/nir/nir_lower_variable_initializers.c @@ -84,7 +84,7 @@ lower_const_initializer(struct nir_builder *b, struct exec_list *var_list) } bool -nir_lower_constant_initializers(nir_shader *shader, nir_variable_mode modes) +nir_lower_variable_initializers(nir_shader *shader, nir_variable_mode modes) { bool progress = false; diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 22cbaf4145a..a3b9c5f6c7e 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -5388,7 +5388,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count, * right away. In order to do so, we must lower any constant initializers * on outputs so nir_remove_dead_variables sees that they're written to. */ - nir_lower_constant_initializers(b->shader, nir_var_shader_out); + nir_lower_variable_initializers(b->shader, nir_var_shader_out); nir_remove_dead_variables(b->shader, nir_var_shader_in | nir_var_shader_out); diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c index 323a244e81a..9df70400449 100644 --- a/src/freedreno/vulkan/tu_shader.c +++ b/src/freedreno/vulkan/tu_shader.c @@ -414,7 +414,7 @@ tu_shader_create(struct tu_device *dev, } /* multi step inlining procedure */ - NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp); + NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); NIR_PASS_V(nir, nir_lower_returns); NIR_PASS_V(nir, nir_inline_functions); NIR_PASS_V(nir, nir_opt_deref); @@ -423,7 +423,7 @@ tu_shader_create(struct tu_device *dev, exec_node_remove(&func->node); } assert(exec_list_length(&nir->functions) == 1); - NIR_PASS_V(nir, nir_lower_constant_initializers, ~nir_var_function_temp); + NIR_PASS_V(nir, nir_lower_variable_initializers, ~nir_var_function_temp); /* Split member structs. We do this before lower_io_to_temporaries so that * it doesn't lower system values to temporaries by accident. diff --git a/src/gallium/state_trackers/clover/nir/invocation.cpp b/src/gallium/state_trackers/clover/nir/invocation.cpp index 0522115a58d..87a98046cc1 100644 --- a/src/gallium/state_trackers/clover/nir/invocation.cpp +++ b/src/gallium/state_trackers/clover/nir/invocation.cpp @@ -104,7 +104,7 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev, // Inline all functions first. // according to the comment on nir_inline_functions - NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp); + NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); NIR_PASS_V(nir, nir_lower_returns); NIR_PASS_V(nir, nir_inline_functions); NIR_PASS_V(nir, nir_opt_deref); @@ -118,7 +118,7 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev, nir_validate_shader(nir, "clover after function inlining"); - NIR_PASS_V(nir, nir_lower_constant_initializers, + NIR_PASS_V(nir, nir_lower_variable_initializers, static_cast(~nir_var_function_temp)); // copy propagate to prepare for lower_explicit_io diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 2e822a6aba6..e6958c40ce6 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -250,7 +250,7 @@ anv_shader_compile_to_nir(struct anv_device *device, * inline functions. That way they get properly initialized at the top * of the function and not at the top of its caller. */ - NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp); + NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); NIR_PASS_V(nir, nir_lower_returns); NIR_PASS_V(nir, nir_inline_functions); NIR_PASS_V(nir, nir_opt_deref); @@ -267,7 +267,7 @@ anv_shader_compile_to_nir(struct anv_device *device, * nir_remove_dead_variables and split_per_member_structs below see the * corresponding stores. */ - NIR_PASS_V(nir, nir_lower_constant_initializers, ~0); + NIR_PASS_V(nir, nir_lower_variable_initializers, ~0); /* Split member structs. We do this before lower_io_to_temporaries so that * it doesn't lower system values to temporaries by accident. diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c index 08886954d33..4a8165fa4e1 100644 --- a/src/mesa/main/glspirv.c +++ b/src/mesa/main/glspirv.c @@ -284,7 +284,7 @@ _mesa_spirv_to_nir(struct gl_context *ctx, * inline functions. That way they get properly initialized at the top * of the function and not at the top of its caller. */ - NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp); + NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); NIR_PASS_V(nir, nir_lower_returns); NIR_PASS_V(nir, nir_inline_functions); NIR_PASS_V(nir, nir_opt_deref); -- 2.30.2