diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index cb82f42acee..d437f0db08a 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -5687,7 +5687,7 @@ fs_visitor::optimize() OPT(brw_fs_opt_peephole_sel, *this); OPT(dead_control_flow_eliminate, this); OPT(brw_fs_opt_saturate_propagation, *this); - OPT(register_coalesce); + OPT(brw_fs_opt_register_coalesce, *this); OPT(brw_fs_opt_eliminate_find_live_channel, *this); OPT(brw_fs_opt_compact_virtual_grfs, *this); @@ -5697,7 +5697,7 @@ fs_visitor::optimize() pass_num = 0; if (OPT(lower_pack)) { - OPT(register_coalesce); + OPT(brw_fs_opt_register_coalesce, *this); OPT(brw_fs_opt_dead_code_eliminate, *this); } @@ -5729,7 +5729,7 @@ fs_visitor::optimize() * whole logical instruction. */ OPT(brw_fs_opt_cse, *this); - OPT(register_coalesce); + OPT(brw_fs_opt_register_coalesce, *this); OPT(brw_fs_opt_dead_code_eliminate, *this); OPT(brw_fs_opt_peephole_sel, *this); } @@ -5743,7 +5743,7 @@ fs_visitor::optimize() if (!devinfo->has_64bit_float || !devinfo->has_64bit_int) OPT(brw_fs_opt_algebraic, *this); - OPT(register_coalesce); + OPT(brw_fs_opt_register_coalesce, *this); OPT(lower_simd_width); OPT(brw_fs_opt_dead_code_eliminate, *this); } diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h index b01e21dd35e..0a31738915e 100644 --- a/src/intel/compiler/brw_fs.h +++ b/src/intel/compiler/brw_fs.h @@ -265,8 +265,6 @@ public: void validate() {} #endif - bool register_coalesce(); - fs_instruction_scheduler *prepare_scheduler(void *mem_ctx); void schedule_instructions_pre_ra(fs_instruction_scheduler *sched, instruction_scheduler_mode mode); @@ -618,6 +616,7 @@ bool brw_fs_opt_cse(fs_visitor &s); bool brw_fs_opt_dead_code_eliminate(fs_visitor &s); bool brw_fs_opt_eliminate_find_live_channel(fs_visitor &s); bool brw_fs_opt_peephole_sel(fs_visitor &s); +bool brw_fs_opt_register_coalesce(fs_visitor &s); bool brw_fs_opt_remove_extra_rounding_modes(fs_visitor &s); bool brw_fs_opt_remove_redundant_halts(fs_visitor &s); bool brw_fs_opt_saturate_propagation(fs_visitor &s); diff --git a/src/intel/compiler/brw_fs_register_coalesce.cpp b/src/intel/compiler/brw_fs_register_coalesce.cpp index 4c9bb3edba8..5972ae37ede 100644 --- a/src/intel/compiler/brw_fs_register_coalesce.cpp +++ b/src/intel/compiler/brw_fs_register_coalesce.cpp @@ -189,10 +189,12 @@ can_coalesce_vars(const fs_live_variables &live, const cfg_t *cfg, } bool -fs_visitor::register_coalesce() +brw_fs_opt_register_coalesce(fs_visitor &s) { + const intel_device_info *devinfo = s.devinfo; + bool progress = false; - fs_live_variables &live = live_analysis.require(); + fs_live_variables &live = s.live_analysis.require(); int src_size = 0; int channels_remaining = 0; unsigned src_reg = ~0u, dst_reg = ~0u; @@ -201,8 +203,8 @@ fs_visitor::register_coalesce() int *dst_var = new int[MAX_VGRF_SIZE(devinfo)]; int *src_var = new int[MAX_VGRF_SIZE(devinfo)]; - foreach_block_and_inst(block, fs_inst, inst, cfg) { - if (!is_coalesce_candidate(this, inst)) + foreach_block_and_inst(block, fs_inst, inst, s.cfg) { + if (!is_coalesce_candidate(&s, inst)) continue; if (is_nop_mov(inst)) { @@ -214,7 +216,7 @@ fs_visitor::register_coalesce() if (src_reg != inst->src[0].nr) { src_reg = inst->src[0].nr; - src_size = alloc.sizes[inst->src[0].nr]; + src_size = s.alloc.sizes[inst->src[0].nr]; assert(src_size <= MAX_VGRF_SIZE(devinfo)); channels_remaining = src_size; @@ -265,7 +267,7 @@ fs_visitor::register_coalesce() dst_var[i] = live.var_from_vgrf[dst_reg] + dst_reg_offset[i]; src_var[i] = live.var_from_vgrf[src_reg] + i; - if (!can_coalesce_vars(live, cfg, block, inst, dst_var[i], src_var[i])) { + if (!can_coalesce_vars(live, s.cfg, block, inst, dst_var[i], src_var[i])) { can_coalesce = false; src_reg = ~0u; break; @@ -301,7 +303,7 @@ fs_visitor::register_coalesce() } } - foreach_block_and_inst(block, fs_inst, scan_inst, cfg) { + foreach_block_and_inst(block, fs_inst, scan_inst, s.cfg) { if (scan_inst->dst.file == VGRF && scan_inst->dst.nr == src_reg) { scan_inst->dst.nr = dst_reg; @@ -329,15 +331,15 @@ fs_visitor::register_coalesce() } if (progress) { - foreach_block_and_inst_safe (block, backend_instruction, inst, cfg) { + foreach_block_and_inst_safe (block, backend_instruction, inst, s.cfg) { if (inst->opcode == BRW_OPCODE_NOP) { inst->remove(block, true); } } - cfg->adjust_block_ips(); + s.cfg->adjust_block_ips(); - invalidate_analysis(DEPENDENCY_INSTRUCTIONS); + s.invalidate_analysis(DEPENDENCY_INSTRUCTIONS); } delete[] src_var;