glsl: remove unused code

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32779>
This commit is contained in:
Marek Olšák
2024-12-25 03:51:28 -05:00
committed by Marge Bot
parent 49897f99d6
commit 451d252ca2
7 changed files with 2 additions and 243 deletions

View File

@@ -232,13 +232,6 @@ const glsl_type *glsl_symbol_table::get_type(const char *name)
return entry != NULL ? entry->t : NULL;
}
const glsl_type *glsl_symbol_table::get_interface(const char *name,
enum ir_variable_mode mode)
{
symbol_table_entry *entry = get_entry(name);
return entry != NULL ? entry->get_interface(mode) : NULL;
}
ir_function *glsl_symbol_table::get_function(const char *name)
{
symbol_table_entry *entry = get_entry(name);
@@ -274,13 +267,3 @@ glsl_symbol_table::disable_variable(const char *name)
entry->v = NULL;
}
}
void
glsl_symbol_table::replace_variable(const char *name,
ir_variable *v)
{
symbol_table_entry *entry = get_entry(name);
if (entry != NULL) {
entry->v = v;
}
}

View File

@@ -82,8 +82,6 @@ struct glsl_symbol_table {
ir_variable *get_variable(const char *name);
const glsl_type *get_type(const char *name);
ir_function *get_function(const char *name);
const glsl_type *get_interface(const char *name,
enum ir_variable_mode mode);
int get_default_precision_qualifier(const char *type_name);
/*@}*/
@@ -95,11 +93,6 @@ struct glsl_symbol_table {
*/
void disable_variable(const char *name);
/**
* Replaces the variable in the entry by the new variable.
*/
void replace_variable(const char *name, ir_variable *v);
private:
symbol_table_entry *get_entry(const char *name);

View File

@@ -44,11 +44,6 @@ bool ir_rvalue::is_one() const
return false;
}
bool ir_rvalue::is_negative_one() const
{
return false;
}
/**
* Modify the swizzle make to move one component to another
*
@@ -659,16 +654,6 @@ depth_layout_string(ir_depth_layout layout)
}
}
ir_expression_operation
ir_expression::get_operator(const char *str)
{
for (int op = 0; op <= int(ir_last_opcode); op++) {
if (strcmp(str, ir_expression_operation_strings[op]) == 0)
return (ir_expression_operation) op;
}
return (ir_expression_operation) -1;
}
ir_variable *
ir_expression::variable_referenced() const
{
@@ -1633,21 +1618,6 @@ ir_constant::is_one() const
return is_value(1.0, 1);
}
bool
ir_constant::is_negative_one() const
{
return is_value(-1.0, -1);
}
bool
ir_constant::is_uint16_constant() const
{
if (!glsl_type_is_integer_32(type))
return false;
return value.u[0] < (1 << 16);
}
ir_loop::ir_loop()
: ir_instruction(ir_type_loop)
{
@@ -1771,18 +1741,6 @@ const char *ir_texture::opcode_string()
return tex_opcode_strs[op];
}
ir_texture_opcode
ir_texture::get_opcode(const char *str)
{
const int count = sizeof(tex_opcode_strs) / sizeof(tex_opcode_strs[0]);
for (int op = 0; op < count; op++) {
if (strcmp(str, tex_opcode_strs[op]) == 0)
return (ir_texture_opcode) op;
}
return (ir_texture_opcode) -1;
}
void
ir_texture::set_sampler(ir_dereference *sampler, const glsl_type *type)
{
@@ -2095,13 +2053,6 @@ ir_variable::enable_extension_warning(const char *extension)
this->data.warn_extension_index = 0;
}
const char *
ir_variable::get_extension_warning() const
{
return this->data.warn_extension_index == 0
? NULL : warn_extension_table[this->data.warn_extension_index];
}
ir_function_signature::ir_function_signature(const glsl_type *return_type,
builtin_available_predicate b)
: ir_instruction(ir_type_function_signature),

View File

@@ -270,7 +270,7 @@ public:
* for vector and scalar types that have all elements set to the value
* zero (or \c false for booleans).
*
* \sa ir_constant::has_value, ir_rvalue::is_one, ir_rvalue::is_negative_one
* \sa ir_constant::has_value, ir_rvalue::is_one
*/
virtual bool is_zero() const;
@@ -282,30 +282,10 @@ public:
* for vector and scalar types that have all elements set to the value
* one (or \c true for booleans).
*
* \sa ir_constant::has_value, ir_rvalue::is_zero, ir_rvalue::is_negative_one
* \sa ir_constant::has_value, ir_rvalue::is_zero
*/
virtual bool is_one() const;
/**
* Determine if an r-value has the value negative one
*
* The base implementation of this function always returns \c false. The
* \c ir_constant class over-rides this function to return \c true \b only
* for vector and scalar types that have all elements set to the value
* negative one. For boolean types, the result is always \c false.
*
* \sa ir_constant::has_value, ir_rvalue::is_zero, ir_rvalue::is_one
*/
virtual bool is_negative_one() const;
/**
* Determine if an r-value is an unsigned integer constant which can be
* stored in 16 bits.
*
* \sa ir_constant::is_uint16_constant.
*/
virtual bool is_uint16_constant() const { return false; }
/**
* Return a generic value of error_type.
*
@@ -610,13 +590,6 @@ public:
*/
void enable_extension_warning(const char *extension);
/**
* Get the extension warning string for this variable
*
* If warnings are not enabled, \c NULL is returned.
*/
const char *get_extension_warning() const;
/**
* Declared type of the variable
*/
@@ -1601,11 +1574,6 @@ public:
operation == ir_quadop_vector;
}
/**
* Do a reverse-lookup to translate the given string into an operator.
*/
static ir_expression_operation get_operator(const char *);
virtual void accept(ir_visitor *v)
{
v->visit(this);
@@ -1925,11 +1893,6 @@ public:
/** Set the sampler and type. */
void set_sampler(ir_dereference *sampler, const glsl_type *type);
/**
* Do a reverse-lookup to translate a string into an ir_texture_opcode.
*/
static ir_texture_opcode get_opcode(const char *);
enum ir_texture_opcode op;
/** Sampler to use for the texture access. */
@@ -2332,15 +2295,6 @@ public:
virtual bool is_value(float f, int i) const;
virtual bool is_zero() const;
virtual bool is_one() const;
virtual bool is_negative_one() const;
/**
* Return true for constants that could be stored as 16-bit unsigned values.
*
* Note that this will return true even for signed integer ir_constants, as
* long as the value is non-negative and fits in 16-bits.
*/
virtual bool is_uint16_constant() const;
/**
* Value of the constant.

View File

@@ -98,30 +98,6 @@ swizzle_for_size(operand a, unsigned components)
return new(mem_ctx) ir_swizzle(a.val, s, components);
}
ir_swizzle *
swizzle_xxxx(operand a)
{
return swizzle(a, SWIZZLE_XXXX, 4);
}
ir_swizzle *
swizzle_yyyy(operand a)
{
return swizzle(a, SWIZZLE_YYYY, 4);
}
ir_swizzle *
swizzle_zzzz(operand a)
{
return swizzle(a, SWIZZLE_ZZZZ, 4);
}
ir_swizzle *
swizzle_wwww(operand a)
{
return swizzle(a, SWIZZLE_WWWW, 4);
}
ir_swizzle *
swizzle_x(operand a)
{
@@ -146,24 +122,6 @@ swizzle_w(operand a)
return swizzle(a, SWIZZLE_WWWW, 1);
}
ir_swizzle *
swizzle_xy(operand a)
{
return swizzle(a, SWIZZLE_XYZW, 2);
}
ir_swizzle *
swizzle_xyz(operand a)
{
return swizzle(a, SWIZZLE_XYZW, 3);
}
ir_swizzle *
swizzle_xyzw(operand a)
{
return swizzle(a, SWIZZLE_XYZW, 4);
}
ir_expression *
expr(ir_expression_operation op, operand a)
{
@@ -213,11 +171,6 @@ ir_expression *mul(operand a, operand b)
return expr(ir_binop_mul, a, b);
}
ir_expression *imul_high(operand a, operand b)
{
return expr(ir_binop_imul_high, a, b);
}
ir_expression *div(operand a, operand b)
{
return expr(ir_binop_div, a, b);
@@ -243,11 +196,6 @@ ir_expression *round_even(operand a)
return expr(ir_unop_round_even, a);
}
ir_expression *fract(operand a)
{
return expr(ir_unop_fract, a);
}
/* dot for vectors, mul for scalars */
ir_expression *dot(operand a, operand b)
{
@@ -301,12 +249,6 @@ exp(operand a)
return expr(ir_unop_exp, a);
}
ir_expression *
rcp(operand a)
{
return expr(ir_unop_rcp, a);
}
ir_expression *
rsq(operand a)
{
@@ -361,12 +303,6 @@ greater(operand a, operand b)
return expr(ir_binop_less, b, a);
}
ir_expression*
lequal(operand a, operand b)
{
return expr(ir_binop_gequal, b, a);
}
ir_expression*
gequal(operand a, operand b)
{
@@ -409,12 +345,6 @@ bit_or(operand a, operand b)
return expr(ir_binop_bit_or, a, b);
}
ir_expression*
bit_xor(operand a, operand b)
{
return expr(ir_binop_bit_xor, a, b);
}
ir_expression*
lshift(operand a, operand b)
{
@@ -487,24 +417,12 @@ bitcast_u2f(operand a)
return expr(ir_unop_bitcast_u2f, a);
}
ir_expression*
i2b(operand a)
{
return expr(ir_unop_i2b, a);
}
ir_expression*
b2i(operand a)
{
return expr(ir_unop_b2i, a);
}
ir_expression *
f2b(operand a)
{
return expr(ir_unop_f2b, a);
}
ir_expression *
b2f(operand a)
{
@@ -565,18 +483,6 @@ f2d(operand a)
return expr(ir_unop_f2d, a);
}
ir_expression *
i2d(operand a)
{
return expr(ir_unop_i2d, a);
}
ir_expression *
u2d(operand a)
{
return expr(ir_unop_u2d, a);
}
ir_expression *
fma(operand a, operand b, operand c)
{

View File

@@ -125,13 +125,11 @@ ir_expression *expr(ir_expression_operation op, operand a, operand b, operand c)
ir_expression *add(operand a, operand b);
ir_expression *sub(operand a, operand b);
ir_expression *mul(operand a, operand b);
ir_expression *imul_high(operand a, operand b);
ir_expression *div(operand a, operand b);
ir_expression *carry(operand a, operand b);
ir_expression *borrow(operand a, operand b);
ir_expression *trunc(operand a);
ir_expression *round_even(operand a);
ir_expression *fract(operand a);
ir_expression *dot(operand a, operand b);
ir_expression *clamp(operand a, operand b, operand c);
ir_expression *saturate(operand a);
@@ -140,7 +138,6 @@ ir_expression *neg(operand a);
ir_expression *sin(operand a);
ir_expression *cos(operand a);
ir_expression *exp(operand a);
ir_expression *rcp(operand a);
ir_expression *rsq(operand a);
ir_expression *sqrt(operand a);
ir_expression *log(operand a);
@@ -151,7 +148,6 @@ ir_expression *equal(operand a, operand b);
ir_expression *nequal(operand a, operand b);
ir_expression *less(operand a, operand b);
ir_expression *greater(operand a, operand b);
ir_expression *lequal(operand a, operand b);
ir_expression *gequal(operand a, operand b);
ir_expression *logic_not(operand a);
@@ -161,7 +157,6 @@ ir_expression *logic_or(operand a, operand b);
ir_expression *bit_not(operand a);
ir_expression *bit_or(operand a, operand b);
ir_expression *bit_and(operand a, operand b);
ir_expression *bit_xor(operand a, operand b);
ir_expression *lshift(operand a, operand b);
ir_expression *rshift(operand a, operand b);
@@ -176,15 +171,11 @@ ir_expression *bitcast_u2f(operand a);
ir_expression *i2u(operand a);
ir_expression *u2i(operand a);
ir_expression *b2i(operand a);
ir_expression *i2b(operand a);
ir_expression *f2b(operand a);
ir_expression *b2f(operand a);
ir_expression *f2f16(operand a);
ir_expression *f2d(operand a);
ir_expression *i2d(operand a);
ir_expression *u2d(operand a);
ir_expression *bitcast_d2i64(operand a);
ir_expression *bitcast_d2u64(operand a);
@@ -211,17 +202,10 @@ ir_swizzle *swizzle(operand a, int swizzle, int components);
*/
ir_swizzle *swizzle_for_size(operand a, unsigned components);
ir_swizzle *swizzle_xxxx(operand a);
ir_swizzle *swizzle_yyyy(operand a);
ir_swizzle *swizzle_zzzz(operand a);
ir_swizzle *swizzle_wwww(operand a);
ir_swizzle *swizzle_x(operand a);
ir_swizzle *swizzle_y(operand a);
ir_swizzle *swizzle_z(operand a);
ir_swizzle *swizzle_w(operand a);
ir_swizzle *swizzle_xy(operand a);
ir_swizzle *swizzle_xyz(operand a);
ir_swizzle *swizzle_xyzw(operand a);
ir_if *if_tree(operand condition,
ir_instruction *then_branch);

View File

@@ -535,12 +535,6 @@ glsl_type_is_struct_or_ifc(const glsl_type *t)
return glsl_type_is_struct(t) || glsl_type_is_interface(t);
}
static inline bool
glsl_type_is_packed(const glsl_type *t)
{
return t->packed;
}
static inline bool
glsl_type_is_16bit(const glsl_type *t)
{
@@ -615,12 +609,6 @@ glsl_type_is_float_16_32_64(const glsl_type *t)
return t->base_type == GLSL_TYPE_FLOAT16 || glsl_type_is_float(t) || glsl_type_is_double(t);
}
static inline bool
glsl_type_is_float_32_64(const glsl_type *t)
{
return glsl_type_is_float(t) || glsl_type_is_double(t);
}
static inline bool
glsl_type_is_int_16_32_64(const glsl_type *t)
{