intel/brw: Pull opt_algebraic out of fs_visitor
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26887>
This commit is contained in:
@@ -2535,11 +2535,12 @@ brw_imm_for_type(uint64_t value, enum brw_reg_type type)
|
||||
}
|
||||
|
||||
bool
|
||||
fs_visitor::opt_algebraic()
|
||||
brw_fs_opt_algebraic(fs_visitor &s)
|
||||
{
|
||||
const intel_device_info *devinfo = s.devinfo;
|
||||
bool progress = false;
|
||||
|
||||
foreach_block_and_inst_safe(block, fs_inst, inst, cfg) {
|
||||
foreach_block_and_inst_safe(block, fs_inst, inst, s.cfg) {
|
||||
switch (inst->opcode) {
|
||||
case BRW_OPCODE_MOV:
|
||||
if (!devinfo->has_64bit_float &&
|
||||
@@ -2548,7 +2549,7 @@ fs_visitor::opt_algebraic()
|
||||
assert(!inst->saturate);
|
||||
assert(!inst->src[0].abs);
|
||||
assert(!inst->src[0].negate);
|
||||
const brw::fs_builder ibld(this, block, inst);
|
||||
const brw::fs_builder ibld(&s, block, inst);
|
||||
|
||||
if (!inst->is_partial_write())
|
||||
ibld.emit_undef_for_dst(inst);
|
||||
@@ -2569,7 +2570,7 @@ fs_visitor::opt_algebraic()
|
||||
assert(!inst->saturate);
|
||||
assert(!inst->src[0].abs);
|
||||
assert(!inst->src[0].negate);
|
||||
const brw::fs_builder ibld(this, block, inst);
|
||||
const brw::fs_builder ibld(&s, block, inst);
|
||||
|
||||
if (!inst->is_partial_write())
|
||||
ibld.emit_undef_for_dst(inst);
|
||||
@@ -2759,7 +2760,7 @@ fs_visitor::opt_algebraic()
|
||||
assert(!inst->saturate);
|
||||
assert(!inst->src[0].abs && !inst->src[0].negate);
|
||||
assert(!inst->src[1].abs && !inst->src[1].negate);
|
||||
const brw::fs_builder ibld(this, block, inst);
|
||||
const brw::fs_builder ibld(&s, block, inst);
|
||||
|
||||
if (!inst->is_partial_write())
|
||||
ibld.emit_undef_for_dst(inst);
|
||||
@@ -2931,8 +2932,8 @@ fs_visitor::opt_algebraic()
|
||||
}
|
||||
|
||||
if (progress)
|
||||
invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW |
|
||||
DEPENDENCY_INSTRUCTION_DETAIL);
|
||||
s.invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW |
|
||||
DEPENDENCY_INSTRUCTION_DETAIL);
|
||||
|
||||
return progress;
|
||||
}
|
||||
@@ -5677,7 +5678,7 @@ fs_visitor::optimize()
|
||||
pass_num = 0;
|
||||
iteration++;
|
||||
|
||||
OPT(opt_algebraic);
|
||||
OPT(brw_fs_opt_algebraic, *this);
|
||||
OPT(brw_fs_opt_cse, *this);
|
||||
OPT(brw_fs_opt_copy_propagation, *this);
|
||||
OPT(opt_predicated_break, this);
|
||||
@@ -5707,20 +5708,20 @@ fs_visitor::optimize()
|
||||
/* After logical SEND lowering. */
|
||||
|
||||
if (OPT(brw_fs_opt_copy_propagation, *this))
|
||||
OPT(opt_algebraic);
|
||||
OPT(brw_fs_opt_algebraic, *this);
|
||||
|
||||
/* Identify trailing zeros LOAD_PAYLOAD of sampler messages.
|
||||
* Do this before splitting SENDs.
|
||||
*/
|
||||
if (OPT(opt_zero_samples) && OPT(brw_fs_opt_copy_propagation, *this))
|
||||
OPT(opt_algebraic);
|
||||
OPT(brw_fs_opt_algebraic, *this);
|
||||
|
||||
OPT(opt_split_sends);
|
||||
OPT(fixup_nomask_control_flow);
|
||||
|
||||
if (progress) {
|
||||
if (OPT(brw_fs_opt_copy_propagation, *this))
|
||||
OPT(opt_algebraic);
|
||||
OPT(brw_fs_opt_algebraic, *this);
|
||||
|
||||
/* Run after logical send lowering to give it a chance to CSE the
|
||||
* LOAD_PAYLOAD instructions created to construct the payloads of
|
||||
@@ -5740,7 +5741,7 @@ fs_visitor::optimize()
|
||||
|
||||
/* Lower 64 bit MOVs generated by payload lowering. */
|
||||
if (!devinfo->has_64bit_float || !devinfo->has_64bit_int)
|
||||
OPT(opt_algebraic);
|
||||
OPT(brw_fs_opt_algebraic, *this);
|
||||
|
||||
OPT(register_coalesce);
|
||||
OPT(lower_simd_width);
|
||||
@@ -5762,7 +5763,7 @@ fs_visitor::optimize()
|
||||
OPT(lower_regioning);
|
||||
if (progress) {
|
||||
if (OPT(brw_fs_opt_copy_propagation, *this))
|
||||
OPT(opt_algebraic);
|
||||
OPT(brw_fs_opt_algebraic, *this);
|
||||
OPT(brw_fs_opt_dead_code_eliminate, *this);
|
||||
OPT(lower_simd_width);
|
||||
}
|
||||
|
||||
@@ -267,8 +267,6 @@ public:
|
||||
void validate() {}
|
||||
#endif
|
||||
|
||||
bool opt_algebraic();
|
||||
|
||||
bool opt_split_sends();
|
||||
bool register_coalesce();
|
||||
bool eliminate_find_live_channel();
|
||||
@@ -616,6 +614,7 @@ bool brw_lower_dpas(fs_visitor &v);
|
||||
|
||||
void nir_to_brw(fs_visitor *s);
|
||||
|
||||
bool brw_fs_opt_algebraic(fs_visitor &s);
|
||||
bool brw_fs_opt_bank_conflicts(fs_visitor &s);
|
||||
bool brw_fs_opt_cmod_propagation(fs_visitor &s);
|
||||
bool brw_fs_opt_combine_constants(fs_visitor &s);
|
||||
|
||||
Reference in New Issue
Block a user