aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1997-09-12 18:41:26 +0000
committerNick Clifton <nickc@redhat.com>1997-09-12 18:41:26 +0000
commitd0fd63cb8f32736a008cf19b47c4704ee44362e6 (patch)
tree91d2de6902ecd2455294001a9cd11fc1b0f24e9f /opcodes
parent410230cf6d65003b0595a7ef712b671d1bb77b0d (diff)
downloadfsf-binutils-gdb-d0fd63cb8f32736a008cf19b47c4704ee44362e6.zip
fsf-binutils-gdb-d0fd63cb8f32736a008cf19b47c4704ee44362e6.tar.gz
fsf-binutils-gdb-d0fd63cb8f32736a008cf19b47c4704ee44362e6.tar.bz2
Improved display of register lists.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog6
-rw-r--r--opcodes/v850-dis.c63
2 files changed, 57 insertions, 12 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 382a396..bbbbdec 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+start-sanitize-v850e
+Fri Sep 12 11:43:54 1997 Nick Clifton <nickc@cygnus.com>
+
+ * v850-dis.c (disassemble): Improved display of register lists.
+
+start-sanitize-v850e
Thu Sep 11 17:35:10 1997 Doug Evans <dje@canuck.cygnus.com>
* sparc-opc.c (sparc_opcodes): Fix assembler args to
diff --git a/opcodes/v850-dis.c b/opcodes/v850-dis.c
index 17cfb9c..8719a69 100644
--- a/opcodes/v850-dis.c
+++ b/opcodes/v850-dis.c
@@ -164,9 +164,12 @@ disassemble (memaddr, info, insn)
static int list18_h_regs[32] = { 19, 18, 17, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 30, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24 };
static int list18_l_regs[32] = { 3, 2, 1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 14, 15, 13, 12, 7, 6, 5, 4, 11, 10, 9, 8 };
/* end-sanitize-v850eq */
- int * regs;
- int i;
- int shown_one = false;
+ int * regs;
+ int i;
+ unsigned long int mask = 0;
+ int pc = false;
+ int sr = false;
+
switch (operand->shift)
{
@@ -180,27 +183,63 @@ disassemble (memaddr, info, insn)
abort();
}
- info->fprintf_func (info->stream, "{");
for (i = 0; i < 32; i++)
{
if (value & (1 << i))
{
- if (shown_one)
- info->fprintf_func (info->stream, ",");
- else
- shown_one = true;
-
switch (regs[ i ])
{
- default: info->fprintf_func (info->stream, "%s", v850_reg_names[regs[ i ]]); break;
+ default: mask |= (1 << regs[ i ]); break;
/* start-sanitize-v850eq */
case 0: fprintf (stderr, "unknown pop reg: %d\n", i ); abort();
- case -1: info->fprintf_func (info->stream, "PC "); break;
- case -2: info->fprintf_func (info->stream, "SR"); break;
+ case -1: pc = true; break;
+ case -2: sr = true; break;
/* end-sanitize-v850eq */
}
}
}
+
+ info->fprintf_func (info->stream, "{");
+
+ if (mask || pc || sr)
+ {
+ if (mask)
+ {
+ unsigned int bit;
+ int shown_one = false;
+
+ for (bit = 0; bit < 32; bit++)
+ if (mask & (1 << bit))
+ {
+ unsigned long int first = bit;
+ unsigned long int last;
+
+ if (shown_one)
+ info->fprintf_func (info->stream, ", ");
+ else
+ shown_one = true;
+
+ info->fprintf_func (info->stream, v850_reg_names[first]);
+
+ for (bit++; bit < 32; bit++)
+ if ((mask & (1 << bit)) == 0)
+ break;
+
+ last = bit;
+
+ if (last > first + 1)
+ {
+ info->fprintf_func (info->stream, " - %s", v850_reg_names[ last - 1 ]);
+ }
+ }
+ }
+
+ if (pc)
+ info->fprintf_func (info->stream, "%sPC", mask ? ", " : "");
+ if (sr)
+ info->fprintf_func (info->stream, "%sSR", (mask || pc) ? ", " : "");
+ }
+
info->fprintf_func (info->stream, "}");
}
break;