mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-24 13:40:37 +02:00
intel/brw: Move dump_* functions into fs_visitor
Make them non-virtual and update the parameter to use fs_inst. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27861>
This commit is contained in:
parent
20dfee69c3
commit
f3e9a5c719
5 changed files with 30 additions and 54 deletions
|
|
@ -157,10 +157,10 @@ bblock_t::combine_with(bblock_t *that)
|
|||
void
|
||||
bblock_t::dump(FILE *file) const
|
||||
{
|
||||
const backend_shader *s = this->cfg->s;
|
||||
const fs_visitor *s = static_cast<const fs_visitor *>(this->cfg->s);
|
||||
|
||||
int ip = this->start_ip;
|
||||
foreach_inst_in_block(backend_instruction, inst, this) {
|
||||
foreach_inst_in_block(fs_inst, inst, this) {
|
||||
fprintf(file, "%5d: ", ip);
|
||||
s->dump_instruction(inst, file);
|
||||
ip++;
|
||||
|
|
|
|||
|
|
@ -2144,7 +2144,7 @@ fs_visitor::dump_instructions_to_file(FILE *file) const
|
|||
const register_pressure &rp = regpressure_analysis.require();
|
||||
unsigned ip = 0, max_pressure = 0;
|
||||
unsigned cf_count = 0;
|
||||
foreach_block_and_inst(block, backend_instruction, inst, cfg) {
|
||||
foreach_block_and_inst(block, fs_inst, inst, cfg) {
|
||||
if (inst->is_control_flow_end())
|
||||
cf_count -= 1;
|
||||
|
||||
|
|
@ -2161,7 +2161,7 @@ fs_visitor::dump_instructions_to_file(FILE *file) const
|
|||
fprintf(file, "Maximum %3d registers live at once.\n", max_pressure);
|
||||
} else {
|
||||
int ip = 0;
|
||||
foreach_in_list(backend_instruction, inst, &instructions) {
|
||||
foreach_in_list(fs_inst, inst, &instructions) {
|
||||
fprintf(file, "%4d: ", ip++);
|
||||
dump_instruction(inst, file);
|
||||
}
|
||||
|
|
@ -2169,10 +2169,25 @@ fs_visitor::dump_instructions_to_file(FILE *file) const
|
|||
}
|
||||
|
||||
void
|
||||
fs_visitor::dump_instruction_to_file(const backend_instruction *be_inst, FILE *file) const
|
||||
fs_visitor::dump_instructions(const char *name) const
|
||||
{
|
||||
const fs_inst *inst = (const fs_inst *)be_inst;
|
||||
FILE *file = stderr;
|
||||
if (name && __normal_user()) {
|
||||
file = fopen(name, "w");
|
||||
if (!file)
|
||||
file = stderr;
|
||||
}
|
||||
|
||||
dump_instructions_to_file(file);
|
||||
|
||||
if (file != stderr) {
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fs_visitor::dump_instruction_to_file(const fs_inst *inst, FILE *file) const
|
||||
{
|
||||
if (inst->predicate) {
|
||||
fprintf(file, "(%cf%d.%d) ",
|
||||
inst->predicate_inverse ? '-' : '+',
|
||||
|
|
|
|||
|
|
@ -288,8 +288,15 @@ public:
|
|||
fs_reg per_primitive_reg(const brw::fs_builder &bld,
|
||||
int location, unsigned comp);
|
||||
|
||||
virtual void dump_instruction_to_file(const backend_instruction *inst, FILE *file) const;
|
||||
virtual void dump_instructions_to_file(FILE *file) const;
|
||||
void dump_instruction_to_file(const fs_inst *inst, FILE *file) const;
|
||||
void dump_instructions_to_file(FILE *file) const;
|
||||
|
||||
/* Convenience functions based on the above. */
|
||||
void dump_instruction(const fs_inst *inst, FILE *file = stderr) const {
|
||||
dump_instruction_to_file(inst, file);
|
||||
}
|
||||
void dump_instructions(const char *name = nullptr) const;
|
||||
|
||||
void calculate_cfg();
|
||||
|
||||
const brw_base_prog_key *const key;
|
||||
|
|
|
|||
|
|
@ -1108,43 +1108,6 @@ backend_instruction::remove(bblock_t *block, bool defer_later_block_ip_updates)
|
|||
exec_node::remove();
|
||||
}
|
||||
|
||||
void
|
||||
backend_shader::dump_instructions(const char *name) const
|
||||
{
|
||||
FILE *file = stderr;
|
||||
if (name && __normal_user()) {
|
||||
file = fopen(name, "w");
|
||||
if (!file)
|
||||
file = stderr;
|
||||
}
|
||||
|
||||
dump_instructions_to_file(file);
|
||||
|
||||
if (file != stderr) {
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
backend_shader::dump_instructions_to_file(FILE *file) const
|
||||
{
|
||||
if (cfg) {
|
||||
int ip = 0;
|
||||
foreach_block_and_inst(block, backend_instruction, inst, cfg) {
|
||||
if (!INTEL_DEBUG(DEBUG_OPTIMIZER))
|
||||
fprintf(file, "%4d: ", ip++);
|
||||
dump_instruction(inst, file);
|
||||
}
|
||||
} else {
|
||||
int ip = 0;
|
||||
foreach_in_list(backend_instruction, inst, &instructions) {
|
||||
if (!INTEL_DEBUG(DEBUG_OPTIMIZER))
|
||||
fprintf(file, "%4d: ", ip++);
|
||||
dump_instruction(inst, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
backend_shader::invalidate_analysis(brw::analysis_dependency_class c)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,15 +78,6 @@ public:
|
|||
|
||||
brw::simple_allocator alloc;
|
||||
|
||||
virtual void dump_instruction_to_file(const backend_instruction *inst, FILE *file) const = 0;
|
||||
virtual void dump_instructions_to_file(FILE *file) const;
|
||||
|
||||
/* Convenience functions based on the above. */
|
||||
void dump_instruction(const backend_instruction *inst, FILE *file = stderr) const {
|
||||
dump_instruction_to_file(inst, file);
|
||||
}
|
||||
void dump_instructions(const char *name = nullptr) const;
|
||||
|
||||
virtual void invalidate_analysis(brw::analysis_dependency_class c);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue