intel/brw: Remove overloads for brw_print_instruction/s functions

Almost all cases now handled with default arguments.  The only real
extra work that was being done was pushed to the client code in
debug_optimizer().

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32596>
This commit is contained in:
Caio Oliveira 2024-12-07 09:53:31 -08:00 committed by Marge Bot
parent 41076b2a55
commit c8f6d8154f
4 changed files with 20 additions and 28 deletions

View file

@ -1382,7 +1382,19 @@ fs_visitor::debug_optimizer(const nir_shader *nir,
iteration, pass_num, pass_name);
if (ret == -1)
return;
brw_print_instructions(*this, filename);
FILE *file = stderr;
if (__normal_user()) {
file = fopen(filename, "w");
if (!file)
file = stderr;
}
brw_print_instructions(*this, file);
if (file != stderr)
fclose(file);
free(filename);
}

View file

@ -464,14 +464,11 @@ public:
int iteration, int pass_num) const;
};
void brw_print_instruction_to_file(const fs_visitor &s, const fs_inst *inst, FILE *file, const brw::def_analysis *defs);
void brw_print_instructions_to_file(const fs_visitor &s, FILE *file);
void brw_print_instructions(const fs_visitor &s, FILE *file = stderr);
/* Convenience functions based on the above. */
inline void brw_print_instruction(const fs_visitor &s, const fs_inst *inst, FILE *file = stderr, const brw::def_analysis *defs = nullptr) {
brw_print_instruction_to_file(s, inst, file, defs);
}
void brw_print_instructions(const fs_visitor &s, const char *name = nullptr);
void brw_print_instruction(const fs_visitor &s, const fs_inst *inst,
FILE *file = stderr,
const brw::def_analysis *defs = nullptr);
void brw_print_swsb(FILE *f, const struct intel_device_info *devinfo, const tgl_swsb swsb);

View file

@ -1272,7 +1272,7 @@ brw_assign_regs(fs_visitor &s, bool allow_spilling, bool spill_all)
bool success = alloc.assign_regs(allow_spilling, spill_all);
if (!success && allow_spilling) {
s.fail("no register to spill:\n");
brw_print_instructions(s, NULL);
brw_print_instructions(s);
}
return success;
}

View file

@ -13,7 +13,7 @@
using namespace brw;
void
brw_print_instructions_to_file(const fs_visitor &s, FILE *file)
brw_print_instructions(const fs_visitor &s, FILE *file)
{
if (s.cfg && s.grf_used == 0) {
const brw::def_analysis &defs = s.def_analysis.require();
@ -70,23 +70,6 @@ brw_print_instructions_to_file(const fs_visitor &s, FILE *file)
}
}
void
brw_print_instructions(const fs_visitor &s, const char *name)
{
FILE *file = stderr;
if (name && __normal_user()) {
file = fopen(name, "w");
if (!file)
file = stderr;
}
brw_print_instructions_to_file(s, file);
if (file != stderr) {
fclose(file);
}
}
static const char *
brw_instruction_name(const struct brw_isa_info *isa, enum opcode op)
{
@ -384,7 +367,7 @@ print_memory_logical_source(FILE *file, const fs_inst *inst, unsigned i)
}
void
brw_print_instruction_to_file(const fs_visitor &s, const fs_inst *inst, FILE *file, const brw::def_analysis *defs)
brw_print_instruction(const fs_visitor &s, const fs_inst *inst, FILE *file, const brw::def_analysis *defs)
{
if (inst->predicate) {
fprintf(file, "(%cf%d.%d) ",