From c3bf781cb04cb45b30ce56e14a81266c6790b120 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Wed, 25 Nov 2020 16:52:52 -0800 Subject: [PATCH] microsoft/compiler: Remove dead code/variables Reviewed-by: Erik Faye-Lund Part-of: --- src/microsoft/compiler/dxil_module.c | 2 - src/microsoft/compiler/dxil_nir.c | 2 - src/microsoft/compiler/nir_to_dxil.c | 74 +----------------------------------- 3 files changed, 1 insertion(+), 77 deletions(-) diff --git a/src/microsoft/compiler/dxil_module.c b/src/microsoft/compiler/dxil_module.c index f8d3a90..262fea3 100644 --- a/src/microsoft/compiler/dxil_module.c +++ b/src/microsoft/compiler/dxil_module.c @@ -808,7 +808,6 @@ dxil_module_get_res_type(struct dxil_module *m, enum dxil_resource_kind kind, case DXIL_RESOURCE_KIND_TEXTURECUBE: case DXIL_RESOURCE_KIND_TEXTURECUBE_ARRAY: { - const struct dxil_type *int32_type = dxil_module_get_int_type(m, 32); const struct dxil_type *component_type = dxil_module_get_type_from_comp_type(m, comp_type); const struct dxil_type *vec_type = dxil_module_get_vector_type(m, component_type, 4); char class_name[64] = { 0 }; @@ -1261,7 +1260,6 @@ emit_attrib_group(struct dxil_module *m, int id, uint32_t slot, size_t size = 2; for (int i = 0; i < num_attrs; ++i) { - uint64_t kind; switch (attrs[i].type) { case DXIL_ATTR_ENUM: assert(size < ARRAY_SIZE(record) - 2); diff --git a/src/microsoft/compiler/dxil_nir.c b/src/microsoft/compiler/dxil_nir.c index d08fd52..4a35460 100644 --- a/src/microsoft/compiler/dxil_nir.c +++ b/src/microsoft/compiler/dxil_nir.c @@ -79,7 +79,6 @@ load_comps_to_vec32(nir_builder *b, unsigned src_bit_size, nir_ssa_def *vec32comps[4]; for (unsigned i = 0; i < num_vec32comps; i += step) { - nir_ssa_def *tmp; switch (src_bit_size) { case 64: vec32comps[i] = nir_unpack_64_2x32_split_x(b, src_comps[i / 2]); @@ -1234,7 +1233,6 @@ float_to_half_impl(nir_builder *b, nir_ssa_def *src, nir_rounding_mode mode) { nir_ssa_def *f32infinity = nir_imm_int(b, 255 << 23); nir_ssa_def *f16max = nir_imm_int(b, (127 + 16) << 23); - nir_ssa_def *denorm_magic = nir_imm_int(b, ((127 - 15) + (23 - 10) + 1) << 23); nir_ssa_def *sign = nir_iand(b, src, nir_imm_int(b, 0x80000000)); nir_ssa_def *one = nir_imm_int(b, 1); diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index a9f2771..afee5a4 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -366,39 +366,6 @@ emit_sampler_metadata(struct dxil_module *m, const struct dxil_type *struct_type return dxil_get_metadata_node(m, fields, ARRAY_SIZE(fields)); } -static const struct dxil_type * -get_glsl_basetype(struct dxil_module *m, enum glsl_base_type type) -{ - switch (type) { - case GLSL_TYPE_BOOL: - return dxil_module_get_int_type(m, 1); - - case GLSL_TYPE_UINT: - case GLSL_TYPE_INT: - return dxil_module_get_int_type(m, 32); - - default: - debug_printf("type: %s\n", glsl_get_type_name(glsl_scalar_type(type))); - unreachable("unexpected GLSL type"); - } -} - -static const struct dxil_type * -get_glsl_type(struct dxil_module *m, const struct glsl_type *type) -{ - assert(type); - - if (glsl_type_is_scalar(type)) - return get_glsl_basetype(m, glsl_get_base_type(type)); - - if (glsl_type_is_array(type)) - return dxil_module_get_array_type(m, - get_glsl_type(m, glsl_get_array_element(type)), - glsl_get_length(type)); - - unreachable("unexpected glsl type"); -} - #define MAX_SRVS 128 #define MAX_UAVS 64 @@ -954,7 +921,6 @@ var_fill_const_array(struct ntd_context *ctx, const struct nir_constant *c, assert(!glsl_type_is_unsized_array(type)); const struct glsl_type *without = glsl_without_array(type); unsigned stride = glsl_get_explicit_stride(without); - enum glsl_base_type without_base = glsl_get_base_type(without); for (unsigned elt = 0; elt < glsl_get_length(type); elt++) { if (!var_fill_const_array(ctx, c->elements[elt], without, @@ -985,7 +951,6 @@ static bool emit_global_consts(struct ntd_context *ctx, nir_shader *s) { nir_foreach_variable_with_modes(var, s, nir_var_shader_temp) { - struct dxil_value *ret; bool err; assert(var->constant_initializer); @@ -1065,8 +1030,6 @@ emit_cbv(struct ntd_context *ctx, unsigned binding, static bool emit_ubo_var(struct ntd_context *ctx, nir_variable *var) { - unsigned size = get_dword_size(var->type); - unsigned binding = var->data.binding; return emit_cbv(ctx, var->data.binding, get_dword_size(var->type), var->name); } @@ -1454,15 +1417,6 @@ get_src(struct ntd_context *ctx, nir_src *src, unsigned chan, } } -static const struct dxil_value * -get_src_ptr(struct ntd_context *ctx, nir_src *src, unsigned chan, - nir_alu_type type) -{ - /* May implement pointer casting */ - assert(src->is_ssa); - return get_src_ssa(ctx, src->ssa, chan); -} - static const struct dxil_type * get_alu_src_type(struct ntd_context *ctx, nir_alu_instr *alu, unsigned src) { @@ -2209,32 +2163,6 @@ get_int32_undef(struct dxil_module *m) } static const struct dxil_value * -offset_to_index(struct dxil_module *m, const struct dxil_value *offset, - unsigned bit_size) -{ - unsigned shift_amt = util_logbase2(bit_size / 8); - const struct dxil_value *shift = - dxil_module_get_int32_const(m, shift_amt); - if (!shift) - return NULL; - - return dxil_emit_binop(m, DXIL_BINOP_LSHR, offset, shift, 0); -} - -static const struct dxil_value * -index_to_offset(struct dxil_module *m, const struct dxil_value *index, - unsigned bit_size) -{ - unsigned shift_amt = util_logbase2(bit_size / 8); - const struct dxil_value *shift = - dxil_module_get_int32_const(m, shift_amt); - if (!shift) - return NULL; - - return dxil_emit_binop(m, DXIL_BINOP_SHL, index, shift, 0); -} - -static const struct dxil_value * emit_gep_for_index(struct ntd_context *ctx, const nir_variable *var, const struct dxil_value *index) { @@ -2733,7 +2661,7 @@ emit_load_shared(struct ntd_context *ctx, nir_intrinsic_instr *intr) static bool emit_load_scratch(struct ntd_context *ctx, nir_intrinsic_instr *intr) { - const struct dxil_value *zero, *one, *index; + const struct dxil_value *zero, *index; unsigned bit_size = nir_dest_bit_size(intr->dest); unsigned align = bit_size / 8; -- 2.7.4