i965: Fix register types in dump_instructions().
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 5 Feb 2014 21:27:15 +0000 (13:27 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 6 Feb 2014 05:07:48 +0000 (21:07 -0800)
This regressed when I converted BRW_REGISTER_TYPE_* to be an abstract
type that doesn't match the hardware description.  dump_instruction()
was using reg_encoding[] from brw_disasm.c, which no longer matches
(and was incorrect for Gen8+ anyway).

This patch introduces a new function to convert the abstract enum values
into the letter suffix we expect.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reported-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_eu.c
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_reg.h
src/mesa/drivers/dri/i965/brw_vec4.cpp

index dee91123ff39c2ce96d21e5a5d2d3cba67d3b0a7..bb840291f25e71889c210894627f3974a8d5df87 100644 (file)
 
 #include "glsl/ralloc.h"
 
+/**
+ * Converts a BRW_REGISTER_TYPE_* enum to a short string (F, UD, and so on).
+ *
+ * This is different than reg_encoding from brw_disasm.c in that it operates
+ * on the abstract enum values, rather than the generation-specific encoding.
+ */
+const char *
+brw_reg_type_letters(unsigned type)
+{
+   const char *names[] = {
+      [BRW_REGISTER_TYPE_UD] = "UD",
+      [BRW_REGISTER_TYPE_D]  = "D",
+      [BRW_REGISTER_TYPE_UW] = "UW",
+      [BRW_REGISTER_TYPE_W]  = "W",
+      [BRW_REGISTER_TYPE_F]  = "F",
+      [BRW_REGISTER_TYPE_UB] = "UB",
+      [BRW_REGISTER_TYPE_B]  = "B",
+      [BRW_REGISTER_TYPE_UV] = "UV",
+      [BRW_REGISTER_TYPE_V]  = "V",
+      [BRW_REGISTER_TYPE_VF] = "VF",
+      [BRW_REGISTER_TYPE_DF] = "DF",
+      [BRW_REGISTER_TYPE_HF] = "HF",
+      [BRW_REGISTER_TYPE_UQ] = "UQ",
+      [BRW_REGISTER_TYPE_Q]  = "Q",
+   };
+   assert(type <= BRW_REGISTER_TYPE_UQ);
+   return names[type];
+}
+
 /* Returns the corresponding conditional mod for swapping src0 and
  * src1 in e.g. CMP.
  */
index 533882241443dbe275a041b184570570a9cc2c00..c290c28c47c79f73de0876f00a0dafec2c7a368b 100644 (file)
@@ -3127,7 +3127,7 @@ fs_visitor::dump_instruction(backend_instruction *be_inst)
          printf("|");
 
       if (inst->src[i].file != IMM) {
-         printf(":%s", reg_encoding[inst->src[i].type]);
+         printf(":%s", brw_reg_type_letters(inst->src[i].type));
       }
 
       if (i < 2 && inst->src[i + 1].file != BAD_FILE)
index 9673210666ee24b696041389e406b6f68a5fd0e4..978dd3f382b354b1a33a5bcb5f39653e2baef3c7 100644 (file)
@@ -116,6 +116,7 @@ enum brw_reg_type {
 
 unsigned brw_reg_type_to_hw_type(const struct brw_context *brw,
                                  enum brw_reg_type type, unsigned file);
+const char *brw_reg_type_letters(unsigned brw_reg_type);
 
 #define REG_SIZE (8*4)
 
index d566ea16246e8ce8d54174ea3233aea3b9fbad01..920508118b46a621a6bd05b80c2a6fb2bdb7f169 100644 (file)
@@ -1168,7 +1168,7 @@ vec4_visitor::dump_instruction(backend_instruction *be_inst)
       if (inst->dst.writemask & 8)
          printf("w");
    }
-   printf(":%s, ", reg_encoding[inst->dst.type]);
+   printf(":%s, ", brw_reg_type_letters(inst->dst.type));
 
    for (int i = 0; i < 3 && inst->src[i].file != BAD_FILE; i++) {
       if (inst->src[i].negate)