* hppa-dis.c: Formatting.

* hppa-dis.c (print_insn_hppa): Implement fcnv instruction modifiers.
This commit is contained in:
Alan Modra 2003-02-25 03:22:06 +00:00
parent 75776faa40
commit ca504dff71
2 changed files with 194 additions and 142 deletions

View file

@ -1,5 +1,11 @@
2003-02-25 Alan Modra <amodra@bigpond.net.au>
* hppa-dis.c: Formatting.
2003-02-25 Matthew Wilcox <willy@debian.org>
* hppa-dis.c (print_insn_hppa): Implement fcnv instruction modifiers.
* hppa-dis.c (print_insn_hppa <2 bit space register>): Do not print
the space register when the value is zero.

View file

@ -1,5 +1,5 @@
/* Disassembler for the PA-RISC. Somewhat derived from sparc-pinsn.c.
Copyright 1989, 1990, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
Copyright 1989, 1990, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2003
Free Software Foundation, Inc.
Contributed by the Center for Software Science at the
@ -123,6 +123,8 @@ static const char *const short_bytes_compl_names[] = {
"", ",b,m", ",e", ",e,m"
};
static const char *const float_format_names[] = {",sgl", ",dbl", "", ",quad"};
static const char *const fcnv_fixed_names[] = {",w", ",dw", "", ",qw"};
static const char *const fcnv_ufixed_names[] = {",uw", ",udw", "", ",uqw"};
static const char *const float_comp_names[] =
{
",false?", ",false", ",?", ",!<=>", ",=", ",=t", ",?=", ",!<>",
@ -194,8 +196,8 @@ fput_fp_reg_r (reg, info)
if (reg < 4)
(*info->fprintf_func) (info->stream, "fpe%d", reg * 2 + 1);
else
(*info->fprintf_func) (info->stream, "%sR", reg ? fp_reg_names[reg]
: "fr0");
(*info->fprintf_func) (info->stream, "%sR",
reg ? fp_reg_names[reg] : "fr0");
}
static void
@ -397,7 +399,7 @@ print_insn_hppa (memaddr, info)
#endif
(*info->fprintf_func) (info->stream, "%s", opcode->name);
if (!strchr ("cfCY?-+nHNZFIuv", opcode->args[0]))
if (!strchr ("cfCY?-+nHNZFIuv{", opcode->args[0]))
(*info->fprintf_func) (info->stream, " ");
for (s = opcode->args; *s != '\0'; ++s)
{
@ -443,7 +445,6 @@ print_insn_hppa (memaddr, info)
completer. */
case 'X':
fputs_filtered (" ", info);
/* FALLTHRU */
case 'A':
@ -451,7 +452,6 @@ print_insn_hppa (memaddr, info)
fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
else
fput_fp_reg (GET_FIELD (insn, 6, 10), info);
break;
case 'b':
if (GET_FIELD (insn, 25, 25))
@ -522,7 +522,6 @@ print_insn_hppa (memaddr, info)
format completer. */
case 'E':
fputs_filtered (" ", info);
/* FALLTHRU */
case 'e':
@ -550,7 +549,8 @@ print_insn_hppa (memaddr, info)
break;
case 'S':
(*info->fprintf_func) (info->stream, "sr%d", extract_3 (insn));
(*info->fprintf_func) (info->stream, "sr%d",
extract_3 (insn));
break;
/* Handle completers. */
@ -558,27 +558,33 @@ print_insn_hppa (memaddr, info)
switch (*++s)
{
case 'x':
(*info->fprintf_func) (info->stream, "%s",
(*info->fprintf_func)
(info->stream, "%s",
index_compl_names[GET_COMPL (insn)]);
break;
case 'X':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
index_compl_names[GET_COMPL (insn)]);
break;
case 'm':
(*info->fprintf_func) (info->stream, "%s",
(*info->fprintf_func)
(info->stream, "%s",
short_ldst_compl_names[GET_COMPL (insn)]);
break;
case 'M':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
short_ldst_compl_names[GET_COMPL (insn)]);
break;
case 'A':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
short_bytes_compl_names[GET_COMPL (insn)]);
break;
case 's':
(*info->fprintf_func) (info->stream, "%s",
(*info->fprintf_func)
(info->stream, "%s",
short_bytes_compl_names[GET_COMPL (insn)]);
break;
case 'c':
@ -622,7 +628,8 @@ print_insn_hppa (memaddr, info)
(*info->fprintf_func) (info->stream, ",l");
break;
case 'w':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
read_write_names[GET_FIELD (insn, 25, 25)]);
break;
case 'W':
@ -648,18 +655,18 @@ print_insn_hppa (memaddr, info)
break;
case 'a':
(*info->fprintf_func)
(info->stream, "%s", add_compl_names[GET_FIELD
(insn, 20, 21)]);
(info->stream, "%s",
add_compl_names[GET_FIELD (insn, 20, 21)]);
break;
case 'Y':
(*info->fprintf_func)
(info->stream, ",dc%s", add_compl_names[GET_FIELD
(insn, 20, 21)]);
(info->stream, ",dc%s",
add_compl_names[GET_FIELD (insn, 20, 21)]);
break;
case 'y':
(*info->fprintf_func)
(info->stream, ",c%s", add_compl_names[GET_FIELD
(insn, 20, 21)]);
(info->stream, ",c%s",
add_compl_names[GET_FIELD (insn, 20, 21)]);
break;
case 'v':
if (GET_FIELD (insn, 20, 20))
@ -688,22 +695,22 @@ print_insn_hppa (memaddr, info)
/* EXTRD/W has a following condition. */
if (*(s + 1) == '?')
(*info->fprintf_func)
(info->stream, "%s", signed_unsigned_names[GET_FIELD
(insn, 21, 21)]);
(info->stream, "%s",
signed_unsigned_names[GET_FIELD (insn, 21, 21)]);
else
(*info->fprintf_func)
(info->stream, "%s ", signed_unsigned_names[GET_FIELD
(insn, 21, 21)]);
(info->stream, "%s ",
signed_unsigned_names[GET_FIELD (insn, 21, 21)]);
break;
case 'h':
(*info->fprintf_func)
(info->stream, "%s", mix_half_names[GET_FIELD
(insn, 17, 17)]);
(info->stream, "%s",
mix_half_names[GET_FIELD (insn, 17, 17)]);
break;
case 'H':
(*info->fprintf_func)
(info->stream, "%s ", saturation_names[GET_FIELD
(insn, 24, 25)]);
(info->stream, "%s ",
saturation_names[GET_FIELD (insn, 24, 25)]);
break;
case '*':
(*info->fprintf_func)
@ -777,9 +784,9 @@ print_insn_hppa (memaddr, info)
switch (*s)
{
case 'f':
(*info->fprintf_func) (info->stream, "%s ",
float_comp_names[GET_FIELD
(insn, 27, 31)]);
(*info->fprintf_func)
(info->stream, "%s ",
float_comp_names[GET_FIELD (insn, 27, 31)]);
break;
/* these four conditions are for the set of instructions
@ -787,43 +794,55 @@ print_insn_hppa (memaddr, info)
rather than by the 'f' bit (sigh): comb, comib,
addb, addib */
case 't':
fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18)],
info);
fputs_filtered
(compare_cond_names[GET_FIELD (insn, 16, 18)], info);
break;
case 'n':
fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18)
+ GET_FIELD (insn, 4, 4) * 8], info);
fputs_filtered
(compare_cond_names[GET_FIELD (insn, 16, 18)
+ GET_FIELD (insn, 4, 4) * 8],
info);
break;
case 'N':
fputs_filtered (compare_cond_64_names[GET_FIELD (insn, 16, 18)
+ GET_FIELD (insn, 2, 2) * 8], info);
fputs_filtered
(compare_cond_64_names[GET_FIELD (insn, 16, 18)
+ GET_FIELD (insn, 2, 2) * 8],
info);
break;
case 'Q':
fputs_filtered (cmpib_cond_64_names[GET_FIELD (insn, 16, 18)],
fputs_filtered
(cmpib_cond_64_names[GET_FIELD (insn, 16, 18)],
info);
break;
case '@':
fputs_filtered (add_cond_names[GET_FIELD (insn, 16, 18)
+ GET_FIELD (insn, 4, 4) * 8], info);
fputs_filtered
(add_cond_names[GET_FIELD (insn, 16, 18)
+ GET_FIELD (insn, 4, 4) * 8],
info);
break;
case 's':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
compare_cond_names[GET_COND (insn)]);
break;
case 'S':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
compare_cond_64_names[GET_COND (insn)]);
break;
case 'a':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
add_cond_names[GET_COND (insn)]);
break;
case 'A':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
add_cond_64_names[GET_COND (insn)]);
break;
case 'd':
(*info->fprintf_func) (info->stream, "%s",
(*info->fprintf_func)
(info->stream, "%s",
add_cond_names[GET_FIELD (insn, 16, 18)]);
break;
@ -835,19 +854,23 @@ print_insn_hppa (memaddr, info)
break;
case 'l':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
logical_cond_names[GET_COND (insn)]);
break;
case 'L':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
logical_cond_64_names[GET_COND (insn)]);
break;
case 'u':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
unit_cond_names[GET_COND (insn)]);
break;
case 'U':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
unit_cond_64_names[GET_COND (insn)]);
break;
case 'y':
@ -863,7 +886,8 @@ print_insn_hppa (memaddr, info)
(*info->fprintf_func) (info->stream, " ");
break;
case 'X':
(*info->fprintf_func) (info->stream, "%s ",
(*info->fprintf_func)
(info->stream, "%s ",
shift_cond_64_names[GET_FIELD (insn, 16, 18)]);
break;
case 'B':
@ -925,14 +949,13 @@ print_insn_hppa (memaddr, info)
(*info->fprintf_func) (info->stream, " ");
break;
case 'w':
(*info->print_address_func) (memaddr + 8 + extract_12 (insn),
info);
(*info->print_address_func)
(memaddr + 8 + extract_12 (insn), info);
break;
case 'W':
/* 17 bit PC-relative branch. */
(*info->print_address_func) ((memaddr + 8
+ extract_17 (insn)),
info);
(*info->print_address_func)
((memaddr + 8 + extract_17 (insn)), info);
break;
case 'z':
/* 17 bit displacement. This is an offset from a register
@ -1020,7 +1043,8 @@ print_insn_hppa (memaddr, info)
fput_const (GET_FIELD (insn, 6, 31), info);
break;
case 'v':
(*info->fprintf_func) (info->stream, ",%d", GET_FIELD (insn, 23, 25));
(*info->fprintf_func) (info->stream, ",%d",
GET_FIELD (insn, 23, 25));
break;
case 'O':
fput_const ((GET_FIELD (insn, 6,20) << 5 |
@ -1042,23 +1066,24 @@ print_insn_hppa (memaddr, info)
GET_FIELD (insn, 27, 31)), info);
break;
case 'u':
(*info->fprintf_func) (info->stream, ",%d", GET_FIELD (insn, 23, 25));
(*info->fprintf_func) (info->stream, ",%d",
GET_FIELD (insn, 23, 25));
break;
case 'F':
/* if no destination completer and not before a completer
for fcmp, need a space here */
if (s[1] == 'G' || s[1] == '?')
fputs_filtered (float_format_names[GET_FIELD (insn, 19, 20)],
info);
fputs_filtered
(float_format_names[GET_FIELD (insn, 19, 20)], info);
else
(*info->fprintf_func) (info->stream, "%s ",
float_format_names[GET_FIELD
(insn, 19, 20)]);
(*info->fprintf_func)
(info->stream, "%s ",
float_format_names[GET_FIELD (insn, 19, 20)]);
break;
case 'G':
(*info->fprintf_func) (info->stream, "%s ",
float_format_names[GET_FIELD (insn,
17, 18)]);
(*info->fprintf_func)
(info->stream, "%s ",
float_format_names[GET_FIELD (insn, 17, 18)]);
break;
case 'H':
if (GET_FIELD (insn, 26, 26) == 1)
@ -1072,12 +1097,12 @@ print_insn_hppa (memaddr, info)
/* if no destination completer and not before a completer
for fcmp, need a space here */
if (s[1] == '?')
fputs_filtered (float_format_names[GET_FIELD (insn, 20, 20)],
info);
fputs_filtered
(float_format_names[GET_FIELD (insn, 20, 20)], info);
else
(*info->fprintf_func) (info->stream, "%s ",
float_format_names[GET_FIELD
(insn, 20, 20)]);
(*info->fprintf_func)
(info->stream, "%s ",
float_format_names[GET_FIELD (insn, 20, 20)]);
break;
case 'J':
@ -1135,11 +1160,33 @@ print_insn_hppa (memaddr, info)
break;
}
/* ?!? FIXME */
case '_':
break; /* Dealt with by '{' */
case '{':
fputs_filtered ("Disassembler botch.\n", info);
{
int sub = GET_FIELD (insn, 14, 16);
int df = GET_FIELD (insn, 17, 18);
int sf = GET_FIELD (insn, 19, 20);
const char * const * source = float_format_names;
const char * const * dest = float_format_names;
char *t = "";
if (sub == 4)
{
fputs_filtered (",UND ", info);
break;
}
if ((sub & 3) == 3)
t = ",t";
if ((sub & 3) == 1)
source = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names;
if (sub & 2)
dest = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names;
(*info->fprintf_func) (info->stream, "%s%s%s ",
t, source[sf], dest[df]);
break;
}
case 'm':
{
@ -1185,9 +1232,8 @@ print_insn_hppa (memaddr, info)
}
case 'X':
(*info->print_address_func) ((memaddr + 8
+ extract_22 (insn)),
info);
(*info->print_address_func)
(memaddr + 8 + extract_22 (insn), info);
break;
case 'L':
fputs_filtered (",%r2", info);