aboutsummaryrefslogtreecommitdiff
path: root/opcodes/bfin-dis.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-12-03 19:17:03 -0500
committerMike Frysinger <vapier@gentoo.org>2014-08-14 09:10:12 -0400
commitb3f3b4b0308163d60eaff8ba2727997149fd1d2a (patch)
tree912dab57c9cadd872977d1f6dd768774c2457ed0 /opcodes/bfin-dis.c
parenta4e600b22e938e766fefa9bd0ab111e262e639a6 (diff)
downloadgdb-b3f3b4b0308163d60eaff8ba2727997149fd1d2a.zip
gdb-b3f3b4b0308163d60eaff8ba2727997149fd1d2a.tar.gz
gdb-b3f3b4b0308163d60eaff8ba2727997149fd1d2a.tar.bz2
opcodes: blackfin: simplify decode_CC2stat_0 logic
These multiple if statements can be condensed down into a single if statement and an array of strings. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'opcodes/bfin-dis.c')
-rw-r--r--opcodes/bfin-dis.c46
1 files changed, 5 insertions, 41 deletions
diff --git a/opcodes/bfin-dis.c b/opcodes/bfin-dis.c
index e7d6706..ba33152 100644
--- a/opcodes/bfin-dis.c
+++ b/opcodes/bfin-dis.c
@@ -484,6 +484,7 @@ static const enum machine_registers decode_allregs[] =
#ifndef OUTS
#define OUTS(p, txt) (p)->fprintf_func ((p)->stream, "%s", txt)
#endif
+#define OUT(p, txt, ...) (p)->fprintf_func ((p)->stream, txt, ## __VA_ARGS__)
static void
amod0 (int s0, int x0, disassemble_info *outf)
@@ -1224,6 +1225,7 @@ decode_CC2stat_0 (TIword iw0, disassemble_info *outf)
int cbit = ((iw0 >> CC2stat_cbit_bits) & CC2stat_cbit_mask);
const char *bitname = statbits (cbit);
+ const char * const op_names[] = { "", "|", "&", "^" } ;
if (priv->parallel)
return 0;
@@ -1241,48 +1243,10 @@ decode_CC2stat_0 (TIword iw0, disassemble_info *outf)
bitname = bitnames;
}
- if (op == 0 && D == 0)
- {
- OUTS (outf, "CC = ");
- OUTS (outf, bitname);
- }
- else if (op == 1 && D == 0)
- {
- OUTS (outf, "CC |= ");
- OUTS (outf, bitname);
- }
- else if (op == 2 && D == 0)
- {
- OUTS (outf, "CC &= ");
- OUTS (outf, bitname);
- }
- else if (op == 3 && D == 0)
- {
- OUTS (outf, "CC ^= ");
- OUTS (outf, bitname);
- }
- else if (op == 0 && D == 1)
- {
- OUTS (outf, bitname);
- OUTS (outf, " = CC");
- }
- else if (op == 1 && D == 1)
- {
- OUTS (outf, bitname);
- OUTS (outf, " |= CC");
- }
- else if (op == 2 && D == 1)
- {
- OUTS (outf, bitname);
- OUTS (outf, " &= CC");
- }
- else if (op == 3 && D == 1)
- {
- OUTS (outf, bitname);
- OUTS (outf, " ^= CC");
- }
+ if (D == 0)
+ OUT (outf, "CC %s= %s", op_names[op], bitname);
else
- return 0;
+ OUT (outf, "%s %s= CC", bitname, op_names[op]);
return 2;
}