From: Karol Herbst Date: Tue, 15 Jan 2019 23:12:38 +0000 (+0100) Subject: nir: rename nir_var_shared to nir_var_mem_shared X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=36a76b7192707edce540a7db8809df00e8643514;p=mesa.git nir: rename nir_var_shared to nir_var_mem_shared Signed-off-by: Karol Herbst Acked-by: Jason Ekstrand Reviewed-by: Eric Anholt Reviewed-by: Kenneth Graunke Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index e3475e1e94f..c558873bbee 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1891,7 +1891,7 @@ static LLVMValueRef visit_load_var(struct ac_nir_context *ctx, LLVMValueRef ret; unsigned const_index; unsigned stride = 4; - int mode = nir_var_shared; + int mode = nir_var_mem_shared; if (var) { bool vs_in = ctx->stage == MESA_SHADER_VERTEX && @@ -1964,7 +1964,7 @@ static LLVMValueRef visit_load_var(struct ac_nir_context *ctx, } } break; - case nir_var_shared: { + case nir_var_mem_shared: { LLVMValueRef address = get_src(ctx, instr->src[0]); LLVMValueRef val = LLVMBuildLoad(ctx->ac.builder, address, ""); return LLVMBuildBitCast(ctx->ac.builder, val, @@ -2103,7 +2103,7 @@ visit_store_var(struct ac_nir_context *ctx, } } break; - case nir_var_shared: { + case nir_var_mem_shared: { int writemask = instr->const_index[0]; LLVMValueRef address = get_src(ctx, instr->src[0]); LLVMValueRef val = get_src(ctx, instr->src[1]); @@ -3792,7 +3792,7 @@ static void visit_jump(struct ac_llvm_context *ctx, static void visit_deref(struct ac_nir_context *ctx, nir_deref_instr *instr) { - if (instr->mode != nir_var_shared) + if (instr->mode != nir_var_mem_shared) return; LLVMValueRef result = NULL; diff --git a/src/compiler/glsl/gl_nir_lower_atomics.c b/src/compiler/glsl/gl_nir_lower_atomics.c index 8bbce00e467..60642e7130a 100644 --- a/src/compiler/glsl/gl_nir_lower_atomics.c +++ b/src/compiler/glsl/gl_nir_lower_atomics.c @@ -102,7 +102,7 @@ lower_deref_instr(nir_builder *b, nir_intrinsic_instr *instr, if (var->data.mode != nir_var_uniform && var->data.mode != nir_var_mem_ssbo && - var->data.mode != nir_var_shared) + var->data.mode != nir_var_mem_shared) return false; /* atomics passed as function arguments can't be lowered */ const unsigned uniform_loc = var->data.location; diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 2b9b1f7f981..446e256ecdd 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -147,7 +147,7 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var) exec_list_push_tail(&shader->uniforms, &var->node); break; - case nir_var_shared: + case nir_var_mem_shared: assert(shader->info.stage == MESA_SHADER_COMPUTE); exec_list_push_tail(&shader->shared, &var->node); break; diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 6d4bb4e8095..6fc4a831b52 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -103,7 +103,7 @@ typedef enum { nir_var_mem_ubo = (1 << 5), nir_var_system_value = (1 << 6), nir_var_mem_ssbo = (1 << 7), - nir_var_shared = (1 << 8), + nir_var_mem_shared = (1 << 8), nir_var_all = ~0, } nir_variable_mode; diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index d3d2d95f375..06598e054a6 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -189,7 +189,7 @@ lower_load(nir_intrinsic_instr *intrin, struct lower_io_state *state, case nir_var_uniform: op = nir_intrinsic_load_uniform; break; - case nir_var_shared: + case nir_var_mem_shared: op = nir_intrinsic_load_shared; break; default: @@ -228,7 +228,7 @@ lower_store(nir_intrinsic_instr *intrin, struct lower_io_state *state, nir_variable_mode mode = var->data.mode; nir_intrinsic_op op; - if (mode == nir_var_shared) { + if (mode == nir_var_mem_shared) { op = nir_intrinsic_store_shared; } else { assert(mode == nir_var_shader_out); @@ -261,7 +261,7 @@ static nir_intrinsic_instr * lower_atomic(nir_intrinsic_instr *intrin, struct lower_io_state *state, nir_variable *var, nir_ssa_def *offset) { - assert(var->data.mode == nir_var_shared); + assert(var->data.mode == nir_var_mem_shared); nir_intrinsic_op op; switch (intrin->intrinsic) { @@ -407,7 +407,7 @@ nir_lower_io_block(nir_block *block, if (mode != nir_var_shader_in && mode != nir_var_shader_out && - mode != nir_var_shared && + mode != nir_var_mem_shared && mode != nir_var_uniform) continue; diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c index 39c3d52611a..392fef407cf 100644 --- a/src/compiler/nir/nir_opt_copy_prop_vars.c +++ b/src/compiler/nir/nir_opt_copy_prop_vars.c @@ -136,7 +136,7 @@ gather_vars_written(struct copy_prop_var_state *state, nir_var_shader_temp | nir_var_function_temp | nir_var_mem_ssbo | - nir_var_shared; + nir_var_mem_shared; continue; } @@ -149,7 +149,7 @@ gather_vars_written(struct copy_prop_var_state *state, case nir_intrinsic_memory_barrier: written->modes |= nir_var_shader_out | nir_var_mem_ssbo | - nir_var_shared; + nir_var_mem_shared; break; case nir_intrinsic_emit_vertex: @@ -627,7 +627,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state, nir_var_shader_temp | nir_var_function_temp | nir_var_mem_ssbo | - nir_var_shared); + nir_var_mem_shared); continue; } @@ -640,7 +640,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state, case nir_intrinsic_memory_barrier: apply_barrier_for_modes(copies, nir_var_shader_out | nir_var_mem_ssbo | - nir_var_shared); + nir_var_mem_shared); break; case nir_intrinsic_emit_vertex: diff --git a/src/compiler/nir/nir_opt_dead_write_vars.c b/src/compiler/nir/nir_opt_dead_write_vars.c index 6c0539e492e..d2062a01ac0 100644 --- a/src/compiler/nir/nir_opt_dead_write_vars.c +++ b/src/compiler/nir/nir_opt_dead_write_vars.c @@ -122,7 +122,7 @@ remove_dead_write_vars_local(void *mem_ctx, nir_block *block) nir_var_shader_temp | nir_var_function_temp | nir_var_mem_ssbo | - nir_var_shared); + nir_var_mem_shared); continue; } @@ -135,7 +135,7 @@ remove_dead_write_vars_local(void *mem_ctx, nir_block *block) case nir_intrinsic_memory_barrier: { clear_unused_for_modes(&unused_writes, nir_var_shader_out | nir_var_mem_ssbo | - nir_var_shared); + nir_var_mem_shared); break; } diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 18a0f8d019a..ab976af1c43 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -419,7 +419,7 @@ get_variable_mode_str(nir_variable_mode mode, bool want_local_global_mode) return "system"; case nir_var_mem_ssbo: return "ssbo"; - case nir_var_shared: + case nir_var_mem_shared: return "shared"; case nir_var_shader_temp: return want_local_global_mode ? "shader_temp" : ""; diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c index 8b28cb28118..cfdd1796299 100644 --- a/src/compiler/nir/nir_remove_dead_variables.c +++ b/src/compiler/nir/nir_remove_dead_variables.c @@ -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_temp | nir_var_shader_temp | nir_var_shared)) || + if (!(deref->mode & (nir_var_function_temp | nir_var_shader_temp | nir_var_mem_shared)) || deref_used_for_not_store(deref)) _mesa_set_add(live, deref->var); } @@ -183,7 +183,7 @@ nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes) if (modes & nir_var_system_value) progress = remove_dead_vars(&shader->system_values, live) || progress; - if (modes & nir_var_shared) + if (modes & nir_var_mem_shared) progress = remove_dead_vars(&shader->shared, live) || progress; if (modes & nir_var_function_temp) { diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index ef5156a70dd..da5e5c05c1c 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -448,7 +448,7 @@ validate_deref_instr(nir_deref_instr *instr, validate_state *state) case nir_deref_type_array_wildcard: if (instr->mode == nir_var_mem_ubo || instr->mode == nir_var_mem_ssbo || - instr->mode == nir_var_shared) { + instr->mode == nir_var_mem_shared) { /* Shared variables and UBO/SSBOs have a bit more relaxed rules * because we need to be able to handle array derefs on vectors. * Fortunately, nir_lower_io handles these just fine. diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index d634adbd877..d0c73f7530e 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1702,7 +1702,7 @@ vtn_storage_class_to_mode(struct vtn_builder *b, break; case SpvStorageClassWorkgroup: mode = vtn_variable_mode_workgroup; - nir_mode = nir_var_shared; + nir_mode = nir_var_mem_shared; break; case SpvStorageClassAtomicCounter: mode = vtn_variable_mode_uniform; @@ -1974,7 +1974,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val, * SPIR-V. */ var->var->type = glsl_get_bare_type(var->type->type); - var->var->data.mode = nir_var_shared; + var->var->data.mode = nir_var_mem_shared; } break;