aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2002-12-17 03:57:49 +0000
committerDJ Delorie <dj@redhat.com>2002-12-17 03:57:49 +0000
commitc2617f40672c99c841002496a79d763bbda49bef (patch)
tree99daad4d76047c51c64083cab594554f528cf30e
parent5fdd7054d392ce7340f688f7bcd2d0e13a0be9c4 (diff)
downloadgdb-c2617f40672c99c841002496a79d763bbda49bef.zip
gdb-c2617f40672c99c841002496a79d763bbda49bef.tar.gz
gdb-c2617f40672c99c841002496a79d763bbda49bef.tar.bz2
* xstormy16-asm.c: Regenerate.
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/xstormy16-asm.c53
2 files changed, 56 insertions, 1 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 5befb2d..2938840 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 f2118f7..d4db37c 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);