nir: Add a nir_foreach_function_temp_variable helper
Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
This commit is contained in:

committed by
Marge Bot

parent
2956d53400
commit
92dcda5ce9
@@ -5254,7 +5254,7 @@ setup_locals(struct ac_nir_context *ctx,
|
||||
{
|
||||
int i, j;
|
||||
ctx->num_locals = 0;
|
||||
nir_foreach_variable(variable, &func->impl->locals) {
|
||||
nir_foreach_function_temp_variable(variable, func->impl) {
|
||||
unsigned attrib_count = glsl_count_attribute_slots(variable->type, false);
|
||||
variable->data.driver_location = ctx->num_locals * 4;
|
||||
variable->data.location_frac = 0;
|
||||
|
@@ -2750,6 +2750,12 @@ typedef struct {
|
||||
nir_metadata valid_metadata;
|
||||
} nir_function_impl;
|
||||
|
||||
#define nir_foreach_function_temp_variable(var, impl) \
|
||||
foreach_list_typed(nir_variable, var, node, &(impl)->locals)
|
||||
|
||||
#define nir_foreach_function_temp_variable_safe(var, impl) \
|
||||
foreach_list_typed_safe(nir_variable, var, node, &(impl)->locals)
|
||||
|
||||
ATTRIBUTE_RETURNS_NONNULL static inline nir_block *
|
||||
nir_start_block(nir_function_impl *impl)
|
||||
{
|
||||
|
@@ -185,7 +185,7 @@ nir_opt_large_constants(nir_shader *shader,
|
||||
}
|
||||
|
||||
struct var_info *var_infos = ralloc_array(NULL, struct var_info, num_locals);
|
||||
nir_foreach_variable(var, &impl->locals) {
|
||||
nir_foreach_function_temp_variable(var, impl) {
|
||||
var_infos[var->index] = (struct var_info) {
|
||||
.var = var,
|
||||
.is_constant = true,
|
||||
|
@@ -1431,7 +1431,7 @@ print_function_impl(nir_function_impl *impl, print_state *state)
|
||||
|
||||
fprintf(fp, "{\n");
|
||||
|
||||
nir_foreach_variable(var, &impl->locals) {
|
||||
nir_foreach_function_temp_variable(var, impl) {
|
||||
fprintf(fp, "\t");
|
||||
print_var_decl(var, state);
|
||||
}
|
||||
|
@@ -1178,7 +1178,7 @@ validate_function_impl(nir_function_impl *impl, validate_state *state)
|
||||
state->parent_node = &impl->cf_node;
|
||||
|
||||
exec_list_validate(&impl->locals);
|
||||
nir_foreach_variable(var, &impl->locals) {
|
||||
nir_foreach_function_temp_variable(var, impl) {
|
||||
validate_var_decl(var, nir_var_function_temp, state);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user