aboutsummaryrefslogtreecommitdiff
path: root/opcodes/d10v-dis.c
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>1996-07-22 18:57:20 +0000
committerMartin Hunt <hunt@redhat.com>1996-07-22 18:57:20 +0000
commit95e3e73328660ee56bba0e109f491014af337dfb (patch)
treeea4dbcee26e151f00f37e8ad673dbf771eef8e21 /opcodes/d10v-dis.c
parentc38655b90f0beed92b9387ac9d8b7c02901dfdd8 (diff)
downloadgdb-95e3e73328660ee56bba0e109f491014af337dfb.zip
gdb-95e3e73328660ee56bba0e109f491014af337dfb.tar.gz
gdb-95e3e73328660ee56bba0e109f491014af337dfb.tar.bz2
start-sanitize-d10v
Mon Jul 22 11:25:24 1996 Martin M. Hunt <hunt@pizza.cygnus.com> * d10v-opc.c (pre_defined_registers): Declare. * d10v-dis.c (print_operand): Now uses pre_defined_registers to pick a better name for the registers. end-sanitize-d10v
Diffstat (limited to 'opcodes/d10v-dis.c')
-rw-r--r--opcodes/d10v-dis.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/opcodes/d10v-dis.c b/opcodes/d10v-dis.c
index a4d5438..0176d10 100644
--- a/opcodes/d10v-dis.c
+++ b/opcodes/d10v-dis.c
@@ -106,18 +106,37 @@ print_operand (buf, oper, insn, op)
num = (insn >> shift) & (0x7FFFFFFF >> (31 - oper->bits));
- if (oper->flags & OPERAND_ACC)
- *buf++ = 'a';
- else if (oper->flags & OPERAND_CONTROL)
+ if (oper->flags & OPERAND_REG)
{
- *buf++ ='c';
- *buf++ ='r';
+ int i;
+ int match=0;
+ num += oper->flags & (OPERAND_ACC|OPERAND_FLAG|OPERAND_CONTROL);
+ for (i=0;i<reg_name_cnt();i++)
+ {
+ if (num == pre_defined_registers[i].value)
+ {
+ if (pre_defined_registers[i].pname)
+ strcpy(buf,pre_defined_registers[i].pname);
+ else
+ strcpy(buf,pre_defined_registers[i].name);
+ match=1;
+ break;
+ }
+ }
+ if (match==0)
+ {
+ if (oper->flags & OPERAND_ACC)
+ *buf++ = 'a';
+ else if (oper->flags & OPERAND_CONTROL)
+ {
+ *buf++ ='c';
+ *buf++ ='r';
+ }
+ else if(oper->flags & OPERAND_REG)
+ *buf++ = 'r';
+ sprintf (buf, "%d", num);
+ }
}
- else if(oper->flags & OPERAND_REG)
- *buf++ = 'r';
-
- if (oper->flags & OPERAND_REG)
- sprintf (buf, "%d", num);
else
sprintf (buf, "0x%x", num);
}