treewide: Drop some is_ssa if's
Via Coccinelle patch: @@ expression x; @@ -if (!x.is_ssa) { -... -} and likewise with x->is_ssa, with invalid hunks manually filtered out. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432>
This commit is contained in:

committed by
Marge Bot

parent
ba5aaf2ff7
commit
579bc1e72e
@@ -1077,11 +1077,6 @@ add_reg_def_cb(nir_dest *dest, void *state)
|
|||||||
{
|
{
|
||||||
nir_instr *instr = state;
|
nir_instr *instr = state;
|
||||||
|
|
||||||
if (!dest->is_ssa) {
|
|
||||||
dest->reg.parent_instr = instr;
|
|
||||||
list_addtail(&dest->reg.def_link, &dest->reg.reg->defs);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1182,9 +1177,6 @@ remove_def_cb(nir_dest *dest, void *state)
|
|||||||
{
|
{
|
||||||
(void) state;
|
(void) state;
|
||||||
|
|
||||||
if (!dest->is_ssa)
|
|
||||||
list_del(&dest->reg.def_link);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1531,9 +1523,6 @@ nir_src_as_const_value(nir_src src)
|
|||||||
bool
|
bool
|
||||||
nir_src_is_always_uniform(nir_src src)
|
nir_src_is_always_uniform(nir_src src)
|
||||||
{
|
{
|
||||||
if (!src.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Constants are trivially uniform */
|
/* Constants are trivially uniform */
|
||||||
if (src.ssa->parent_instr->type == nir_instr_type_load_const)
|
if (src.ssa->parent_instr->type == nir_instr_type_load_const)
|
||||||
return true;
|
return true;
|
||||||
|
@@ -575,9 +575,6 @@ nir_rewrite_uses_to_load_reg(nir_builder *b, nir_ssa_def *old,
|
|||||||
static bool
|
static bool
|
||||||
dest_replace_ssa_with_reg(nir_dest *dest, nir_function_impl *impl)
|
dest_replace_ssa_with_reg(nir_dest *dest, nir_function_impl *impl)
|
||||||
{
|
{
|
||||||
if (!dest->is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nir_builder b = nir_builder_create(impl);
|
nir_builder b = nir_builder_create(impl);
|
||||||
|
|
||||||
nir_ssa_def *reg = decl_reg_for_ssa_def(&b, &dest->ssa);
|
nir_ssa_def *reg = decl_reg_for_ssa_def(&b, &dest->ssa);
|
||||||
|
@@ -72,9 +72,6 @@ nir_collect_src_uniforms(const nir_src *src, int component,
|
|||||||
uint32_t *uni_offsets, uint8_t *num_offsets,
|
uint32_t *uni_offsets, uint8_t *num_offsets,
|
||||||
unsigned max_num_bo, unsigned max_offset)
|
unsigned max_num_bo, unsigned max_offset)
|
||||||
{
|
{
|
||||||
if (!src->is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
assert(max_num_bo > 0 && max_num_bo <= MAX_NUM_BO);
|
assert(max_num_bo > 0 && max_num_bo <= MAX_NUM_BO);
|
||||||
assert(component < src->ssa->num_components);
|
assert(component < src->ssa->num_components);
|
||||||
|
|
||||||
@@ -177,9 +174,6 @@ is_induction_variable(const nir_src *src, int component, nir_loop_info *info,
|
|||||||
uint32_t *uni_offsets, uint8_t *num_offsets,
|
uint32_t *uni_offsets, uint8_t *num_offsets,
|
||||||
unsigned max_num_bo, unsigned max_offset)
|
unsigned max_num_bo, unsigned max_offset)
|
||||||
{
|
{
|
||||||
if (!src->is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
assert(component < src->ssa->num_components);
|
assert(component < src->ssa->num_components);
|
||||||
|
|
||||||
/* Return true for induction variable (ie. i in for loop) */
|
/* Return true for induction variable (ie. i in for loop) */
|
||||||
|
@@ -71,9 +71,6 @@ set_src_live(nir_src *src, void *void_live)
|
|||||||
{
|
{
|
||||||
BITSET_WORD *live = void_live;
|
BITSET_WORD *live = void_live;
|
||||||
|
|
||||||
if (!src->is_ssa)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (nir_src_is_undef(*src))
|
if (nir_src_is_undef(*src))
|
||||||
return true; /* undefined variables are never live */
|
return true; /* undefined variables are never live */
|
||||||
|
|
||||||
|
@@ -366,9 +366,6 @@ alu_src_has_identity_swizzle(nir_alu_instr *alu, unsigned src_idx)
|
|||||||
static bool
|
static bool
|
||||||
is_only_uniform_src(nir_src *src)
|
is_only_uniform_src(nir_src *src)
|
||||||
{
|
{
|
||||||
if (!src->is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nir_instr *instr = src->ssa->parent_instr;
|
nir_instr *instr = src->ssa->parent_instr;
|
||||||
|
|
||||||
switch (instr->type) {
|
switch (instr->type) {
|
||||||
@@ -760,9 +757,6 @@ try_eval_const_alu(nir_const_value *dest, nir_alu_instr *alu,
|
|||||||
{
|
{
|
||||||
nir_const_value src[NIR_MAX_VEC_COMPONENTS][NIR_MAX_VEC_COMPONENTS];
|
nir_const_value src[NIR_MAX_VEC_COMPONENTS][NIR_MAX_VEC_COMPONENTS];
|
||||||
|
|
||||||
if (!alu->dest.dest.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* In the case that any outputs/inputs have unsized types, then we need to
|
/* In the case that any outputs/inputs have unsized types, then we need to
|
||||||
* guess the bit-size. In this case, the validator ensures that all
|
* guess the bit-size. In this case, the validator ensures that all
|
||||||
* bit-sizes match so we can just take the bit-size from first
|
* bit-sizes match so we can just take the bit-size from first
|
||||||
@@ -777,9 +771,6 @@ try_eval_const_alu(nir_const_value *dest, nir_alu_instr *alu,
|
|||||||
bit_size = alu->dest.dest.ssa.bit_size;
|
bit_size = alu->dest.dest.ssa.bit_size;
|
||||||
|
|
||||||
for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
|
for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
|
||||||
if (!alu->src[i].src.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (bit_size == 0 &&
|
if (bit_size == 0 &&
|
||||||
!nir_alu_type_get_type_size(nir_op_infos[alu->op].input_types[i]))
|
!nir_alu_type_get_type_size(nir_op_infos[alu->op].input_types[i]))
|
||||||
bit_size = alu->src[i].src.ssa->bit_size;
|
bit_size = alu->src[i].src.ssa->bit_size;
|
||||||
|
@@ -49,9 +49,6 @@ static bool
|
|||||||
is_phi_src_scalarizable(nir_phi_src *src,
|
is_phi_src_scalarizable(nir_phi_src *src,
|
||||||
struct lower_phis_to_scalar_state *state)
|
struct lower_phis_to_scalar_state *state)
|
||||||
{
|
{
|
||||||
/* Don't know what to do with non-ssa sources */
|
|
||||||
if (!src->src.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nir_instr *src_instr = src->src.ssa->parent_instr;
|
nir_instr *src_instr = src->src.ssa->parent_instr;
|
||||||
switch (src_instr->type) {
|
switch (src_instr->type) {
|
||||||
|
@@ -77,18 +77,11 @@ move_vec_src_uses_to_dest_block(nir_block *block)
|
|||||||
continue; /* The loop */
|
continue; /* The loop */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Can't handle non-SSA vec operations */
|
|
||||||
if (!vec->dest.dest.is_ssa)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* First, mark all of the sources we are going to consider for rewriting
|
/* First, mark all of the sources we are going to consider for rewriting
|
||||||
* to the destination
|
* to the destination
|
||||||
*/
|
*/
|
||||||
int srcs_remaining = 0;
|
int srcs_remaining = 0;
|
||||||
for (unsigned i = 0; i < nir_op_infos[vec->op].num_inputs; i++) {
|
for (unsigned i = 0; i < nir_op_infos[vec->op].num_inputs; i++) {
|
||||||
/* We can't rewrite a source if it's not in SSA form */
|
|
||||||
if (!vec->src[i].src.is_ssa)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
srcs_remaining |= 1 << i;
|
srcs_remaining |= 1 << i;
|
||||||
}
|
}
|
||||||
|
@@ -41,9 +41,6 @@ try_fold_alu(nir_builder *b, nir_alu_instr *alu)
|
|||||||
{
|
{
|
||||||
nir_const_value src[NIR_MAX_VEC_COMPONENTS][NIR_MAX_VEC_COMPONENTS];
|
nir_const_value src[NIR_MAX_VEC_COMPONENTS][NIR_MAX_VEC_COMPONENTS];
|
||||||
|
|
||||||
if (!alu->dest.dest.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* In the case that any outputs/inputs have unsized types, then we need to
|
/* In the case that any outputs/inputs have unsized types, then we need to
|
||||||
* guess the bit-size. In this case, the validator ensures that all
|
* guess the bit-size. In this case, the validator ensures that all
|
||||||
* bit-sizes match so we can just take the bit-size from first
|
* bit-sizes match so we can just take the bit-size from first
|
||||||
@@ -58,9 +55,6 @@ try_fold_alu(nir_builder *b, nir_alu_instr *alu)
|
|||||||
bit_size = alu->dest.dest.ssa.bit_size;
|
bit_size = alu->dest.dest.ssa.bit_size;
|
||||||
|
|
||||||
for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
|
for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
|
||||||
if (!alu->src[i].src.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (bit_size == 0 &&
|
if (bit_size == 0 &&
|
||||||
!nir_alu_type_get_type_size(nir_op_infos[alu->op].input_types[i]))
|
!nir_alu_type_get_type_size(nir_op_infos[alu->op].input_types[i]))
|
||||||
bit_size = alu->src[i].src.ssa->bit_size;
|
bit_size = alu->src[i].src.ssa->bit_size;
|
||||||
|
@@ -93,8 +93,6 @@ static void
|
|||||||
value_set_ssa_components(struct value *value, nir_ssa_def *def,
|
value_set_ssa_components(struct value *value, nir_ssa_def *def,
|
||||||
unsigned num_components)
|
unsigned num_components)
|
||||||
{
|
{
|
||||||
if (!value->is_ssa)
|
|
||||||
memset(&value->ssa, 0, sizeof(value->ssa));
|
|
||||||
value->is_ssa = true;
|
value->is_ssa = true;
|
||||||
for (unsigned i = 0; i < num_components; i++) {
|
for (unsigned i = 0; i < num_components; i++) {
|
||||||
value->ssa.def[i] = def;
|
value->ssa.def[i] = def;
|
||||||
@@ -484,16 +482,6 @@ lookup_entry_and_kill_aliases_copy_array(struct copy_prop_var_state *state,
|
|||||||
bool *entry_removed)
|
bool *entry_removed)
|
||||||
{
|
{
|
||||||
util_dynarray_foreach_reverse(copies_array, struct copy_entry, iter) {
|
util_dynarray_foreach_reverse(copies_array, struct copy_entry, iter) {
|
||||||
if (!iter->src.is_ssa) {
|
|
||||||
/* If this write aliases the source of some entry, get rid of it */
|
|
||||||
nir_deref_compare_result result =
|
|
||||||
nir_compare_derefs_and_paths(state->mem_ctx, &iter->src.deref, deref);
|
|
||||||
if (result & nir_derefs_may_alias_bit) {
|
|
||||||
copy_entry_remove(copies_array, iter, entry);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nir_deref_compare_result comp =
|
nir_deref_compare_result comp =
|
||||||
nir_compare_derefs_and_paths(state->mem_ctx, &iter->dst, deref);
|
nir_compare_derefs_and_paths(state->mem_ctx, &iter->dst, deref);
|
||||||
|
|
||||||
@@ -634,8 +622,6 @@ value_set_from_value(struct value *value, const struct value *from,
|
|||||||
|
|
||||||
if (from->is_ssa) {
|
if (from->is_ssa) {
|
||||||
/* Clear value if it was being used as non-SSA. */
|
/* Clear value if it was being used as non-SSA. */
|
||||||
if (!value->is_ssa)
|
|
||||||
memset(&value->ssa, 0, sizeof(value->ssa));
|
|
||||||
value->is_ssa = true;
|
value->is_ssa = true;
|
||||||
/* Only overwrite the written components */
|
/* Only overwrite the written components */
|
||||||
for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) {
|
for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) {
|
||||||
@@ -948,12 +934,6 @@ invalidate_copies_for_cf_node(struct copy_prop_var_state *state,
|
|||||||
static void
|
static void
|
||||||
print_value(struct value *value, unsigned num_components)
|
print_value(struct value *value, unsigned num_components)
|
||||||
{
|
{
|
||||||
if (!value->is_ssa) {
|
|
||||||
printf(" %s ", glsl_get_type_name(value->deref.instr->type));
|
|
||||||
nir_print_deref(value->deref.instr, stdout);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool same_ssa = true;
|
bool same_ssa = true;
|
||||||
for (unsigned i = 0; i < num_components; i++) {
|
for (unsigned i = 0; i < num_components; i++) {
|
||||||
if (value->ssa.component[i] != i ||
|
if (value->ssa.component[i] != i ||
|
||||||
|
@@ -157,8 +157,6 @@ opt_peel_loop_initial_if(nir_loop *loop)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
nir_if *nif = nir_cf_node_as_if(if_node);
|
nir_if *nif = nir_cf_node_as_if(if_node);
|
||||||
if (!nif->condition.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nir_ssa_def *cond = nif->condition.ssa;
|
nir_ssa_def *cond = nif->condition.ssa;
|
||||||
if (cond->parent_instr->type != nir_instr_type_phi)
|
if (cond->parent_instr->type != nir_instr_type_phi)
|
||||||
|
@@ -54,9 +54,6 @@ nir_texop_implies_derivative(nir_texop op)
|
|||||||
static bool
|
static bool
|
||||||
can_move_src(nir_src *src, void *worklist)
|
can_move_src(nir_src *src, void *worklist)
|
||||||
{
|
{
|
||||||
if (!src->is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nir_instr *instr = src->ssa->parent_instr;
|
nir_instr *instr = src->ssa->parent_instr;
|
||||||
if (instr->pass_flags)
|
if (instr->pass_flags)
|
||||||
return true;
|
return true;
|
||||||
|
@@ -212,10 +212,6 @@ block_check_for_allowed_instrs(nir_block *block, unsigned *count,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It must be SSA */
|
|
||||||
if (!mov->dest.dest.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (alu_ok) {
|
if (alu_ok) {
|
||||||
/* If the ALU operation is an fsat or a move-like operation, do
|
/* If the ALU operation is an fsat or a move-like operation, do
|
||||||
* not count it. The expectation is that it will eventually be
|
* not count it. The expectation is that it will eventually be
|
||||||
|
@@ -61,8 +61,6 @@ static bool
|
|||||||
all_srcs_are_ssa(const nir_alu_instr *instr)
|
all_srcs_are_ssa(const nir_alu_instr *instr)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
|
for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
|
||||||
if (!instr->src[i].src.is_ssa)
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -72,9 +70,6 @@ all_srcs_are_ssa(const nir_alu_instr *instr)
|
|||||||
static bool
|
static bool
|
||||||
all_uses_are_bcsel(const nir_alu_instr *instr)
|
all_uses_are_bcsel(const nir_alu_instr *instr)
|
||||||
{
|
{
|
||||||
if (!instr->dest.dest.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nir_foreach_use(use, &instr->dest.dest.ssa) {
|
nir_foreach_use(use, &instr->dest.dest.ssa) {
|
||||||
if (use->parent_instr->type != nir_instr_type_alu)
|
if (use->parent_instr->type != nir_instr_type_alu)
|
||||||
return false;
|
return false;
|
||||||
|
@@ -42,9 +42,6 @@ opt_undef_csel(nir_alu_instr *instr)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int i = 1; i <= 2; i++) {
|
for (int i = 1; i <= 2; i++) {
|
||||||
if (!instr->src[i].src.is_ssa)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
nir_instr *parent = instr->src[i].src.ssa->parent_instr;
|
nir_instr *parent = instr->src[i].src.ssa->parent_instr;
|
||||||
if (parent->type != nir_instr_type_ssa_undef)
|
if (parent->type != nir_instr_type_ssa_undef)
|
||||||
continue;
|
continue;
|
||||||
@@ -144,9 +141,6 @@ opt_undef_store(nir_intrinsic_instr *intrin)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!intrin->src[arg_index].is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nir_ssa_def *def = intrin->src[arg_index].ssa;
|
nir_ssa_def *def = intrin->src[arg_index].ssa;
|
||||||
|
|
||||||
unsigned write_mask = nir_intrinsic_write_mask(intrin);
|
unsigned write_mask = nir_intrinsic_write_mask(intrin);
|
||||||
|
@@ -543,11 +543,6 @@ process_fp_query(struct analysis_state *state, struct analysis_query *aq, uint32
|
|||||||
unsigned src = q.src;
|
unsigned src = q.src;
|
||||||
nir_alu_type use_type = q.use_type;
|
nir_alu_type use_type = q.use_type;
|
||||||
|
|
||||||
if (!instr->src[src].src.is_ssa) {
|
|
||||||
*result = pack_data((struct ssa_result_range){unknown, false, false, false});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nir_src_is_const(instr->src[src].src)) {
|
if (nir_src_is_const(instr->src[src].src)) {
|
||||||
*result = pack_data(analyze_constant(instr, src, use_type));
|
*result = pack_data(analyze_constant(instr, src, use_type));
|
||||||
return;
|
return;
|
||||||
|
@@ -71,9 +71,6 @@ src_is_type(nir_src src, nir_alu_type type)
|
|||||||
{
|
{
|
||||||
assert(type != nir_type_invalid);
|
assert(type != nir_type_invalid);
|
||||||
|
|
||||||
if (!src.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (src.ssa->parent_instr->type == nir_instr_type_alu) {
|
if (src.ssa->parent_instr->type == nir_instr_type_alu) {
|
||||||
nir_alu_instr *src_alu = nir_instr_as_alu(src.ssa->parent_instr);
|
nir_alu_instr *src_alu = nir_instr_as_alu(src.ssa->parent_instr);
|
||||||
nir_alu_type output_type = nir_op_infos[src_alu->op].output_type;
|
nir_alu_type output_type = nir_op_infos[src_alu->op].output_type;
|
||||||
@@ -821,8 +818,6 @@ nir_algebraic_instr(nir_builder *build, nir_instr *instr,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
||||||
if (!alu->dest.dest.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
unsigned bit_size = alu->dest.dest.ssa.bit_size;
|
unsigned bit_size = alu->dest.dest.ssa.bit_size;
|
||||||
const unsigned execution_mode =
|
const unsigned execution_mode =
|
||||||
|
@@ -1462,8 +1462,6 @@ static bool
|
|||||||
validate_src_dominance(nir_src *src, void *_state)
|
validate_src_dominance(nir_src *src, void *_state)
|
||||||
{
|
{
|
||||||
validate_state *state = _state;
|
validate_state *state = _state;
|
||||||
if (!src->is_ssa)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (src->ssa->parent_instr->block == src->parent_instr->block) {
|
if (src->ssa->parent_instr->block == src->parent_instr->block) {
|
||||||
validate_assert(state, src->ssa->index < state->impl->ssa_alloc);
|
validate_assert(state, src->ssa->index < state->impl->ssa_alloc);
|
||||||
|
@@ -86,9 +86,6 @@ nir_ssa_def *ir3_nir_try_propagate_bit_shift(nir_builder *b,
|
|||||||
static inline nir_intrinsic_instr *
|
static inline nir_intrinsic_instr *
|
||||||
ir3_bindless_resource(nir_src src)
|
ir3_bindless_resource(nir_src src)
|
||||||
{
|
{
|
||||||
if (!src.is_ssa)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (src.ssa->parent_instr->type != nir_instr_type_intrinsic)
|
if (src.ssa->parent_instr->type != nir_instr_type_intrinsic)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@@ -45,9 +45,6 @@ coord_offset(nir_ssa_def *ssa)
|
|||||||
if (alu->op != nir_op_vec2)
|
if (alu->op != nir_op_vec2)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!alu->src[0].src.is_ssa)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
int base_src_offset = coord_offset(alu->src[0].src.ssa);
|
int base_src_offset = coord_offset(alu->src[0].src.ssa);
|
||||||
if (base_src_offset < 0)
|
if (base_src_offset < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -56,9 +53,6 @@ coord_offset(nir_ssa_def *ssa)
|
|||||||
|
|
||||||
/* NOTE it might be possible to support more than 2D? */
|
/* NOTE it might be possible to support more than 2D? */
|
||||||
for (int i = 1; i < 2; i++) {
|
for (int i = 1; i < 2; i++) {
|
||||||
if (!alu->src[i].src.is_ssa)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
int nth_src_offset = coord_offset(alu->src[i].src.ssa);
|
int nth_src_offset = coord_offset(alu->src[i].src.ssa);
|
||||||
if (nth_src_offset < 0)
|
if (nth_src_offset < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -79,12 +73,6 @@ coord_offset(nir_ssa_def *ssa)
|
|||||||
if (input->intrinsic != nir_intrinsic_load_interpolated_input)
|
if (input->intrinsic != nir_intrinsic_load_interpolated_input)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* limit to load_barycentric_pixel, other interpolation modes don't seem
|
|
||||||
* to be supported:
|
|
||||||
*/
|
|
||||||
if (!input->src[0].is_ssa)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
nir_intrinsic_instr *interp =
|
nir_intrinsic_instr *interp =
|
||||||
nir_instr_as_intrinsic(input->src[0].ssa->parent_instr);
|
nir_instr_as_intrinsic(input->src[0].ssa->parent_instr);
|
||||||
|
|
||||||
|
@@ -550,19 +550,11 @@ ntt_allocate_regs_unoptimized(struct ntt_compile *c, nir_function_impl *impl)
|
|||||||
static const uint32_t
|
static const uint32_t
|
||||||
ntt_extract_const_src_offset(nir_src *src)
|
ntt_extract_const_src_offset(nir_src *src)
|
||||||
{
|
{
|
||||||
if (!src->is_ssa)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
nir_ssa_scalar s = nir_get_ssa_scalar(src->ssa, 0);
|
nir_ssa_scalar s = nir_get_ssa_scalar(src->ssa, 0);
|
||||||
|
|
||||||
while (nir_ssa_scalar_is_alu(s)) {
|
while (nir_ssa_scalar_is_alu(s)) {
|
||||||
nir_alu_instr *alu = nir_instr_as_alu(s.def->parent_instr);
|
nir_alu_instr *alu = nir_instr_as_alu(s.def->parent_instr);
|
||||||
|
|
||||||
for (int i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
|
|
||||||
if (!alu->src[i].src.is_ssa)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alu->op == nir_op_iadd) {
|
if (alu->op == nir_op_iadd) {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
nir_const_value *v = nir_src_as_const_value(alu->src[i].src);
|
nir_const_value *v = nir_src_as_const_value(alu->src[i].src);
|
||||||
|
@@ -345,9 +345,6 @@ ra_src(struct etna_compile *c, nir_src *src)
|
|||||||
static hw_src
|
static hw_src
|
||||||
get_src(struct etna_compile *c, nir_src *src)
|
get_src(struct etna_compile *c, nir_src *src)
|
||||||
{
|
{
|
||||||
if (!src->is_ssa)
|
|
||||||
return ra_src(c, src);
|
|
||||||
|
|
||||||
nir_instr *instr = src->ssa->parent_instr;
|
nir_instr *instr = src->ssa->parent_instr;
|
||||||
|
|
||||||
if (instr->pass_flags & BYPASS_SRC) {
|
if (instr->pass_flags & BYPASS_SRC) {
|
||||||
@@ -481,10 +478,6 @@ emit_alu(struct etna_compile *c, nir_alu_instr * alu)
|
|||||||
unsigned dst_swiz;
|
unsigned dst_swiz;
|
||||||
hw_dst dst = ra_dest(c, &alu->dest.dest, &dst_swiz);
|
hw_dst dst = ra_dest(c, &alu->dest.dest, &dst_swiz);
|
||||||
|
|
||||||
/* compose alu write_mask with RA write mask */
|
|
||||||
if (!alu->dest.dest.is_ssa)
|
|
||||||
dst.write_mask = inst_write_mask_compose(alu->dest.write_mask, dst.write_mask);
|
|
||||||
|
|
||||||
switch (alu->op) {
|
switch (alu->op) {
|
||||||
case nir_op_fdot2:
|
case nir_op_fdot2:
|
||||||
case nir_op_fdot3:
|
case nir_op_fdot3:
|
||||||
|
@@ -56,9 +56,6 @@ nir_lower_to_source_mods_instr(nir_builder *b, nir_instr *instr,
|
|||||||
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
||||||
|
|
||||||
for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
|
for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
|
||||||
if (!alu->src[i].src.is_ssa)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (alu->src[i].src.ssa->parent_instr->type != nir_instr_type_alu)
|
if (alu->src[i].src.ssa->parent_instr->type != nir_instr_type_alu)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -122,9 +122,6 @@ lima_nir_duplicate_intrinsic_impl(nir_shader *shader, nir_function_impl *impl,
|
|||||||
if (itr->instr.pass_flags)
|
if (itr->instr.pass_flags)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!itr->dest.is_ssa)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
lima_nir_duplicate_intrinsic(&builder, itr, op);
|
lima_nir_duplicate_intrinsic(&builder, itr, op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,12 +38,6 @@ lima_nir_split_load_input_instr(nir_builder *b,
|
|||||||
if (alu->op != nir_op_mov)
|
if (alu->op != nir_op_mov)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!alu->dest.dest.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!alu->src[0].src.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nir_ssa_def *ssa = alu->src[0].src.ssa;
|
nir_ssa_def *ssa = alu->src[0].src.ssa;
|
||||||
if (ssa->parent_instr->type != nir_instr_type_intrinsic)
|
if (ssa->parent_instr->type != nir_instr_type_intrinsic)
|
||||||
return false;
|
return false;
|
||||||
|
@@ -54,16 +54,10 @@ clone_intrinsic(nir_builder *b, nir_intrinsic_instr *intrin)
|
|||||||
static bool
|
static bool
|
||||||
replace_intrinsic(nir_builder *b, nir_intrinsic_instr *intrin)
|
replace_intrinsic(nir_builder *b, nir_intrinsic_instr *intrin)
|
||||||
{
|
{
|
||||||
if (!intrin->dest.is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (intrin->intrinsic != nir_intrinsic_load_input &&
|
if (intrin->intrinsic != nir_intrinsic_load_input &&
|
||||||
intrin->intrinsic != nir_intrinsic_load_uniform)
|
intrin->intrinsic != nir_intrinsic_load_uniform)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!intrin->src[0].is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (intrin->src[0].ssa->parent_instr->type == nir_instr_type_load_const)
|
if (intrin->src[0].ssa->parent_instr->type == nir_instr_type_load_const)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -178,10 +178,6 @@ finished:
|
|||||||
static bool
|
static bool
|
||||||
is_fs_input(const nir_src *src)
|
is_fs_input(const nir_src *src)
|
||||||
{
|
{
|
||||||
if (!src->is_ssa) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nir_instr *parent = src->ssa[0].parent_instr;
|
const nir_instr *parent = src->ssa[0].parent_instr;
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
return false;
|
return false;
|
||||||
@@ -232,10 +228,6 @@ get_nir_input_info(const nir_alu_src *src,
|
|||||||
unsigned *input_index,
|
unsigned *input_index,
|
||||||
int *input_component)
|
int *input_component)
|
||||||
{
|
{
|
||||||
if (!src->src.is_ssa) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The parent instr should be a nir_intrinsic_load_deref.
|
// The parent instr should be a nir_intrinsic_load_deref.
|
||||||
const nir_instr *parent = src->src.ssa[0].parent_instr;
|
const nir_instr *parent = src->src.ssa[0].parent_instr;
|
||||||
if (!parent || parent->type != nir_instr_type_intrinsic) {
|
if (!parent || parent->type != nir_instr_type_intrinsic) {
|
||||||
|
@@ -925,9 +925,6 @@ TexInstr::set_coord_offsets(nir_src *offset)
|
|||||||
if (!offset)
|
if (!offset)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!offset->is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
auto literal = nir_src_as_const_value(*offset);
|
auto literal = nir_src_as_const_value(*offset);
|
||||||
if (!literal)
|
if (!literal)
|
||||||
return false;
|
return false;
|
||||||
|
@@ -13,9 +13,6 @@
|
|||||||
static bool
|
static bool
|
||||||
add_src_instr_to_worklist(nir_src *src, void *wl)
|
add_src_instr_to_worklist(nir_src *src, void *wl)
|
||||||
{
|
{
|
||||||
if (!src->is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nir_instr_worklist_push_tail(wl, src->ssa->parent_instr);
|
nir_instr_worklist_push_tail(wl, src->ssa->parent_instr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -36,9 +36,6 @@ nir_instr_is_resource_intel(nir_instr *instr)
|
|||||||
static bool
|
static bool
|
||||||
add_src_instr(nir_src *src, void *state)
|
add_src_instr(nir_src *src, void *state)
|
||||||
{
|
{
|
||||||
if (!src->is_ssa)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
struct util_dynarray *inst_array = state;
|
struct util_dynarray *inst_array = state;
|
||||||
util_dynarray_foreach(inst_array, nir_instr *, instr_ptr) {
|
util_dynarray_foreach(inst_array, nir_instr *, instr_ptr) {
|
||||||
if (*instr_ptr == src->ssa->parent_instr)
|
if (*instr_ptr == src->ssa->parent_instr)
|
||||||
@@ -119,9 +116,6 @@ brw_nir_lower_non_uniform_intrinsic(nir_builder *b,
|
|||||||
|
|
||||||
b->cursor = nir_before_instr(&intrin->instr);
|
b->cursor = nir_before_instr(&intrin->instr);
|
||||||
|
|
||||||
if (!intrin->src[source].is_ssa)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
util_dynarray_clear(inst_array);
|
util_dynarray_clear(inst_array);
|
||||||
|
|
||||||
nir_intrinsic_instr *old_resource_intel =
|
nir_intrinsic_instr *old_resource_intel =
|
||||||
@@ -156,9 +150,6 @@ brw_nir_lower_non_uniform_tex(nir_builder *b,
|
|||||||
tex->src[s].src_type != nir_tex_src_sampler_handle)
|
tex->src[s].src_type != nir_tex_src_sampler_handle)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!tex->src[s].src.is_ssa)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
util_dynarray_clear(inst_array);
|
util_dynarray_clear(inst_array);
|
||||||
|
|
||||||
nir_intrinsic_instr *old_resource_intel =
|
nir_intrinsic_instr *old_resource_intel =
|
||||||
|
Reference in New Issue
Block a user