mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
intel/brw: Use references for a couple of backend_shader passes
This will allow simplify the OPT macro for fs_visitor::optimize(). 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:
parent
19b28ee44a
commit
de6a798577
7 changed files with 16 additions and 16 deletions
|
|
@ -38,11 +38,11 @@ using namespace brw;
|
|||
* - then in if/else/endif
|
||||
*/
|
||||
bool
|
||||
dead_control_flow_eliminate(backend_shader *s)
|
||||
dead_control_flow_eliminate(backend_shader &s)
|
||||
{
|
||||
bool progress = false;
|
||||
|
||||
foreach_block_safe (block, s->cfg) {
|
||||
foreach_block_safe (block, s.cfg) {
|
||||
bblock_t *prev_block = block->prev();
|
||||
|
||||
if (!prev_block)
|
||||
|
|
@ -115,7 +115,7 @@ dead_control_flow_eliminate(backend_shader *s)
|
|||
}
|
||||
|
||||
if (progress)
|
||||
s->invalidate_analysis(DEPENDENCY_BLOCKS | DEPENDENCY_INSTRUCTIONS);
|
||||
s.invalidate_analysis(DEPENDENCY_BLOCKS | DEPENDENCY_INSTRUCTIONS);
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@
|
|||
|
||||
#include "brw_shader.h"
|
||||
|
||||
bool dead_control_flow_eliminate(backend_shader *s);
|
||||
bool dead_control_flow_eliminate(backend_shader &s);
|
||||
|
||||
#endif /* BRW_DEAD_CONTROL_FLOW_H */
|
||||
|
|
|
|||
|
|
@ -5686,11 +5686,11 @@ fs_visitor::optimize()
|
|||
OPT(brw_fs_opt_algebraic, *this);
|
||||
OPT(brw_fs_opt_cse, *this);
|
||||
OPT(brw_fs_opt_copy_propagation, *this);
|
||||
OPT(opt_predicated_break, this);
|
||||
OPT(opt_predicated_break, *this);
|
||||
OPT(brw_fs_opt_cmod_propagation, *this);
|
||||
OPT(brw_fs_opt_dead_code_eliminate, *this);
|
||||
OPT(brw_fs_opt_peephole_sel, *this);
|
||||
OPT(dead_control_flow_eliminate, this);
|
||||
OPT(dead_control_flow_eliminate, *this);
|
||||
OPT(brw_fs_opt_saturate_propagation, *this);
|
||||
OPT(brw_fs_opt_register_coalesce, *this);
|
||||
OPT(brw_fs_opt_eliminate_find_live_channel, *this);
|
||||
|
|
|
|||
|
|
@ -99,12 +99,12 @@ has_continue(const struct loop_continue_tracking *s)
|
|||
}
|
||||
|
||||
bool
|
||||
opt_predicated_break(backend_shader *s)
|
||||
opt_predicated_break(backend_shader &s)
|
||||
{
|
||||
bool progress = false;
|
||||
struct loop_continue_tracking state = { {0, }, 0 };
|
||||
|
||||
foreach_block (block, s->cfg) {
|
||||
foreach_block (block, s.cfg) {
|
||||
/* DO instructions, by definition, can only be found at the beginning of
|
||||
* basic blocks.
|
||||
*/
|
||||
|
|
@ -168,7 +168,7 @@ opt_predicated_break(backend_shader *s)
|
|||
earlier_block->start()->opcode != BRW_OPCODE_DO);
|
||||
|
||||
earlier_block->unlink_children();
|
||||
earlier_block->add_successor(s->cfg->mem_ctx, jump_block,
|
||||
earlier_block->add_successor(s.cfg->mem_ctx, jump_block,
|
||||
bblock_link_logical);
|
||||
}
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ opt_predicated_break(backend_shader *s)
|
|||
}
|
||||
|
||||
if (need_to_link) {
|
||||
jump_block->add_successor(s->cfg->mem_ctx, later_block,
|
||||
jump_block->add_successor(s.cfg->mem_ctx, later_block,
|
||||
bblock_link_logical);
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +237,7 @@ opt_predicated_break(backend_shader *s)
|
|||
}
|
||||
|
||||
if (progress)
|
||||
s->invalidate_analysis(DEPENDENCY_BLOCKS | DEPENDENCY_INSTRUCTIONS);
|
||||
s.invalidate_analysis(DEPENDENCY_BLOCKS | DEPENDENCY_INSTRUCTIONS);
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ public:
|
|||
virtual void invalidate_analysis(brw::analysis_dependency_class c);
|
||||
};
|
||||
|
||||
bool opt_predicated_break(backend_shader &s);
|
||||
|
||||
#else
|
||||
struct backend_shader;
|
||||
#endif /* __cplusplus */
|
||||
|
|
@ -105,8 +107,6 @@ bool brw_saturate_immediate(enum brw_reg_type type, struct brw_reg *reg);
|
|||
bool brw_negate_immediate(enum brw_reg_type type, struct brw_reg *reg);
|
||||
bool brw_abs_immediate(enum brw_reg_type type, struct brw_reg *reg);
|
||||
|
||||
bool opt_predicated_break(struct backend_shader *s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2440,10 +2440,10 @@ vec4_visitor::run()
|
|||
pass_num = 0;
|
||||
iteration++;
|
||||
|
||||
OPT(opt_predicated_break, this);
|
||||
OPT(opt_predicated_break, *this);
|
||||
OPT(opt_reduce_swizzle);
|
||||
OPT(dead_code_eliminate);
|
||||
OPT(dead_control_flow_eliminate, this);
|
||||
OPT(dead_control_flow_eliminate, *this);
|
||||
OPT(opt_copy_propagation);
|
||||
OPT(opt_cmod_propagation);
|
||||
OPT(opt_cse);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ PredicatedBreakTest::opt_predicated_break(fs_visitor *s)
|
|||
s->cfg->dump();
|
||||
}
|
||||
|
||||
bool ret = ::opt_predicated_break(s);
|
||||
bool ret = ::opt_predicated_break(*s);
|
||||
|
||||
if (print) {
|
||||
fprintf(stderr, "\n= After =\n");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue