[Mesa-dev] [PATCH 3/7] intel/tools: Use brw_disassemble_prog in gen_disasm_disassemble

Jordan Justen jordan.l.justen at intel.com
Tue Jan 10 01:22:14 UTC 2017


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/intel/tools/disasm.c | 53 +++++-------------------------------------------
 1 file changed, 5 insertions(+), 48 deletions(-)

diff --git a/src/intel/tools/disasm.c b/src/intel/tools/disasm.c
index 4ac7b902564..af914243750 100644
--- a/src/intel/tools/disasm.c
+++ b/src/intel/tools/disasm.c
@@ -35,60 +35,17 @@ struct gen_disasm {
     struct gen_device_info devinfo;
 };
 
-static bool
-is_send(uint32_t opcode)
-{
-   return (opcode == BRW_OPCODE_SEND  ||
-           opcode == BRW_OPCODE_SENDC ||
-           opcode == BRW_OPCODE_SENDS ||
-           opcode == BRW_OPCODE_SENDSC );
-}
-
 void
 gen_disasm_disassemble(struct gen_disasm *disasm, void *assembly,
                        int start, FILE *out)
 {
    struct gen_device_info *devinfo = &disasm->devinfo;
-   bool dump_hex = false;
-   int offset = start;
-
-   /* This loop exits when send-with-EOT or when opcode is 0 */
-   while (true) {
-      brw_inst *insn = assembly + offset;
-      brw_inst uncompacted;
-      bool compacted = brw_inst_cmpt_control(devinfo, insn);
-      if (0)
-         fprintf(out, "0x%08x: ", offset);
-
-      if (compacted) {
-         brw_compact_inst *compacted = (void *)insn;
-         if (dump_hex) {
-            fprintf(out, "0x%08x 0x%08x                       ",
-                   ((uint32_t *)insn)[1],
-                   ((uint32_t *)insn)[0]);
-         }
-
-         brw_uncompact_instruction(devinfo, &uncompacted, compacted);
-         insn = &uncompacted;
-         offset += 8;
-      } else {
-         if (dump_hex) {
-            fprintf(out, "0x%08x 0x%08x 0x%08x 0x%08x ",
-                   ((uint32_t *)insn)[3],
-                   ((uint32_t *)insn)[2],
-                   ((uint32_t *)insn)[1],
-                   ((uint32_t *)insn)[0]);
-         }
-         offset += 16;
-      }
-
-      brw_disassemble_inst(out, devinfo, insn, compacted);
+   char *prog_disasm;
 
-      /* Simplistic, but efficient way to terminate disasm */
-      uint32_t opcode = brw_inst_opcode(devinfo, insn);
-      if (opcode == 0 || (is_send(opcode) && brw_inst_eot(devinfo, insn))) {
-         break;
-      }
+   brw_disassemble_prog(&prog_disasm, devinfo, assembly, start);
+   if (prog_disasm) {
+      fputs(prog_disasm, out);
+      free(prog_disasm);
    }
 }
 
-- 
2.11.0



More information about the mesa-dev mailing list