From d0fd63cb8f32736a008cf19b47c4704ee44362e6 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 12 Sep 1997 18:41:26 +0000 Subject: [PATCH] Improved display of register lists. --- opcodes/ChangeLog | 6 +++++ opcodes/v850-dis.c | 63 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 12 deletions(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 382a3965e4..bbbbdec6b4 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +start-sanitize-v850e +Fri Sep 12 11:43:54 1997 Nick Clifton + + * v850-dis.c (disassemble): Improved display of register lists. + +start-sanitize-v850e Thu Sep 11 17:35:10 1997 Doug Evans * sparc-opc.c (sparc_opcodes): Fix assembler args to diff --git a/opcodes/v850-dis.c b/opcodes/v850-dis.c index 17cfb9cdc3..8719a6913b 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; -- 2.34.1