brw: Remove block parameter from brw_inst::remove()

Use brw_inst::block instead.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33815>
This commit is contained in:
Caio Oliveira 2025-02-27 23:23:26 -08:00 committed by Marge Bot
parent 7924d48bcd
commit 66307811c3
18 changed files with 44 additions and 46 deletions

View file

@ -985,9 +985,9 @@ brw_inst::insert_before(bblock_t *block, brw_inst *inst)
}
void
brw_inst::remove(bblock_t *block, bool defer_later_block_ip_updates)
brw_inst::remove(bool defer_later_block_ip_updates)
{
assert(this->block == block);
assert(block);
if (exec_list_is_singular(&block->instructions)) {
this->opcode = BRW_OPCODE_NOP;
@ -1016,7 +1016,7 @@ brw_inst::remove(bblock_t *block, bool defer_later_block_ip_updates)
}
exec_node::remove();
this->block = NULL;
block = NULL;
}
enum brw_reg_type

View file

@ -91,7 +91,7 @@ public:
*/
bool uses_indirect_addressing() const;
void remove(bblock_t *block, bool defer_later_block_ip_updates = false);
void remove(bool defer_later_block_ip_updates = false);
void insert_before(bblock_t *block, brw_inst *inst);
/**

View file

@ -90,7 +90,7 @@ brw_lower_load_payload(brw_shader &s)
dst = offset(dst, ibld, 1);
}
inst->remove(block);
inst->remove();
progress = true;
}
@ -254,7 +254,7 @@ brw_lower_sub_sat(brw_shader &s)
->predicate = BRW_PREDICATE_NORMAL;
}
inst->remove(block);
inst->remove();
progress = true;
}
}
@ -494,7 +494,7 @@ brw_lower_find_live_channel(brw_shader &s)
unreachable("Impossible.");
}
inst->remove(block);
inst->remove();
progress = true;
}
@ -622,7 +622,7 @@ brw_lower_alu_restrictions(brw_shader &s)
ibld.MOV(subscript(inst->dst, type, 0),
subscript(inst->src[0], type, 0));
inst->remove(block);
inst->remove();
progress = true;
}
break;
@ -650,7 +650,7 @@ brw_lower_alu_restrictions(brw_shader &s)
subscript(inst->src[0], type, 1),
subscript(inst->src[1], type, 1)));
inst->remove(block);
inst->remove();
progress = true;
}
break;
@ -876,7 +876,7 @@ brw_lower_load_subgroup_invocation(brw_shader &s)
}
}
inst->remove(block);
inst->remove();
progress = true;
}
@ -945,7 +945,7 @@ brw_lower_indirect_mov(brw_shader &s)
/* Extra MOV needed here to convert back to the corresponding B type */
ibld.MOV(inst->dst, result);
inst->remove(block);
inst->remove();
progress = true;
}
}

View file

@ -290,7 +290,7 @@ brw_lower_dpas(brw_shader &v)
}
}
inst->remove(block);
inst->remove();
progress = true;
}

View file

@ -431,7 +431,7 @@ brw_lower_integer_multiplication(brw_shader &s)
(inst->src[1].type == BRW_TYPE_Q ||
inst->src[1].type == BRW_TYPE_UQ)) {
brw_lower_mul_qword_inst(s, inst, block);
inst->remove(block);
inst->remove();
progress = true;
} else if (!inst->dst.is_accumulator() &&
(inst->dst.type == BRW_TYPE_D ||
@ -439,12 +439,12 @@ brw_lower_integer_multiplication(brw_shader &s)
(!devinfo->has_integer_dword_mul ||
devinfo->verx10 >= 125)) {
brw_lower_mul_dword_inst(s, inst, block);
inst->remove(block);
inst->remove();
progress = true;
}
} else if (inst->opcode == SHADER_OPCODE_MULH) {
brw_lower_mulh_inst(s, inst, block);
inst->remove(block);
inst->remove();
progress = true;
}

View file

@ -72,7 +72,7 @@ brw_lower_pack(brw_shader &s)
unreachable("skipped above");
}
inst->remove(block);
inst->remove();
progress = true;
}

View file

@ -716,7 +716,7 @@ namespace {
lower_instruction(v, block, mov);
}
inst->remove(block);
inst->remove();
return true;
}

View file

@ -749,7 +749,7 @@ brw_lower_simd_width(brw_shader &s)
lbld.at(block, inst->next).emit(split_inst);
}
inst->remove(block);
inst->remove();
progress = true;
}

View file

@ -296,7 +296,7 @@ brw_lower_reduce(brw_shader &s, bblock_t *block, brw_inst *inst)
bld.emit(SHADER_OPCODE_CLUSTER_BROADCAST, dst, scan,
brw_imm_ud(cluster_size - 1), brw_imm_ud(cluster_size));
}
inst->remove(block);
inst->remove();
return true;
}
@ -345,7 +345,7 @@ brw_lower_scan(brw_shader &s, bblock_t *block, brw_inst *inst)
bld.MOV(dst, scan);
inst->remove(block);
inst->remove();
return true;
}
@ -511,7 +511,7 @@ brw_lower_vote(brw_shader &s, bblock_t *block, brw_inst *inst)
brw_lower_quad_vote_gfx20(bld, inst->opcode, dst, src);
}
inst->remove(block);
inst->remove();
return true;
}
@ -541,7 +541,7 @@ brw_lower_ballot(brw_shader &s, bblock_t *block, brw_inst *inst)
xbld.MOV(dst, flag);
}
inst->remove(block);
inst->remove();
return true;
}
@ -597,7 +597,7 @@ brw_lower_quad_swap(brw_shader &s, bblock_t *block, brw_inst *inst)
}
}
inst->remove(block);
inst->remove();
return true;
}
@ -613,7 +613,7 @@ brw_lower_read_from_live_channel(brw_shader &s, bblock_t *block, brw_inst *inst)
bld.MOV(dst, bld.emit_uniformize(value));
inst->remove(block);
inst->remove();
return true;
}
@ -646,7 +646,7 @@ brw_lower_read_from_channel(brw_shader &s, bblock_t *block, brw_inst *inst)
bld.MOV(dst, tmp);
}
inst->remove(block);
inst->remove();
return true;
}

View file

@ -394,14 +394,12 @@ brw_opt_remove_redundant_halts(brw_shader &s)
unsigned halt_count = 0;
brw_inst *halt_target = NULL;
bblock_t *halt_target_block = NULL;
foreach_block_and_inst(block, brw_inst, inst, s.cfg) {
if (inst->opcode == BRW_OPCODE_HALT)
halt_count++;
if (inst->opcode == SHADER_OPCODE_HALT_TARGET) {
halt_target = inst;
halt_target_block = block;
break;
}
}
@ -415,13 +413,13 @@ brw_opt_remove_redundant_halts(brw_shader &s)
for (brw_inst *prev = (brw_inst *) halt_target->prev;
!prev->is_head_sentinel() && prev->opcode == BRW_OPCODE_HALT;
prev = (brw_inst *) halt_target->prev) {
prev->remove(halt_target_block);
prev->remove();
halt_count--;
progress = true;
}
if (halt_count == 0) {
halt_target->remove(halt_target_block);
halt_target->remove();
progress = true;
}
@ -556,7 +554,7 @@ brw_opt_remove_extra_rounding_modes(brw_shader &s)
assert(inst->src[0].file == IMM);
const brw_rnd_mode mode = (brw_rnd_mode) inst->src[0].d;
if (mode == prev_mode) {
inst->remove(block);
inst->remove();
progress = true;
} else {
prev_mode = mode;

View file

@ -44,7 +44,7 @@ opt_address_reg_load_local(brw_shader &s, bblock_t *block, const brw_def_analysi
}
ubld.emit(src_inst->opcode, inst->dst, sources, src_inst->sources);
inst->remove(block);
inst->remove();
progress = true;
}

View file

@ -135,7 +135,7 @@ cmod_propagate_cmp_to_add(const intel_device_info *devinfo, bblock_t *block,
scan_inst->conditional_mod == cond)) {
scan_inst->conditional_mod = cond;
scan_inst->flag_subreg = inst->flag_subreg;
inst->remove(block, true);
inst->remove(true);
return true;
}
break;
@ -205,7 +205,7 @@ cmod_propagate_not(const intel_device_info *devinfo, bblock_t *block,
scan_inst->conditional_mod == cond)) {
scan_inst->conditional_mod = cond;
scan_inst->flag_subreg = inst->flag_subreg;
inst->remove(block, true);
inst->remove(true);
return true;
}
break;
@ -312,7 +312,7 @@ opt_cmod_propagation_local(const intel_device_info *devinfo, bblock_t *block)
if (inst->conditional_mod == BRW_CONDITIONAL_NZ &&
scan_inst->opcode == BRW_OPCODE_CMP &&
brw_type_is_int(inst->dst.type)) {
inst->remove(block, true);
inst->remove(true);
progress = true;
break;
}
@ -460,20 +460,20 @@ opt_cmod_propagation_local(const intel_device_info *devinfo, bblock_t *block)
inst->src[0].type == BRW_TYPE_UD) ||
(inst->conditional_mod == BRW_CONDITIONAL_L &&
inst->src[0].type == BRW_TYPE_D)) {
inst->remove(block, true);
inst->remove(true);
progress = true;
break;
}
} else if (scan_inst->conditional_mod == inst->conditional_mod) {
/* sel.cond will not write the flags. */
assert(scan_inst->opcode != BRW_OPCODE_SEL);
inst->remove(block, true);
inst->remove(true);
progress = true;
break;
} else if (!read_flag && scan_inst->can_do_cmod()) {
scan_inst->conditional_mod = inst->conditional_mod;
scan_inst->flag_subreg = inst->flag_subreg;
inst->remove(block, true);
inst->remove(true);
progress = true;
break;
}
@ -535,7 +535,7 @@ opt_cmod_propagation_local(const intel_device_info *devinfo, bblock_t *block)
scan_inst->conditional_mod == cond)) {
scan_inst->conditional_mod = cond;
scan_inst->flag_subreg = inst->flag_subreg;
inst->remove(block, true);
inst->remove(true);
progress = true;
}
break;

View file

@ -1879,7 +1879,7 @@ brw_opt_copy_propagation_defs(brw_shader &s)
progress = true;
++uses_deleted[def->dst.nr];
if (defs.get_use_count(def->dst) == uses_deleted[def->dst.nr])
def->remove(def->block, true);
def->remove(true);
}
continue;
@ -1913,7 +1913,7 @@ brw_opt_copy_propagation_defs(brw_shader &s)
*/
if (def->conditional_mod == BRW_CONDITIONAL_NONE &&
defs.get_use_count(def->dst) == uses_deleted[def->dst.nr]) {
def->remove(def->block, true);
def->remove(true);
}
}
}

View file

@ -426,7 +426,7 @@ brw_opt_cse_defs(brw_shader &s)
* which is redundant with the previous flag write in our
* basic block. So we can simply remove it.
*/
inst->remove(block, true);
inst->remove(true);
last = NULL;
progress = true;
}
@ -497,7 +497,7 @@ brw_opt_cse_defs(brw_shader &s)
continue;
if (!remap_table[i].still_used) {
remap_table[i].inst->remove(remap_table[i].inst->block, true);
remap_table[i].inst->remove(true);
progress = true;
}
}

View file

@ -151,7 +151,7 @@ brw_opt_dead_code_eliminate(brw_shader &s)
flag_live[0] &= ~inst->flags_written(devinfo);
if (inst->opcode == BRW_OPCODE_NOP) {
inst->remove(block, true);
inst->remove(true);
continue;
}

View file

@ -369,7 +369,7 @@ brw_opt_register_coalesce(brw_shader &s)
if (progress) {
foreach_block_and_inst_safe (block, brw_inst, inst, s.cfg) {
if (inst->opcode == BRW_OPCODE_NOP) {
inst->remove(block, true);
inst->remove(true);
}
}

View file

@ -220,7 +220,7 @@ brw_opt_combine_convergent_txf(brw_shader &s)
v[c] = component(offset(div, ubld, c), i);
ibld.VEC(retype(txf->dst, BRW_TYPE_UD), v, dest_comps);
txf->remove(block);
txf->remove();
}
progress = true;

View file

@ -158,7 +158,7 @@ brw_opt_split_virtual_grfs(brw_shader &s)
assert(undef->size_written % REG_SIZE == 0);
size_written += undef->size_written;
}
inst->remove(block);
inst->remove();
} else {
reg = vgrf_to_reg[inst->dst.nr];
assert(new_reg_offset[reg] == 0);