nir: rename nir_var_private to nir_var_shader_temp
authorKarol Herbst <kherbst@redhat.com>
Tue, 15 Jan 2019 22:56:29 +0000 (23:56 +0100)
committerKarol Herbst <kherbst@redhat.com>
Sat, 19 Jan 2019 19:01:41 +0000 (20:01 +0100)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
17 files changed:
src/compiler/glsl/glsl_to_nir.cpp
src/compiler/nir/nir.c
src/compiler/nir/nir.h
src/compiler/nir/nir_linking_helpers.c
src/compiler/nir/nir_lower_clip.c
src/compiler/nir/nir_lower_constant_initializers.c
src/compiler/nir/nir_lower_global_vars_to_local.c
src/compiler/nir/nir_lower_io_to_temporaries.c
src/compiler/nir/nir_opt_copy_prop_vars.c
src/compiler/nir/nir_opt_dead_write_vars.c
src/compiler/nir/nir_print.c
src/compiler/nir/nir_remove_dead_variables.c
src/compiler/nir/nir_split_vars.c
src/compiler/nir/tests/vars_tests.cpp
src/compiler/spirv/vtn_variables.c
src/gallium/auxiliary/nir/tgsi_to_nir.c
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 8f786575fcebade5e2ac0a80caab880b01233525..f04e0d59ab1942b08f95bc1914851a52e4d7fdd8 100644 (file)
@@ -324,7 +324,7 @@ nir_visitor::visit(ir_variable *ir)
    case ir_var_auto:
    case ir_var_temporary:
       if (is_global)
-         var->data.mode = nir_var_private;
+         var->data.mode = nir_var_shader_temp;
       else
          var->data.mode = nir_var_function;
       break;
@@ -1564,7 +1564,7 @@ nir_visitor::visit(ir_expression *ir)
           * sense, we'll just turn it into a load which will probably
           * eventually end up as an SSA definition.
           */
-         assert(this->deref->mode == nir_var_private);
+         assert(this->deref->mode == nir_var_shader_temp);
          op = nir_intrinsic_load_deref;
       }
 
index 1fc09d9c250c157b6aee165263cc5142fa2a8b39..8a92be9f2253640ae87c363a6c118031161cb849 100644 (file)
@@ -129,7 +129,7 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var)
       assert(!"nir_shader_add_variable cannot be used for local variables");
       break;
 
-   case nir_var_private:
+   case nir_var_shader_temp:
       exec_list_push_tail(&shader->globals, &var->node);
       break;
 
index d12c499ad7532e66d3c982bbb883e00520b7505c..534bdcd01c61d84afd8bdc44129bd0a550d9aeca 100644 (file)
@@ -97,7 +97,7 @@ typedef struct {
 typedef enum {
    nir_var_shader_in       = (1 << 0),
    nir_var_shader_out      = (1 << 1),
-   nir_var_private         = (1 << 2),
+   nir_var_shader_temp     = (1 << 2),
    nir_var_function        = (1 << 3),
    nir_var_uniform         = (1 << 4),
    nir_var_ubo             = (1 << 5),
index b85e1295da3dfaf5b728d2183bdae94173980f7a..8e67e84b58827fb89de05edcbc42570328056563 100644 (file)
@@ -133,7 +133,7 @@ nir_remove_unused_io_vars(nir_shader *shader, struct exec_list *var_list,
       if (!(other_stage & get_variable_io_mask(var, shader->info.stage))) {
          /* This one is invalid, make it a global variable instead */
          var->data.location = 0;
-         var->data.mode = nir_var_private;
+         var->data.mode = nir_var_shader_temp;
 
          exec_node_remove(&var->node);
          exec_list_push_tail(&shader->globals, &var->node);
index 6fdf1a9b008729bb0b219d8cd3b6d0edb87bc9f5..474854d047b0ddd38daaacf37aadb59014dc80fc 100644 (file)
@@ -212,7 +212,7 @@ nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables, bool use_vars)
 
       if (clipvertex) {
          exec_node_remove(&clipvertex->node);
-         clipvertex->data.mode = nir_var_private;
+         clipvertex->data.mode = nir_var_shader_temp;
          exec_list_push_tail(&shader->globals, &clipvertex->node);
       }
    } else {
index 959d1eabfcae9420ac9b4e2342efcdd042244ab9..cc100dde63c4eec7a9be9519aabb03c5403efcd4 100644 (file)
@@ -103,7 +103,7 @@ nir_lower_constant_initializers(nir_shader *shader, nir_variable_mode modes)
       if ((modes & nir_var_shader_out) && function->is_entrypoint)
          impl_progress |= lower_const_initializer(&builder, &shader->outputs);
 
-      if ((modes & nir_var_private) && function->is_entrypoint)
+      if ((modes & nir_var_shader_temp) && function->is_entrypoint)
          impl_progress |= lower_const_initializer(&builder, &shader->globals);
 
       if ((modes & nir_var_system_value) && function->is_entrypoint)
index 9eb76c7ed6c69b07612ec493d9bb19964d111deb..64eb6a670ae38d11578e23433ef301f4df30564f 100644 (file)
@@ -36,7 +36,7 @@ static void
 register_var_use(nir_variable *var, nir_function_impl *impl,
                  struct hash_table *var_func_table)
 {
-   if (var->data.mode != nir_var_private)
+   if (var->data.mode != nir_var_shader_temp)
       return;
 
    struct hash_entry *entry =
@@ -87,7 +87,7 @@ nir_lower_global_vars_to_local(nir_shader *shader)
       nir_variable *var = (void *)entry->key;
       nir_function_impl *impl = entry->data;
 
-      assert(var->data.mode == nir_var_private);
+      assert(var->data.mode == nir_var_shader_temp);
 
       if (impl != NULL) {
          exec_node_remove(&var->node);
index 2487add33ed5c036956c43fd3e0a9d13005b4f81..7602637d428b1a1090f795a397849d08b1a40e7f 100644 (file)
@@ -134,7 +134,7 @@ create_shadow_temp(struct lower_io_state *state, nir_variable *var)
    /* Give the original a new name with @<mode>-temp appended */
    const char *mode = (temp->data.mode == nir_var_shader_in) ? "in" : "out";
    temp->name = ralloc_asprintf(var, "%s@%s-temp", mode, nvar->name);
-   temp->data.mode = nir_var_private;
+   temp->data.mode = nir_var_shader_temp;
    temp->data.read_only = false;
    temp->data.fb_fetch_output = false;
    temp->data.compact = false;
index 8a5e11550826f1c72bdccf11722cf0a92d47f8de..21e58b578f457a14ddb1f7c2acce11569e40e0b9 100644 (file)
@@ -133,7 +133,7 @@ gather_vars_written(struct copy_prop_var_state *state,
       nir_foreach_instr(instr, block) {
          if (instr->type == nir_instr_type_call) {
             written->modes |= nir_var_shader_out |
-                              nir_var_private |
+                              nir_var_shader_temp |
                               nir_var_function |
                               nir_var_ssbo |
                               nir_var_shared;
@@ -624,7 +624,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
    nir_foreach_instr_safe(instr, block) {
       if (instr->type == nir_instr_type_call) {
          apply_barrier_for_modes(copies, nir_var_shader_out |
-                                         nir_var_private |
+                                         nir_var_shader_temp |
                                          nir_var_function |
                                          nir_var_ssbo |
                                          nir_var_shared);
index 49c71cced213233d0bb09957a3e6efa0aceab8c2..d8411e3cad9333db802a9f6649332d20fc7a8c30 100644 (file)
@@ -119,7 +119,7 @@ remove_dead_write_vars_local(void *mem_ctx, nir_block *block)
    nir_foreach_instr_safe(instr, block) {
       if (instr->type == nir_instr_type_call) {
          clear_unused_for_modes(&unused_writes, nir_var_shader_out |
-                                                nir_var_private |
+                                                nir_var_shader_temp |
                                                 nir_var_function |
                                                 nir_var_ssbo |
                                                 nir_var_shared);
index 88a82b1ef17ca50f7a2cebcc7a82e80fa59dae05..f0142ab3b9261e1fd8a669e9ac953aa505712851 100644 (file)
@@ -421,8 +421,8 @@ get_variable_mode_str(nir_variable_mode mode, bool want_local_global_mode)
       return "ssbo";
    case nir_var_shared:
       return "shared";
-   case nir_var_private:
-      return want_local_global_mode ? "private" : "";
+   case nir_var_shader_temp:
+      return want_local_global_mode ? "shader_temp" : "";
    case nir_var_function:
       return want_local_global_mode ? "function" : "";
    default:
index 5c345bdb8542a1cf73861aa90608d4644fb08f49..8804dfe610515fcf19accebf0449d7862359324f 100644 (file)
@@ -71,7 +71,7 @@ add_var_use_deref(nir_deref_instr *deref, struct set *live)
     * all means we need to keep it alive.
     */
    assert(deref->mode == deref->var->data.mode);
-   if (!(deref->mode & (nir_var_function | nir_var_private | nir_var_shared)) ||
+   if (!(deref->mode & (nir_var_function | nir_var_shader_temp | nir_var_shared)) ||
        deref_used_for_not_store(deref))
       _mesa_set_add(live, deref->var);
 }
@@ -177,7 +177,7 @@ nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes)
    if (modes & nir_var_shader_out)
       progress = remove_dead_vars(&shader->outputs, live) || progress;
 
-   if (modes & nir_var_private)
+   if (modes & nir_var_shader_temp)
       progress = remove_dead_vars(&shader->globals, live) || progress;
 
    if (modes & nir_var_system_value)
index 0cf3e517f85d8ed1909f2802f5ce5c24d8d18d4e..6d4df61521aaff9b5cf0fc075e8ff08a02c11e5a 100644 (file)
@@ -259,10 +259,10 @@ nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes)
    struct hash_table *var_field_map =
       _mesa_pointer_hash_table_create(mem_ctx);
 
-   assert((modes & (nir_var_private | nir_var_function)) == modes);
+   assert((modes & (nir_var_shader_temp | nir_var_function)) == modes);
 
    bool has_global_splits = false;
-   if (modes & nir_var_private) {
+   if (modes & nir_var_shader_temp) {
       has_global_splits = split_var_list_structs(shader, NULL,
                                                  &shader->globals,
                                                  var_field_map, mem_ctx);
@@ -794,10 +794,10 @@ nir_split_array_vars(nir_shader *shader, nir_variable_mode modes)
    void *mem_ctx = ralloc_context(NULL);
    struct hash_table *var_info_map = _mesa_pointer_hash_table_create(mem_ctx);
 
-   assert((modes & (nir_var_private | nir_var_function)) == modes);
+   assert((modes & (nir_var_shader_temp | nir_var_function)) == modes);
 
    bool has_global_array = false;
-   if (modes & nir_var_private) {
+   if (modes & nir_var_shader_temp) {
       has_global_array = init_var_list_array_infos(&shader->globals,
                                                    var_info_map, mem_ctx);
    }
@@ -826,7 +826,7 @@ nir_split_array_vars(nir_shader *shader, nir_variable_mode modes)
    }
 
    bool has_global_splits = false;
-   if (modes & nir_var_private) {
+   if (modes & nir_var_shader_temp) {
       has_global_splits = split_var_list_arrays(shader, NULL,
                                                 &shader->globals,
                                                 var_info_map, mem_ctx);
@@ -1491,7 +1491,7 @@ function_impl_has_vars_with_modes(nir_function_impl *impl,
 {
    nir_shader *shader = impl->function->shader;
 
-   if ((modes & nir_var_private) && !exec_list_is_empty(&shader->globals))
+   if ((modes & nir_var_shader_temp) && !exec_list_is_empty(&shader->globals))
       return true;
 
    if ((modes & nir_var_function) && !exec_list_is_empty(&impl->locals))
@@ -1512,7 +1512,7 @@ function_impl_has_vars_with_modes(nir_function_impl *impl,
 bool
 nir_shrink_vec_array_vars(nir_shader *shader, nir_variable_mode modes)
 {
-   assert((modes & (nir_var_private | nir_var_function)) == modes);
+   assert((modes & (nir_var_shader_temp | nir_var_function)) == modes);
 
    void *mem_ctx = ralloc_context(NULL);
 
@@ -1540,7 +1540,7 @@ nir_shrink_vec_array_vars(nir_shader *shader, nir_variable_mode modes)
    }
 
    bool globals_shrunk = false;
-   if (modes & nir_var_private)
+   if (modes & nir_var_shader_temp)
       globals_shrunk = shrink_vec_var_list(&shader->globals, var_usage_map);
 
    bool progress = false;
index 8e187b4646a298a4a629420dd3330ae4fceda2f8..43d87f378addd0c366abae053b74f519ba0aff29 100644 (file)
@@ -191,7 +191,7 @@ TEST_F(nir_redundant_load_vars_test, invalidate_inside_if_block)
     * if statement.  They should be invalidated accordingly.
     */
 
-   nir_variable **g = create_many_int(nir_var_private, "g", 3);
+   nir_variable **g = create_many_int(nir_var_shader_temp, "g", 3);
    nir_variable **out = create_many_int(nir_var_shader_out, "out", 3);
 
    nir_load_var(b, g[0]);
index 6106ff355916ad14d8c625f4373f1fa804070c8e..9f42039aa25f6ee8ab2f6d6c2ebda3cc3ff10518 100644 (file)
@@ -1694,7 +1694,7 @@ vtn_storage_class_to_mode(struct vtn_builder *b,
       break;
    case SpvStorageClassPrivate:
       mode = vtn_variable_mode_private;
-      nir_mode = nir_var_private;
+      nir_mode = nir_var_shader_temp;
       break;
    case SpvStorageClassFunction:
       mode = vtn_variable_mode_function;
index d4b9d2936954e23674e99919846434a8f3796541..e51da58c9bc4187c935fd30d2c11e40a82c66dae 100644 (file)
@@ -182,7 +182,7 @@ ttn_emit_declaration(struct ttn_compile *c)
          nir_variable *var = rzalloc(b->shader, nir_variable);
 
          var->type = glsl_array_type(glsl_vec4_type(), array_size, 0);
-         var->data.mode = nir_var_private;
+         var->data.mode = nir_var_shader_temp;
          var->name = ralloc_asprintf(var, "arr_%d", decl->Array.ArrayID);
 
          exec_list_push_tail(&b->shader->globals, &var->node);
index 3ab7af7c20c385933f3da664715052cc5af88184..31cc9faf0e6ba1cea669d6df93758ff72a078ed9 100644 (file)
@@ -103,7 +103,7 @@ st_nir_assign_vs_in_locations(nir_shader *nir)
           * set.
           */
          exec_node_remove(&var->node);
-         var->data.mode = nir_var_private;
+         var->data.mode = nir_var_shader_temp;
          exec_list_push_tail(&nir->globals, &var->node);
       }
    }