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 <caio.oliveira@intel.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3047> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3047>
This commit is contained in:

committed by
Caio Marcelo de Oliveira Filho

parent
e459c7f0a1
commit
e9f83185a2
@@ -402,7 +402,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
|
|||||||
* inline functions. That way they get properly initialized at the top
|
* inline functions. That way they get properly initialized at the top
|
||||||
* of the function and not at the top of its caller.
|
* 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_lower_returns);
|
||||||
NIR_PASS_V(nir, nir_inline_functions);
|
NIR_PASS_V(nir, nir_inline_functions);
|
||||||
NIR_PASS_V(nir, nir_opt_deref);
|
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
|
/* Make sure we lower constant initializers on output variables so that
|
||||||
* nir_remove_dead_variables below sees the corresponding stores
|
* 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
|
/* Now that we've deleted all but the main function, we can go ahead and
|
||||||
* lower the rest of the constant initializers.
|
* 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
|
/* Split member structs. We do this before lower_io_to_temporaries so that
|
||||||
* it doesn't lower system values to temporaries by accident.
|
* it doesn't lower system values to temporaries by accident.
|
||||||
|
@@ -243,7 +243,7 @@ NIR_FILES = \
|
|||||||
nir/nir_lower_clip.c \
|
nir/nir_lower_clip.c \
|
||||||
nir/nir_lower_clip_cull_distance_arrays.c \
|
nir/nir_lower_clip_cull_distance_arrays.c \
|
||||||
nir/nir_lower_clip_halfz.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_double_ops.c \
|
||||||
nir/nir_lower_drawpixels.c \
|
nir/nir_lower_drawpixels.c \
|
||||||
nir/nir_lower_fb_read.c \
|
nir/nir_lower_fb_read.c \
|
||||||
|
@@ -219,7 +219,7 @@ glsl_to_nir(struct gl_context *ctx,
|
|||||||
* inline functions. That way they get properly initialized at the top
|
* inline functions. That way they get properly initialized at the top
|
||||||
* of the function and not at the top of its caller.
|
* 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_lower_returns(shader);
|
||||||
nir_inline_functions(shader);
|
nir_inline_functions(shader);
|
||||||
nir_opt_deref(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_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_lower_returns);
|
||||||
NIR_PASS_V(nir, nir_inline_functions);
|
NIR_PASS_V(nir, nir_inline_functions);
|
||||||
NIR_PASS_V(nir, nir_opt_deref);
|
NIR_PASS_V(nir, nir_opt_deref);
|
||||||
|
@@ -124,7 +124,7 @@ files_libnir = files(
|
|||||||
'nir_lower_clip.c',
|
'nir_lower_clip.c',
|
||||||
'nir_lower_clip_cull_distance_arrays.c',
|
'nir_lower_clip_cull_distance_arrays.c',
|
||||||
'nir_lower_clip_halfz.c',
|
'nir_lower_clip_halfz.c',
|
||||||
'nir_lower_constant_initializers.c',
|
'nir_lower_variable_initializers.c',
|
||||||
'nir_lower_double_ops.c',
|
'nir_lower_double_ops.c',
|
||||||
'nir_lower_drawpixels.c',
|
'nir_lower_drawpixels.c',
|
||||||
'nir_lower_fb_read.c',
|
'nir_lower_fb_read.c',
|
||||||
|
@@ -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(nir_shader *shader);
|
||||||
bool nir_remove_dead_derefs_impl(nir_function_impl *impl);
|
bool nir_remove_dead_derefs_impl(nir_function_impl *impl);
|
||||||
bool nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes);
|
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);
|
nir_variable_mode modes);
|
||||||
|
|
||||||
bool nir_move_vec_src_uses_to_dest(nir_shader *shader);
|
bool nir_move_vec_src_uses_to_dest(nir_shader *shader);
|
||||||
|
@@ -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
|
* For most use-cases, function inlining is a multi-step process. The general
|
||||||
* pattern employed by SPIR-V consumers and others is as follows:
|
* 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
|
* 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
|
* 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
|
* 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".
|
* 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,
|
* Lowering constant initializers on inputs, outputs, global variables,
|
||||||
* etc. requires that we know the main entrypoint so that we know where to
|
* etc. requires that we know the main entrypoint so that we know where to
|
||||||
|
@@ -84,7 +84,7 @@ lower_const_initializer(struct nir_builder *b, struct exec_list *var_list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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;
|
bool progress = false;
|
||||||
|
|
@@ -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
|
* 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.
|
* 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_remove_dead_variables(b->shader,
|
||||||
nir_var_shader_in | nir_var_shader_out);
|
nir_var_shader_in | nir_var_shader_out);
|
||||||
|
|
||||||
|
@@ -414,7 +414,7 @@ tu_shader_create(struct tu_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* multi step inlining procedure */
|
/* 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_lower_returns);
|
||||||
NIR_PASS_V(nir, nir_inline_functions);
|
NIR_PASS_V(nir, nir_inline_functions);
|
||||||
NIR_PASS_V(nir, nir_opt_deref);
|
NIR_PASS_V(nir, nir_opt_deref);
|
||||||
@@ -423,7 +423,7 @@ tu_shader_create(struct tu_device *dev,
|
|||||||
exec_node_remove(&func->node);
|
exec_node_remove(&func->node);
|
||||||
}
|
}
|
||||||
assert(exec_list_length(&nir->functions) == 1);
|
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
|
/* Split member structs. We do this before lower_io_to_temporaries so that
|
||||||
* it doesn't lower system values to temporaries by accident.
|
* it doesn't lower system values to temporaries by accident.
|
||||||
|
@@ -104,7 +104,7 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
|
|||||||
|
|
||||||
// Inline all functions first.
|
// Inline all functions first.
|
||||||
// according to the comment on nir_inline_functions
|
// 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_lower_returns);
|
||||||
NIR_PASS_V(nir, nir_inline_functions);
|
NIR_PASS_V(nir, nir_inline_functions);
|
||||||
NIR_PASS_V(nir, nir_opt_deref);
|
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_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_variable_mode>(~nir_var_function_temp));
|
static_cast<nir_variable_mode>(~nir_var_function_temp));
|
||||||
|
|
||||||
// copy propagate to prepare for lower_explicit_io
|
// copy propagate to prepare for lower_explicit_io
|
||||||
|
@@ -250,7 +250,7 @@ anv_shader_compile_to_nir(struct anv_device *device,
|
|||||||
* inline functions. That way they get properly initialized at the top
|
* inline functions. That way they get properly initialized at the top
|
||||||
* of the function and not at the top of its caller.
|
* 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_lower_returns);
|
||||||
NIR_PASS_V(nir, nir_inline_functions);
|
NIR_PASS_V(nir, nir_inline_functions);
|
||||||
NIR_PASS_V(nir, nir_opt_deref);
|
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
|
* nir_remove_dead_variables and split_per_member_structs below see the
|
||||||
* corresponding stores.
|
* 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
|
/* Split member structs. We do this before lower_io_to_temporaries so that
|
||||||
* it doesn't lower system values to temporaries by accident.
|
* it doesn't lower system values to temporaries by accident.
|
||||||
|
@@ -284,7 +284,7 @@ _mesa_spirv_to_nir(struct gl_context *ctx,
|
|||||||
* inline functions. That way they get properly initialized at the top
|
* inline functions. That way they get properly initialized at the top
|
||||||
* of the function and not at the top of its caller.
|
* 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_lower_returns);
|
||||||
NIR_PASS_V(nir, nir_inline_functions);
|
NIR_PASS_V(nir, nir_inline_functions);
|
||||||
NIR_PASS_V(nir, nir_opt_deref);
|
NIR_PASS_V(nir, nir_opt_deref);
|
||||||
|
Reference in New Issue
Block a user