[Mesa-dev] [PATCH 04/11] i965/disasm: allow caller to specify output filehandle.
Mark Janes
mark.a.janes at intel.com
Fri Dec 7 00:35:45 UTC 2018
---
src/intel/compiler/brw_disasm_info.c | 28 +++++++++++------------
src/intel/compiler/brw_disasm_info.h | 2 +-
src/intel/compiler/brw_fs_generator.cpp | 2 +-
src/intel/compiler/brw_vec4_generator.cpp | 2 +-
src/intel/compiler/test_eu_validate.cpp | 2 +-
5 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/intel/compiler/brw_disasm_info.c b/src/intel/compiler/brw_disasm_info.c
index 7a9a55d83ef..21a1170b0a2 100644
--- a/src/intel/compiler/brw_disasm_info.c
+++ b/src/intel/compiler/brw_disasm_info.c
@@ -31,7 +31,7 @@ __attribute__((weak)) void nir_print_instr(UNUSED const nir_instr *instr,
UNUSED FILE *fp) {}
void
-dump_assembly(void *assembly, struct disasm_info *disasm)
+dump_assembly(FILE *fp, void *assembly, struct disasm_info *disasm)
{
const struct gen_device_info *devinfo = disasm->devinfo;
const char *last_annotation_string = NULL;
@@ -49,47 +49,47 @@ dump_assembly(void *assembly, struct disasm_info *disasm)
int end_offset = next->offset;
if (group->block_start) {
- fprintf(stderr, " START B%d", group->block_start->num);
+ fprintf(fp, " START B%d", group->block_start->num);
foreach_list_typed(struct bblock_link, predecessor_link, link,
&group->block_start->parents) {
struct bblock_t *predecessor_block = predecessor_link->block;
- fprintf(stderr, " <-B%d", predecessor_block->num);
+ fprintf(fp, " <-B%d", predecessor_block->num);
}
- fprintf(stderr, " (%u cycles)\n", group->block_start->cycle_count);
+ fprintf(fp, " (%u cycles)\n", group->block_start->cycle_count);
}
if (last_annotation_ir != group->ir) {
last_annotation_ir = group->ir;
if (last_annotation_ir) {
- fprintf(stderr, " ");
- nir_print_instr(group->ir, stderr);
- fprintf(stderr, "\n");
+ fprintf(fp, " ");
+ nir_print_instr(group->ir, fp);
+ fprintf(fp, "\n");
}
}
if (last_annotation_string != group->annotation) {
last_annotation_string = group->annotation;
if (last_annotation_string)
- fprintf(stderr, " %s\n", last_annotation_string);
+ fprintf(fp, " %s\n", last_annotation_string);
}
- brw_disassemble(devinfo, assembly, start_offset, end_offset, stderr);
+ brw_disassemble(devinfo, assembly, start_offset, end_offset, fp);
if (group->error) {
- fputs(group->error, stderr);
+ fputs(group->error, fp);
}
if (group->block_end) {
- fprintf(stderr, " END B%d", group->block_end->num);
+ fprintf(fp, " END B%d", group->block_end->num);
foreach_list_typed(struct bblock_link, successor_link, link,
&group->block_end->children) {
struct bblock_t *successor_block = successor_link->block;
- fprintf(stderr, " ->B%d", successor_block->num);
+ fprintf(fp, " ->B%d", successor_block->num);
}
- fprintf(stderr, "\n");
+ fprintf(fp, "\n");
}
}
- fprintf(stderr, "\n");
+ fprintf(fp, "\n");
}
struct disasm_info *
diff --git a/src/intel/compiler/brw_disasm_info.h b/src/intel/compiler/brw_disasm_info.h
index b8826e68175..afdc6bc24f7 100644
--- a/src/intel/compiler/brw_disasm_info.h
+++ b/src/intel/compiler/brw_disasm_info.h
@@ -65,7 +65,7 @@ struct disasm_info {
};
void
-dump_assembly(void *assembly, struct disasm_info *disasm);
+dump_assembly(FILE *fp, void *assembly, struct disasm_info *disasm);
struct disasm_info *
disasm_initialize(const struct gen_device_info *devinfo,
diff --git a/src/intel/compiler/brw_fs_generator.cpp b/src/intel/compiler/brw_fs_generator.cpp
index 08dd83dded7..ebf63b07837 100644
--- a/src/intel/compiler/brw_fs_generator.cpp
+++ b/src/intel/compiler/brw_fs_generator.cpp
@@ -2471,7 +2471,7 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
spill_count, fill_count, promoted_constants, before_size, after_size,
100.0f * (before_size - after_size) / before_size);
- dump_assembly(p->store, disasm_info);
+ dump_assembly(stderr, p->store, disasm_info);
}
ralloc_free(disasm_info);
assert(validated);
diff --git a/src/intel/compiler/brw_vec4_generator.cpp b/src/intel/compiler/brw_vec4_generator.cpp
index 888cb358fd1..ee232cbf96e 100644
--- a/src/intel/compiler/brw_vec4_generator.cpp
+++ b/src/intel/compiler/brw_vec4_generator.cpp
@@ -2206,7 +2206,7 @@ generate_code(struct brw_codegen *p,
spill_count, fill_count, before_size, after_size,
100.0f * (before_size - after_size) / before_size);
- dump_assembly(p->store, disasm_info);
+ dump_assembly(stderr, p->store, disasm_info);
}
ralloc_free(disasm_info);
assert(validated);
diff --git a/src/intel/compiler/test_eu_validate.cpp b/src/intel/compiler/test_eu_validate.cpp
index 73300b23122..307245a00cc 100644
--- a/src/intel/compiler/test_eu_validate.cpp
+++ b/src/intel/compiler/test_eu_validate.cpp
@@ -107,7 +107,7 @@ validate(struct brw_codegen *p)
p->next_insn_offset, disasm);
if (print) {
- dump_assembly(p->store, disasm);
+ dump_assembly(stderr, p->store, disasm);
}
ralloc_free(disasm);
--
2.19.2
More information about the mesa-dev
mailing list