public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] opcodes: blackfin: decode all ASTAT bits
@ 2010-09-21  8:49 Mike Frysinger
  2010-09-22 21:39 ` Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2010-09-21  8:49 UTC (permalink / raw)
  To: binutils

All ASTAT bits work in the hardware even though they aren't part of the
official Blackfin ISA.  So decode every ASTAT field to make the output
a bit nicer when working with hand generated opcodes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

2010-09-21  Mike Frysinger  <vapier@gentoo.org>

	* bfin-dis.c (decode_CC2stat_0): Decode all ASTAT bits.
---
 opcodes/bfin-dis.c |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/opcodes/bfin-dis.c b/opcodes/bfin-dis.c
index ef7c7b5..f124f14 100644
--- a/opcodes/bfin-dis.c
+++ b/opcodes/bfin-dis.c
@@ -1227,44 +1227,57 @@ decode_CC2stat_0 (TIword iw0, disassemble_info *outf)
   int op   = ((iw0 >> CC2stat_op_bits) & CC2stat_op_mask);
   int cbit = ((iw0 >> CC2stat_cbit_bits) & CC2stat_cbit_mask);
 
+  const char *bitname = statbits (cbit);
+  if (decode_statbits[cbit] == REG_LASTREG)
+    {
+      /* All ASTAT bits except CC may be operated on in hardware, but may
+         not have a dedicated insn, so still decode "valid" insns.  */
+      static char bitnames[64];
+      if (cbit != 5)
+	sprintf (bitnames, "ASTAT[%i /* unused bit */]", cbit);
+      else
+	strcpy (bitnames, "CC /* ... Illegal register ... */");
+      bitname = bitnames;
+    }
+
   if (op == 0 && D == 0)
     {
       OUTS (outf, "CC = ");
-      OUTS (outf, statbits (cbit));
+      OUTS (outf, bitname);
     }
   else if (op == 1 && D == 0)
     {
       OUTS (outf, "CC |= ");
-      OUTS (outf, statbits (cbit));
+      OUTS (outf, bitname);
     }
   else if (op == 2 && D == 0)
     {
       OUTS (outf, "CC &= ");
-      OUTS (outf, statbits (cbit));
+      OUTS (outf, bitname);
     }
   else if (op == 3 && D == 0)
     {
       OUTS (outf, "CC ^= ");
-      OUTS (outf, statbits (cbit));
+      OUTS (outf, bitname);
     }
   else if (op == 0 && D == 1)
     {
-      OUTS (outf, statbits (cbit));
+      OUTS (outf, bitname);
       OUTS (outf, " = CC");
     }
   else if (op == 1 && D == 1)
     {
-      OUTS (outf, statbits (cbit));
+      OUTS (outf, bitname);
       OUTS (outf, " |= CC");
     }
   else if (op == 2 && D == 1)
     {
-      OUTS (outf, statbits (cbit));
+      OUTS (outf, bitname);
       OUTS (outf, " &= CC");
     }
   else if (op == 3 && D == 1)
     {
-      OUTS (outf, statbits (cbit));
+      OUTS (outf, bitname);
       OUTS (outf, " ^= CC");
     }
   else
-- 
1.7.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] opcodes: blackfin: decode all ASTAT bits
  2010-09-21  8:49 [PATCH] opcodes: blackfin: decode all ASTAT bits Mike Frysinger
@ 2010-09-22 21:39 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2010-09-22 21:39 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: Text/Plain, Size: 282 bytes --]

On Tuesday, September 21, 2010 04:48:45 Mike Frysinger wrote:
> All ASTAT bits work in the hardware even though they aren't part of the
> official Blackfin ISA.  So decode every ASTAT field to make the output
> a bit nicer when working with hand generated opcodes.

committed
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-22 21:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-21  8:49 [PATCH] opcodes: blackfin: decode all ASTAT bits Mike Frysinger
2010-09-22 21:39 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).