nir: Remove nir_parallel_copy_instr
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36483>
This commit is contained in:
Konstantin Seurer 2025-07-30 22:38:44 +02:00 committed by Marge Bot
parent 3f3faa82b8
commit b962063d72
18 changed files with 0 additions and 127 deletions

View file

@ -1347,7 +1347,6 @@ v3d_instr_delay_cb(nir_instr *instr, void *data)
case nir_instr_type_alu:
case nir_instr_type_deref:
case nir_instr_type_jump:
case nir_instr_type_parallel_copy:
case nir_instr_type_call:
case nir_instr_type_phi:
return 1;

View file

@ -1018,17 +1018,6 @@ nir_phi_instr_add_src(nir_phi_instr *instr, nir_block *pred, nir_def *src)
return phi_src;
}
nir_parallel_copy_instr *
nir_parallel_copy_instr_create(nir_shader *shader)
{
nir_parallel_copy_instr *instr =
nir_instr_create(shader, nir_instr_type_parallel_copy, sizeof(nir_parallel_copy_instr));
exec_list_make_empty(&instr->entries);
return instr;
}
nir_undef_instr *
nir_undef_instr_create(nir_shader *shader,
unsigned num_components,
@ -1484,9 +1473,6 @@ nir_instr_def(nir_instr *instr)
case nir_instr_type_phi:
return &nir_instr_as_phi(instr)->def;
case nir_instr_type_parallel_copy:
UNREACHABLE("Parallel copies are unsupported by this function");
case nir_instr_type_load_const:
return &nir_instr_as_load_const(instr)->def;
@ -2898,7 +2884,6 @@ nir_instr_can_speculate(nir_instr *instr)
case nir_instr_type_call:
case nir_instr_type_jump:
case nir_instr_type_phi:
case nir_instr_type_parallel_copy:
return false;
}

View file

@ -946,7 +946,6 @@ typedef enum ENUM_PACKED {
nir_instr_type_jump,
nir_instr_type_undef,
nir_instr_type_phi,
nir_instr_type_parallel_copy,
} nir_instr_type;
typedef struct nir_instr {
@ -2779,31 +2778,6 @@ nir_phi_get_src_from_block(nir_phi_instr *phi, nir_block *block)
return NULL;
}
typedef struct nir_parallel_copy_entry {
struct exec_node node;
bool src_is_reg;
bool dest_is_reg;
nir_src src;
union {
nir_def def;
nir_src reg;
} dest;
} nir_parallel_copy_entry;
#define nir_foreach_parallel_copy_entry(entry, pcopy) \
foreach_list_typed(nir_parallel_copy_entry, entry, node, &(pcopy)->entries)
typedef struct nir_parallel_copy_instr {
nir_instr instr;
/* A list of nir_parallel_copy_entrys. The sources of all of the
* entries are copied to the corresponding destinations "in parallel".
* In other words, if we have two entries: a -> b and b -> a, the values
* get swapped.
*/
struct exec_list entries;
} nir_parallel_copy_instr;
/* This struct contains metadata for correlating the final nir shader
* (after many lowering and optimization passes) with the source spir-v
* or glsl. To avoid adding unnecessary overhead when the driver does not
@ -2856,9 +2830,6 @@ NIR_DEFINE_CAST(nir_instr_as_undef, nir_instr, nir_undef_instr, instr,
type, nir_instr_type_undef)
NIR_DEFINE_CAST(nir_instr_as_phi, nir_instr, nir_phi_instr, instr,
type, nir_instr_type_phi)
NIR_DEFINE_CAST(nir_instr_as_parallel_copy, nir_instr,
nir_parallel_copy_instr, instr,
type, nir_instr_type_parallel_copy)
#define NIR_DEFINE_DEF_AS_INSTR(type, suffix) \
static inline type *nir_def_as_##suffix(const nir_def *def) \
@ -4121,8 +4092,6 @@ nir_phi_instr *nir_phi_instr_create(nir_shader *shader);
nir_phi_src *nir_phi_instr_add_src(nir_phi_instr *instr,
nir_block *pred, nir_def *src);
nir_parallel_copy_instr *nir_parallel_copy_instr_create(nir_shader *shader);
nir_undef_instr *nir_undef_instr_create(nir_shader *shader,
unsigned num_components,
unsigned bit_size);

View file

@ -511,8 +511,6 @@ clone_instr(clone_state *state, const nir_instr *instr)
return &clone_jump(state, nir_instr_as_jump(instr))->instr;
case nir_instr_type_call:
return &clone_call(state, nir_instr_as_call(instr))->instr;
case nir_instr_type_parallel_copy:
UNREACHABLE("Cannot clone parallel copies");
default:
UNREACHABLE("bad instr type");
return NULL;

View file

@ -52,7 +52,6 @@ typedef struct nir_intrinsic_instr nir_intrinsic_instr;
typedef struct nir_load_const_instr nir_load_const_instr;
typedef struct nir_undef_instr nir_undef_instr;
typedef struct nir_phi_instr nir_phi_instr;
typedef struct nir_parallel_copy_instr nir_parallel_copy_instr;
typedef struct nir_xfb_info nir_xfb_info;
typedef struct nir_tcs_info nir_tcs_info;

View file

@ -1215,7 +1215,6 @@ instr_is_loop_invariant(nir_instr *instr, struct divergence_state *state)
case nir_instr_type_call:
return false;
case nir_instr_type_phi:
case nir_instr_type_parallel_copy:
default:
UNREACHABLE("NIR divergence analysis: Unsupported instruction type.");
}
@ -1241,7 +1240,6 @@ update_instr_divergence(nir_instr *instr, struct divergence_state *state)
return false;
case nir_instr_type_jump:
case nir_instr_type_phi:
case nir_instr_type_parallel_copy:
default:
UNREACHABLE("NIR divergence analysis: Unsupported instruction type.");
}

View file

@ -19,14 +19,6 @@ _nir_foreach_def(nir_instr *instr, nir_foreach_def_cb cb, void *state)
return cb(&nir_instr_as_tex(instr)->def, state);
case nir_instr_type_phi:
return cb(&nir_instr_as_phi(instr)->def, state);
case nir_instr_type_parallel_copy: {
nir_foreach_parallel_copy_entry(entry, nir_instr_as_parallel_copy(instr)) {
if (!entry->dest_is_reg && !cb(&entry->dest.def, state))
return false;
}
return true;
}
case nir_instr_type_load_const:
return cb(&nir_instr_as_load_const(instr)->def, state);
case nir_instr_type_undef:
@ -116,16 +108,6 @@ nir_foreach_src(nir_instr *instr, nir_foreach_src_cb cb, void *state)
}
break;
}
case nir_instr_type_parallel_copy: {
nir_parallel_copy_instr *pc = nir_instr_as_parallel_copy(instr);
nir_foreach_parallel_copy_entry(entry, pc) {
if (!_nir_visit_src(&entry->src, cb, state))
return false;
if (entry->dest_is_reg && !_nir_visit_src(&entry->dest.reg, cb, state))
return false;
}
break;
}
case nir_instr_type_jump: {
nir_jump_instr *jump = nir_instr_as_jump(instr);

View file

@ -78,7 +78,6 @@ instr_can_rewrite(const nir_instr *instr)
case nir_instr_type_jump:
case nir_instr_type_undef:
return false;
case nir_instr_type_parallel_copy:
default:
UNREACHABLE("Invalid instruction type");
}
@ -757,7 +756,6 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2)
case nir_instr_type_call:
case nir_instr_type_jump:
case nir_instr_type_undef:
case nir_instr_type_parallel_copy:
default:
UNREACHABLE("Invalid instruction type");
}

View file

@ -88,14 +88,6 @@ is_live(BITSET_WORD *defs_live, nir_instr *instr)
nir_undef_instr *undef = nir_instr_as_undef(instr);
return is_def_live(&undef->def, defs_live);
}
case nir_instr_type_parallel_copy: {
nir_parallel_copy_instr *pc = nir_instr_as_parallel_copy(instr);
nir_foreach_parallel_copy_entry(entry, pc) {
if (entry->dest_is_reg || is_def_live(&entry->dest.def, defs_live))
return true;
}
return false;
}
default:
UNREACHABLE("unexpected instr type");
}

View file

@ -288,9 +288,6 @@ opt_move_discards_to_top_impl(nir_function_impl *impl)
}
continue;
}
case nir_instr_type_parallel_copy:
UNREACHABLE("Unhanded instruction type");
}
}
}

View file

@ -93,7 +93,6 @@ block_check_for_allowed_instrs(nir_block *block, unsigned *count,
case nir_instr_type_call:
case nir_instr_type_jump:
case nir_instr_type_parallel_copy:
return false;
}
}

View file

@ -2120,28 +2120,6 @@ print_phi_instr(nir_phi_instr *instr, print_state *state)
ralloc_free(preds);
}
static void
print_parallel_copy_instr(nir_parallel_copy_instr *instr, print_state *state)
{
FILE *fp = state->fp;
nir_foreach_parallel_copy_entry(entry, instr) {
if (&entry->node != exec_list_get_head(&instr->entries))
fprintf(fp, "; ");
if (entry->dest_is_reg) {
fprintf(fp, "*");
print_src(&entry->dest.reg, state, nir_type_invalid);
} else {
print_def(&entry->dest.def, state);
}
fprintf(fp, " = ");
if (entry->src_is_reg)
fprintf(fp, "*");
print_src(&entry->src, state, nir_type_invalid);
}
}
static void
print_instr(const nir_instr *instr, print_state *state, unsigned tabs)
{
@ -2214,10 +2192,6 @@ print_instr(const nir_instr *instr, print_state *state, unsigned tabs)
print_phi_instr(nir_instr_as_phi(instr), state);
break;
case nir_instr_type_parallel_copy:
print_parallel_copy_instr(nir_instr_as_parallel_copy(instr), state);
break;
default:
UNREACHABLE("Invalid instruction type");
break;
@ -2238,7 +2212,6 @@ block_has_instruction_with_dest(nir_block *block)
case nir_instr_type_tex:
case nir_instr_type_undef:
case nir_instr_type_phi:
case nir_instr_type_parallel_copy:
return true;
case nir_instr_type_intrinsic: {

View file

@ -143,7 +143,6 @@ propagate_invariant_instr(nir_instr *instr, struct set *invariants)
case nir_instr_type_call:
UNREACHABLE("This pass must be run after function inlining");
case nir_instr_type_parallel_copy:
default:
UNREACHABLE("Cannot have this instruction type");
}

View file

@ -480,10 +480,6 @@ nir_schedule_calculate_deps(nir_deps_state *state, nir_schedule_node *n)
UNREACHABLE("Calls should have been lowered");
break;
case nir_instr_type_parallel_copy:
UNREACHABLE("Parallel copies should have been lowered");
break;
case nir_instr_type_phi:
UNREACHABLE("nir_schedule() should be called after lowering from SSA");
break;
@ -1093,7 +1089,6 @@ nir_schedule_get_delay(nir_schedule_scoreboard *scoreboard, nir_instr *instr)
case nir_instr_type_alu:
case nir_instr_type_deref:
case nir_instr_type_jump:
case nir_instr_type_parallel_copy:
case nir_instr_type_call:
case nir_instr_type_phi:
return 1;

View file

@ -1717,8 +1717,6 @@ write_instr(write_ctx *ctx, const nir_instr *instr)
blob_write_uint32(ctx->blob, instr->type);
write_call(ctx, nir_instr_as_call(instr));
break;
case nir_instr_type_parallel_copy:
UNREACHABLE("Cannot write parallel copies");
default:
UNREACHABLE("bad instr type");
}
@ -1771,8 +1769,6 @@ read_instr(read_ctx *ctx, nir_block *block)
case nir_instr_type_call:
instr = &read_call(ctx)->instr;
break;
case nir_instr_type_parallel_copy:
UNREACHABLE("Cannot read parallel copies");
default:
UNREACHABLE("bad instr type");
}

View file

@ -4296,7 +4296,6 @@ emit_instr(struct ir3_context *ctx, nir_instr *instr)
emit_phi(ctx, nir_instr_as_phi(instr));
break;
case nir_instr_type_call:
case nir_instr_type_parallel_copy:
ir3_context_error(ctx, "Unhandled NIR instruction type: %d\n",
instr->type);
break;
@ -4466,7 +4465,6 @@ instr_can_be_predicated(nir_instr *instr)
case nir_instr_type_load_const:
case nir_instr_type_undef:
case nir_instr_type_phi:
case nir_instr_type_parallel_copy:
return true;
case nir_instr_type_call:
case nir_instr_type_jump:

View file

@ -4522,9 +4522,6 @@ emit_block(struct ntv_context *ctx, struct nir_block *block)
case nir_instr_type_call:
UNREACHABLE("nir_instr_type_call not supported");
break;
case nir_instr_type_parallel_copy:
UNREACHABLE("nir_instr_type_parallel_copy not supported");
break;
case nir_instr_type_deref:
emit_deref(ctx, nir_instr_as_deref(instr));
break;

View file

@ -1749,7 +1749,6 @@ instr_to_msl(struct nir_to_msl_ctx *ctx, nir_instr *instr)
// undefs get inlined into their uses (and we shouldn't see them hopefully)
break;
case nir_instr_type_phi:
case nir_instr_type_parallel_copy:
assert(!"NIR should be taken out of SSA");
break;
}