[Mesa-dev] [PATCH 07/10] i965/disasm: Immediate values as legible numbers

Toni Lönnberg toni.lonnberg at intel.com
Mon Feb 20 13:27:47 UTC 2017


From: "Lonnberg, Toni" <toni.lonnberg at intel.com>

If the "disasm" flag is used in the INTEL_DEBUG debug flags, as all immediate
values will be output as hexadecimals, the values are not easily understood
when just looking at the disassembly so now the values are output in a legible
format as a comment field after the instruction.
---
 src/mesa/drivers/dri/i965/brw_disasm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c
index 1bae2cd..44ada00 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -1802,7 +1802,19 @@ brw_disassemble_inst(FILE *file, const struct gen_device_info *devinfo,
             format(file, " exdesc len %"PRIu64, brw_inst_sends_exdesc_len(devinfo, inst));
          }
       }
+   } else {
+      if (brw_inst_src0_reg_file(devinfo, inst) == BRW_IMMEDIATE_VALUE) {
+         if (brw_inst_src0_reg_type(devinfo, inst) == BRW_HW_REG_TYPE_F) {
+            fprintf(file, " // %-g", brw_inst_imm_f(devinfo, inst));
+         } else if (brw_inst_src0_reg_type(devinfo, inst) == GEN8_HW_REG_IMM_TYPE_DF) {
+            fprintf(file, " // %-g", brw_inst_imm_df(devinfo, inst));
+         }
+      } else if (brw_inst_src1_reg_file(devinfo, inst) == BRW_IMMEDIATE_VALUE &&
+         brw_inst_src1_reg_type(devinfo, inst) == BRW_HW_REG_TYPE_F) {
+         fprintf(file, " // %-g", brw_inst_imm_f(devinfo, inst));
+      }
    }
+
    newline(file);
    return err;
 }
-- 
2.7.4



More information about the mesa-dev mailing list