[opcodes/ChangeLog]
authorChris Demetriou <cgd@google.com>
Tue, 23 Oct 2001 19:20:28 +0000 (19:20 +0000)
committerChris Demetriou <cgd@google.com>
Tue, 23 Oct 2001 19:20:28 +0000 (19:20 +0000)
2001-10-21  Chris Demetriou  <cgd@broadcom.com>

        * mips-opc.c (mips_builtin_opcodes): Mark "bgezall" and
        "bltzall" as writing GPR 31 (since they do).

        * mips-dis.c (print_insn_arg): Calculate info->target
        where appropriate.
        (print_insn_mips): Fill in instruction info.
        (print_mips16_insn_arg): Remove unneded variable 'val'.
        Removed duplicated instruction target calculations,
        calculate once and print that result.  Use same idiom for
        masking the jump segment bits as is used in print_insn_arg.

[gas/testsuite/ChangeLog]

2001-10-21  Chris Demetriou  <cgd@broadcom.com>

        * gas/mips/beq.s: Add zero words at end of instructions so
        that objdump will print "..." when disassembling.
        * gas/mips/beq.d: Update for disassembler changes which force
        branch delay-slot nops to be printed.
        * gas/mips/bge.d: Ditto.
        * gas/mips/bgeu.d: Ditto.
        * gas/mips/blt.d: Ditto.
        * gas/mips/bltu.d: Ditto.
        * gas/mips/jal-svr4pic.d: Ditto.
        * gas/mips/jal-xgot.d: Ditto.

12 files changed:
gas/testsuite/ChangeLog
gas/testsuite/gas/mips/beq.d
gas/testsuite/gas/mips/beq.s
gas/testsuite/gas/mips/bge.d
gas/testsuite/gas/mips/bgeu.d
gas/testsuite/gas/mips/blt.d
gas/testsuite/gas/mips/bltu.d
gas/testsuite/gas/mips/jal-svr4pic.d
gas/testsuite/gas/mips/jal-xgot.d
opcodes/ChangeLog
opcodes/mips-dis.c
opcodes/mips-opc.c

index bb4b5f8a1d13eb848c756dc9a82d50ae2b74a12e..b7048f5aef83dce28e0b2da52c266273bd62d8c8 100644 (file)
@@ -1,3 +1,16 @@
+2001-10-23  Chris Demetriou  <cgd@broadcom.com>
+
+       * gas/mips/beq.s: Add zero words at end of instructions so
+       that objdump will print "..." when disassembling.
+       * gas/mips/beq.d: Update for disassembler changes which force
+       branch delay-slot nops to be printed.
+       * gas/mips/bge.d: Ditto.
+       * gas/mips/bgeu.d: Ditto.
+       * gas/mips/blt.d: Ditto.
+       * gas/mips/bltu.d: Ditto.
+       * gas/mips/jal-svr4pic.d: Ditto.
+       * gas/mips/jal-xgot.d: Ditto.
+
 2001-10-20  H.J. Lu  <hjl@gnu.org>
 
        * gas/elf/ehopt0.s: Lose ",@progbits".
index 9eb24345e4ce86ba1d4541dd091571d8aec8bcd3..2a8abd5ad8087262ff118fe68756c05d86f43654 100644 (file)
@@ -31,6 +31,7 @@ Disassembly of section .text:
 0+0058 <[^>]*> beqzl   a0,0+0000 <text_label>
 0+005c <[^>]*> nop
 0+0060 <[^>]*> bnezl   a0,0+0000 <text_label>
+0+0064 <[^>]*> nop
        ...
 0+20068 <[^>]*> j      0+0000 <text_label>
 [      ]*20068: (MIPS_JMP|JMPADDR|R_MIPS_26)   .text
@@ -43,4 +44,5 @@ Disassembly of section .text:
 0+2007c <[^>]*> nop
 0+20080 <[^>]*> bal    0+20080 <text_label\+0x20080>
 [      ]*20080: R_MIPS_PC16    external_label
+0+20084 <[^>]*> nop
        ...
index 5567f02103408d5b7f70cf0034f41fca31b6fd05..b653cd0497c21e0c83204adcef85abb652f94a09 100644 (file)
@@ -26,5 +26,5 @@ text_label:
        b       external_label
        bal     external_label
 
-# Round to a 16 byte boundary, for ease in testing multiple targets.
-       nop
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .space  8
index 8ade2ad6143d48a2ba8cbcde99f5f6370f1b8f75..26952deff8edb7925ae5ce8efebfb46f5ea792ae 100644 (file)
@@ -66,4 +66,5 @@ Disassembly of section .text:
 0+00d8 <[^>]*> slt     at,a1,a0
 0+00dc <[^>]*> bnezl   at,000000dc <text_label\+0xdc>
 [      ]*dc: R_MIPS_PC16       external_label
+0+00e0 <[^>]*> nop
        ...
index 49d11303ca41c3e40736dc5b9521c9c65ee3b48a..ace226e9eb406861728e372b95293e3b58b17cf6 100644 (file)
@@ -60,4 +60,5 @@ Disassembly of section .text:
 0+00c0 <[^>]*> sltu    at,a1,a0
 0+00c4 <[^>]*> bnezl   at,000000c4 <text_label\+0xc4>
 [      ]*c4: R_MIPS_PC16       external_label
+0+00c8 <[^>]*> nop
        ...
index d7670c0fdd33247ea53a049084af386d263f120c..fdc7c4ba38ec33496df71817ad7f972d2759caea 100644 (file)
@@ -66,4 +66,5 @@ Disassembly of section .text:
 0+00d8 <[^>]*> slt     at,a1,a0
 0+00dc <[^>]*> beqzl   at,000000dc <text_label\+0xdc>
 [      ]*dc: R_MIPS_PC16       external_label
+0+00e0 <[^>]*> nop
        ...
index 0e2a644fc43c3904688884fa893cb2c7c1486b51..f6fbfbb2aee2cc41548d9228f922e0be2189b748 100644 (file)
@@ -60,4 +60,5 @@ Disassembly of section .text:
 0+00c0 <[^>]*> sltu    at,a1,a0
 0+00c4 <[^>]*> beqzl   at,000000c4 <text_label\+0xc4>
 [      ]*c4: R_MIPS_PC16       external_label
+0+00c8 <[^>]*> nop
        ...
index 5dc94c284a3624d120d46588365f7fa67ffb088f..72eda5b2708d86cdc31da232781e07d6d5405580 100644 (file)
@@ -43,4 +43,5 @@ Disassembly of section .text:
 0+006c <[^>]*> nop
 0+0070 <[^>]*> lw      gp,0\(sp\)
 0+0074 <[^>]*> b       0+0000 <text_label>
+0+0078 <[^>]*> nop
        ...
index 8792c9b8c6c5dbfe51dee07e8cffffc35471f82e..2f320d62a2fbd439a5b1ee524e80e6217860a5bb 100644 (file)
@@ -48,4 +48,5 @@ Disassembly of section .text:
 0+0074 <[^>]*> nop
 0+0078 <[^>]*> lw      gp,0\(sp\)
 0+007c <[^>]*> b       0+0000 <text_label>
+0+0080 <[^>]*> nop
        ...
index 5a474399a2c6235d0b4ee599c28c1d3d2b58e7a0..b211d385c3bcd8724f273e34d324c755cf8dcb3f 100644 (file)
@@ -1,3 +1,16 @@
+2001-10-23  Chris Demetriou  <cgd@broadcom.com>
+
+       * mips-opc.c (mips_builtin_opcodes): Mark "bgezall" and
+       "bltzall" as writing GPR 31 (since they do).
+
+       * mips-dis.c (print_insn_arg): Calculate info->target
+       where appropriate.
+       (print_insn_mips): Fill in instruction info.
+       (print_mips16_insn_arg): Remove unneded variable 'val'.
+       Removed duplicated instruction target calculations,
+       calculate once and print that result.  Use same idiom for
+       masking the jump segment bits as is used in print_insn_arg.
+
 2001-10-20  Alan Modra  <amodra@bigpond.net.au>
 
        * ppc-opc.c (CT): Make it an optional operand.
index a11e1c00434bf2989a57788caa1cda61711e8d2b..feb9d946861d4649cdf443e6359d592dcf03f14d 100644 (file)
@@ -155,10 +155,9 @@ print_insn_arg (d, l, pc, info)
       break;
 
     case 'a':
-      (*info->print_address_func)
-       ((((pc + 4) & ~(bfd_vma) 0x0fffffff)
-         | (((l >> OP_SH_TARGET) & OP_MASK_TARGET) << 2)),
-        info);
+      info->target = (((pc + 4) & ~(bfd_vma) 0x0fffffff)
+                     | (((l >> OP_SH_TARGET) & OP_MASK_TARGET) << 2));
+      (*info->print_address_func) (info->target, info);
       break;
 
     case 'p':
@@ -166,9 +165,8 @@ print_insn_arg (d, l, pc, info)
       delta = (l >> OP_SH_DELTA) & OP_MASK_DELTA;
       if (delta & 0x8000)
        delta |= ~0xffff;
-      (*info->print_address_func)
-       ((delta << 2) + pc + INSNLEN,
-        info);
+      info->target = (delta << 2) + pc + INSNLEN;
+      (*info->print_address_func) (info->target, info);
       break;
 
     case 'd':
@@ -457,6 +455,12 @@ print_insn_mips (memaddr, word, info)
 
   info->bytes_per_chunk = INSNLEN;
   info->display_endian = info->endian;
+  info->insn_info_valid = 1;
+  info->branch_delay_insns = 0;
+  info->data_size = 0;      
+  info->insn_type = dis_nonbranch;
+  info->target = 0;
+  info->target2 = 0;
 
   op = mips_hash[(word >> OP_SH_OP) & OP_MASK_OP];
   if (op != NULL)
@@ -470,6 +474,28 @@ print_insn_mips (memaddr, word, info)
              if (! OPCODE_IS_MEMBER (op, mips_isa, target_processor))
                continue;
 
+             /* Figure out instruction type and branch delay information.  */
+             if ((op->pinfo & INSN_UNCOND_BRANCH_DELAY) != 0)
+               {
+                 if ((info->insn_type & INSN_WRITE_GPR_31) != 0)
+                   info->insn_type = dis_jsr;
+                 else
+                   info->insn_type = dis_branch;
+                 info->branch_delay_insns = 1;
+               }
+             else if ((op->pinfo & (INSN_COND_BRANCH_DELAY
+                                    | INSN_COND_BRANCH_LIKELY)) != 0)
+               {
+                 if ((info->insn_type & INSN_WRITE_GPR_31) != 0)
+                   info->insn_type = dis_condjsr;
+                 else
+                   info->insn_type = dis_condbranch;
+                 info->branch_delay_insns = 1;
+               }
+             else if ((op->pinfo & (INSN_STORE_MEMORY
+                                    | INSN_LOAD_MEMORY_DELAY)) != 0)
+               info->insn_type = dis_dref;
+
              (*info->fprintf_func) (info->stream, "%s", op->name);
 
              d = op->args;
@@ -486,6 +512,7 @@ print_insn_mips (memaddr, word, info)
     }
 
   /* Handle undefined instructions.  */
+  info->insn_type = dis_noninsn;
   (*info->fprintf_func) (info->stream, "0x%x", word);
   return INSNLEN;
 }
@@ -1006,7 +1033,6 @@ print_mips16_insn_arg (type, op, l, use_extend, extend, memaddr, info)
        else
          {
            bfd_vma baseaddr;
-           bfd_vma val;
 
            if (branch)
              {
@@ -1049,9 +1075,8 @@ print_mips16_insn_arg (type, op, l, use_extend, extend, memaddr, info)
                      baseaddr = memaddr - 2;
                  }
              }
-           val = (baseaddr & ~((1 << shift) - 1)) + immed;
-           (*info->print_address_func) (val, info);
-           info->target = val;
+           info->target = (baseaddr & ~((1 << shift) - 1)) + immed;
+           (*info->print_address_func) (info->target, info);
          }
       }
       break;
@@ -1060,9 +1085,9 @@ print_mips16_insn_arg (type, op, l, use_extend, extend, memaddr, info)
       if (! use_extend)
        extend = 0;
       l = ((l & 0x1f) << 23) | ((l & 0x3e0) << 13) | (extend << 2);
-      (*info->print_address_func) (((memaddr + 4) & 0xf0000000) | l, info);
+      info->target = ((memaddr + 4) & ~(bfd_vma) 0x0fffffff) | l;
+      (*info->print_address_func) (info->target, info);
       info->insn_type = dis_jsr;
-      info->target = ((memaddr + 4) & 0xf0000000) | l;
       info->branch_delay_insns = 1;
       break;
 
index 578f22c73679a500d6e2d64f3b06809ba606f2b3..e2386e886a8bb8a2b70c7a87f3955954338dd3c8 100644 (file)
@@ -185,7 +185,7 @@ const struct mips_opcode mips_builtin_opcodes[] =
 {"bgez",    "s,p",     0x04010000, 0xfc1f0000, CBD|RD_s,               I1      },
 {"bgezl",   "s,p",     0x04030000, 0xfc1f0000, CBL|RD_s,               I2|T3   },
 {"bgezal",  "s,p",     0x04110000, 0xfc1f0000, CBD|RD_s|WR_31,         I1      },
-{"bgezall", "s,p",     0x04130000, 0xfc1f0000, CBL|RD_s,               I2|T3   },
+{"bgezall", "s,p",     0x04130000, 0xfc1f0000, CBL|RD_s|WR_31,         I2|T3   },
 {"bgt",     "s,t,p",   0,    (int) M_BGT,      INSN_MACRO,             I1      },
 {"bgt",     "s,I,p",   0,    (int) M_BGT_I,    INSN_MACRO,             I1      },
 {"bgtl",    "s,t,p",   0,    (int) M_BGTL,     INSN_MACRO,             I2|T3   },
@@ -217,7 +217,7 @@ const struct mips_opcode mips_builtin_opcodes[] =
 {"bltz",    "s,p",     0x04000000, 0xfc1f0000, CBD|RD_s,               I1      },
 {"bltzl",   "s,p",     0x04020000, 0xfc1f0000, CBL|RD_s,               I2|T3   },
 {"bltzal",  "s,p",     0x04100000, 0xfc1f0000, CBD|RD_s|WR_31,         I1      },
-{"bltzall", "s,p",     0x04120000, 0xfc1f0000, CBL|RD_s,               I2|T3   },
+{"bltzall", "s,p",     0x04120000, 0xfc1f0000, CBL|RD_s|WR_31,         I2|T3   },
 {"bnez",    "s,p",     0x14000000, 0xfc1f0000, CBD|RD_s,               I1      },
 {"bnezl",   "s,p",     0x54000000, 0xfc1f0000, CBL|RD_s,               I2|T3   },
 {"bne",     "s,t,p",   0x14000000, 0xfc000000, CBD|RD_s|RD_t,          I1      },