diff options
author | DJ Delorie <dj@delorie.com> | 2002-12-17 03:57:49 +0000 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2002-12-17 03:57:49 +0000 |
commit | 3a11af7717cf58a3643efda0430e49a66dd77f40 (patch) | |
tree | eda82e20d5d8ed4a1540a893b244d6d440c69632 /opcodes | |
parent | 5838cc4a053adb85cc6fc1b3770d9aa0aa45d5d3 (diff) | |
download | gdb-3a11af7717cf58a3643efda0430e49a66dd77f40.tar.gz |
* xstormy16-asm.c: Regenerate.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 4 | ||||
-rw-r--r-- | opcodes/xstormy16-asm.c | 53 |
2 files changed, 56 insertions, 1 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 5befb2dd6a3..293884015e1 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2002-12-16 Andrew MacLeod <amacleod@redhat.com> + + * xstormy16-asm.c: Regenerate. + 2002-12-16 Alan Modra <amodra@bigpond.net.au> * ns32k-dis.c (print_insn_ns32k): Constify "d", remove register diff --git a/opcodes/xstormy16-asm.c b/opcodes/xstormy16-asm.c index f2118f7fdcb..d4db37c7885 100644 --- a/opcodes/xstormy16-asm.c +++ b/opcodes/xstormy16-asm.c @@ -109,6 +109,9 @@ parse_small_immediate (cd, strp, opindex, valuep) enum cgen_parse_operand_result result; const char *errmsg; + if (**strp == '@') + return _("No relocation for small immediate"); + errmsg = (* cd->parse_operand_fn) (cd, CGEN_PARSE_OPERAND_INTEGER, strp, opindex, BFD_RELOC_NONE, &result, &value); @@ -122,6 +125,54 @@ parse_small_immediate (cd, strp, opindex, valuep) *valuep = value; return NULL; } + +/* Literal scan be either a normal literal, a @hi() or @lo relocation. */ + +static const char * +parse_immediate16 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + unsigned long *valuep; +{ + const char *errmsg; + enum cgen_parse_operand_result result; + bfd_reloc_code_real_type code = BFD_RELOC_NONE; + bfd_vma value; + + if (strncmp (*strp, "@hi(", 4) == 0) + { + *strp += 4; + code = BFD_RELOC_HI16; + } + else + if (strncmp (*strp, "@lo(", 4) == 0) + { + *strp += 4; + code = BFD_RELOC_LO16; + } + + if (code == BFD_RELOC_NONE) + errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, valuep); + else + { + errmsg = cgen_parse_address (cd, strp, opindex, code, &result, &value); + if ((errmsg == NULL) && + (result != CGEN_PARSE_OPERAND_RESULT_QUEUED)) + errmsg = _("Operand is not a symbol"); + + *valuep = value; + if ((code == BFD_RELOC_HI16 || code == BFD_RELOC_LO16) + && **strp == ')') + *strp += 1; + else + { + errmsg = _("Syntax error: No trailing ')'"); + return errmsg; + } + } + return errmsg; +} /* -- */ const char * xstormy16_cgen_parse_operand @@ -187,7 +238,7 @@ xstormy16_cgen_parse_operand (cd, opindex, strp, fields) errmsg = cgen_parse_signed_integer (cd, strp, XSTORMY16_OPERAND_IMM12, &fields->f_imm12); break; case XSTORMY16_OPERAND_IMM16 : - errmsg = cgen_parse_unsigned_integer (cd, strp, XSTORMY16_OPERAND_IMM16, &fields->f_imm16); + errmsg = parse_immediate16 (cd, strp, XSTORMY16_OPERAND_IMM16, &fields->f_imm16); break; case XSTORMY16_OPERAND_IMM2 : errmsg = cgen_parse_unsigned_integer (cd, strp, XSTORMY16_OPERAND_IMM2, &fields->f_imm2); |