intel/disasm: Label support in shader disassembly for UIP/JIP

Shader instructions which use UIP/JIP now get formatted with a label
in addition with immediate value, labels have "LABEL%d" format.

v2: - Consider brw_jump_scale when calculating label's offset

From: "Lonnberg, Toni" <toni.lonnberg@intel.com>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4245>
This commit is contained in:
Danylo Piliaiev
2019-06-03 14:55:23 +03:00
committed by Marge Bot
parent 6cbd4764cd
commit bc4a127d6e
18 changed files with 157 additions and 40 deletions

View File

@@ -31,13 +31,17 @@ __attribute__((weak)) void nir_print_instr(UNUSED const nir_instr *instr,
UNUSED FILE *fp) {}
void
dump_assembly(void *assembly, struct disasm_info *disasm,
const unsigned *block_latency)
dump_assembly(void *assembly, int start_offset, int end_offset,
struct disasm_info *disasm, const unsigned *block_latency)
{
const struct gen_device_info *devinfo = disasm->devinfo;
const char *last_annotation_string = NULL;
const void *last_annotation_ir = NULL;
void *mem_ctx = ralloc_context(NULL);
const struct brw_label *root_label =
brw_label_assembly(devinfo, assembly, start_offset, end_offset, mem_ctx);
foreach_list_typed(struct inst_group, group, link, &disasm->group_list) {
struct exec_node *next_node = exec_node_get_next(&group->link);
if (exec_node_is_tail_sentinel(next_node))
@@ -77,7 +81,8 @@ dump_assembly(void *assembly, struct disasm_info *disasm,
fprintf(stderr, " %s\n", last_annotation_string);
}
brw_disassemble(devinfo, assembly, start_offset, end_offset, stderr);
brw_disassemble(devinfo, assembly, start_offset, end_offset,
root_label, stderr);
if (group->error) {
fputs(group->error, stderr);
@@ -94,6 +99,8 @@ dump_assembly(void *assembly, struct disasm_info *disasm,
}
}
fprintf(stderr, "\n");
ralloc_free(mem_ctx);
}
struct disasm_info *