Mesa (master): ilo: simplify src operand gathering in disassembler

Chia-I Wu olv at kemper.freedesktop.org
Sat Sep 13 16:31:54 UTC 2014


Module: Mesa
Branch: master
Commit: 8fcf1b1f90901d59bf4cca0e04aa84d2c55de9ed
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8fcf1b1f90901d59bf4cca0e04aa84d2c55de9ed

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Sat Sep 13 22:15:46 2014 +0800

ilo: simplify src operand gathering in disassembler

Always initialize the operand array to point to src0, src1, and src2.

Signed-off-by: Chia-I Wu <olvaffe at gmail.com>

---

 .../drivers/ilo/shader/toy_compiler_disasm.c       |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c b/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
index 7c1c32e..e9cd187 100644
--- a/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
+++ b/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
@@ -1375,23 +1375,13 @@ disasm_printer_print_inst(struct disasm_printer *printer,
       }
    } else {
       const int src_count = disasm_opcode_table[inst->opcode].src_count;
-      const struct disasm_src_operand *src[3];
-      int i;
-
-      /* get src operands */
-      switch (src_count) {
-      case 3:
-         src[2] = &inst->u.src2;
-      case 2:
-         src[1] = &inst->src1;
-      case 1:
-         src[0] = &inst->src0;
-      case 0:
-      default:
-         break;
-      }
 
       if (src_count) {
+         const struct disasm_src_operand *src[3] = {
+            &inst->src0, &inst->src1, &inst->u.src2
+         };
+         int i;
+
          disasm_printer_column(printer, col++);
          disasm_printer_add_dst(printer, inst, &inst->dst);
 




More information about the mesa-commit mailing list