diff --git a/src/compiler/nir/nir_search.h b/src/compiler/nir/nir_search.h index 30e8b6ac7f8..aca3f46da18 100644 --- a/src/compiler/nir/nir_search.h +++ b/src/compiler/nir/nir_search.h @@ -95,8 +95,8 @@ typedef struct { * variables to require, for example, power-of-two in order for the search * to match. */ - bool (*cond)(struct hash_table *range_ht, nir_alu_instr *instr, unsigned src, - unsigned num_components, const uint8_t *swizzle); + bool (*cond)(struct hash_table *range_ht, const nir_alu_instr *instr, + unsigned src, unsigned num_components, const uint8_t *swizzle); /** Swizzle (for replace only) */ uint8_t swizzle[NIR_MAX_VEC_COMPONENTS]; diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h index 5d5fe90ea57..9488c7eaf9d 100644 --- a/src/compiler/nir/nir_search_helpers.h +++ b/src/compiler/nir/nir_search_helpers.h @@ -33,7 +33,7 @@ #include static inline bool -is_pos_power_of_two(UNUSED struct hash_table *ht, nir_alu_instr *instr, +is_pos_power_of_two(UNUSED struct hash_table *ht, const nir_alu_instr *instr, unsigned src, unsigned num_components, const uint8_t *swizzle) { @@ -65,7 +65,7 @@ is_pos_power_of_two(UNUSED struct hash_table *ht, nir_alu_instr *instr, } static inline bool -is_neg_power_of_two(UNUSED struct hash_table *ht, nir_alu_instr *instr, +is_neg_power_of_two(UNUSED struct hash_table *ht, const nir_alu_instr *instr, unsigned src, unsigned num_components, const uint8_t *swizzle) { @@ -92,7 +92,8 @@ is_neg_power_of_two(UNUSED struct hash_table *ht, nir_alu_instr *instr, #define MULTIPLE(test) \ static inline bool \ -is_unsigned_multiple_of_ ## test(UNUSED struct hash_table *ht, nir_alu_instr *instr, \ +is_unsigned_multiple_of_ ## test(UNUSED struct hash_table *ht, \ + const nir_alu_instr *instr, \ unsigned src, unsigned num_components, \ const uint8_t *swizzle) \ { \ @@ -117,8 +118,8 @@ MULTIPLE(32) MULTIPLE(64) static inline bool -is_zero_to_one(UNUSED struct hash_table *ht, nir_alu_instr *instr, unsigned src, - unsigned num_components, +is_zero_to_one(UNUSED struct hash_table *ht, const nir_alu_instr *instr, + unsigned src, unsigned num_components, const uint8_t *swizzle) { /* only constant srcs: */ @@ -148,7 +149,7 @@ is_zero_to_one(UNUSED struct hash_table *ht, nir_alu_instr *instr, unsigned src, * 1 while this function tests 0 < src < 1. */ static inline bool -is_gt_0_and_lt_1(UNUSED struct hash_table *ht, nir_alu_instr *instr, +is_gt_0_and_lt_1(UNUSED struct hash_table *ht, const nir_alu_instr *instr, unsigned src, unsigned num_components, const uint8_t *swizzle) { @@ -173,7 +174,7 @@ is_gt_0_and_lt_1(UNUSED struct hash_table *ht, nir_alu_instr *instr, } static inline bool -is_not_const_zero(UNUSED struct hash_table *ht, nir_alu_instr *instr, +is_not_const_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr, unsigned src, unsigned num_components, const uint8_t *swizzle) { @@ -202,15 +203,15 @@ is_not_const_zero(UNUSED struct hash_table *ht, nir_alu_instr *instr, } static inline bool -is_not_const(UNUSED struct hash_table *ht, nir_alu_instr *instr, unsigned src, - UNUSED unsigned num_components, +is_not_const(UNUSED struct hash_table *ht, const nir_alu_instr *instr, + unsigned src, UNUSED unsigned num_components, UNUSED const uint8_t *swizzle) { return !nir_src_is_const(instr->src[src].src); } static inline bool -is_not_fmul(struct hash_table *ht, nir_alu_instr *instr, unsigned src, +is_not_fmul(struct hash_table *ht, const nir_alu_instr *instr, unsigned src, UNUSED unsigned num_components, UNUSED const uint8_t *swizzle) { nir_alu_instr *src_alu = @@ -226,7 +227,7 @@ is_not_fmul(struct hash_table *ht, nir_alu_instr *instr, unsigned src, } static inline bool -is_fmul(struct hash_table *ht, nir_alu_instr *instr, unsigned src, +is_fmul(struct hash_table *ht, const nir_alu_instr *instr, unsigned src, UNUSED unsigned num_components, UNUSED const uint8_t *swizzle) { nir_alu_instr *src_alu = @@ -242,7 +243,7 @@ is_fmul(struct hash_table *ht, nir_alu_instr *instr, unsigned src, } static inline bool -is_fsign(nir_alu_instr *instr, unsigned src, +is_fsign(const nir_alu_instr *instr, unsigned src, UNUSED unsigned num_components, UNUSED const uint8_t *swizzle) { nir_alu_instr *src_alu = @@ -258,8 +259,9 @@ is_fsign(nir_alu_instr *instr, unsigned src, } static inline bool -is_not_const_and_not_fsign(struct hash_table *ht, nir_alu_instr *instr, unsigned src, - unsigned num_components, const uint8_t *swizzle) +is_not_const_and_not_fsign(struct hash_table *ht, const nir_alu_instr *instr, + unsigned src, unsigned num_components, + const uint8_t *swizzle) { return is_not_const(ht, instr, src, num_components, swizzle) && !is_fsign(instr, src, num_components, swizzle); @@ -355,9 +357,9 @@ only_lower_16_bits_used(nir_alu_instr *instr) * of all its components is zero. */ static inline bool -is_upper_half_zero(UNUSED struct hash_table *ht, - nir_alu_instr *instr, unsigned src, - unsigned num_components, const uint8_t *swizzle) +is_upper_half_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr, + unsigned src, unsigned num_components, + const uint8_t *swizzle) { if (nir_src_as_const_value(instr->src[src].src) == NULL) return false; @@ -380,9 +382,9 @@ is_upper_half_zero(UNUSED struct hash_table *ht, * of all its components is zero. */ static inline bool -is_lower_half_zero(UNUSED struct hash_table *ht, - nir_alu_instr *instr, unsigned src, - unsigned num_components, const uint8_t *swizzle) +is_lower_half_zero(UNUSED struct hash_table *ht, const nir_alu_instr *instr, + unsigned src, unsigned num_components, + const uint8_t *swizzle) { if (nir_src_as_const_value(instr->src[src].src) == NULL) return false; @@ -410,7 +412,7 @@ no_unsigned_wrap(nir_alu_instr *instr) } static inline bool -is_integral(struct hash_table *ht, nir_alu_instr *instr, unsigned src, +is_integral(struct hash_table *ht, const nir_alu_instr *instr, unsigned src, UNUSED unsigned num_components, UNUSED const uint8_t *swizzle) { const struct ssa_result_range r = nir_analyze_range(ht, instr, src); @@ -425,7 +427,7 @@ is_integral(struct hash_table *ht, nir_alu_instr *instr, unsigned src, * constant that is finite. */ static inline bool -is_finite(UNUSED struct hash_table *ht, nir_alu_instr *instr, unsigned src, +is_finite(UNUSED struct hash_table *ht, const nir_alu_instr *instr, unsigned src, unsigned num_components, const uint8_t *swizzle) { if (nir_src_as_const_value(instr->src[src].src) == NULL) @@ -454,8 +456,9 @@ is_finite(UNUSED struct hash_table *ht, nir_alu_instr *instr, unsigned src, #define RELATION(r) \ static inline bool \ -is_ ## r (struct hash_table *ht, nir_alu_instr *instr, unsigned src, \ - UNUSED unsigned num_components, UNUSED const uint8_t *swizzle) \ +is_ ## r (struct hash_table *ht, const nir_alu_instr *instr, \ + unsigned src, UNUSED unsigned num_components, \ + UNUSED const uint8_t *swizzle) \ { \ const struct ssa_result_range v = nir_analyze_range(ht, instr, src); \ return v.range == r; \ @@ -468,7 +471,7 @@ RELATION(ge_zero) RELATION(ne_zero) static inline bool -is_not_negative(struct hash_table *ht, nir_alu_instr *instr, unsigned src, +is_not_negative(struct hash_table *ht, const nir_alu_instr *instr, unsigned src, UNUSED unsigned num_components, UNUSED const uint8_t *swizzle) { const struct ssa_result_range v = nir_analyze_range(ht, instr, src); @@ -476,7 +479,7 @@ is_not_negative(struct hash_table *ht, nir_alu_instr *instr, unsigned src, } static inline bool -is_not_positive(struct hash_table *ht, nir_alu_instr *instr, unsigned src, +is_not_positive(struct hash_table *ht, const nir_alu_instr *instr, unsigned src, UNUSED unsigned num_components, UNUSED const uint8_t *swizzle) { const struct ssa_result_range v = nir_analyze_range(ht, instr, src); @@ -484,7 +487,7 @@ is_not_positive(struct hash_table *ht, nir_alu_instr *instr, unsigned src, } static inline bool -is_not_zero(struct hash_table *ht, nir_alu_instr *instr, unsigned src, +is_not_zero(struct hash_table *ht, const nir_alu_instr *instr, unsigned src, UNUSED unsigned num_components, UNUSED const uint8_t *swizzle) { const struct ssa_result_range v = nir_analyze_range(ht, instr, src);