aboutsummaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2005-07-26 03:21:53 +0000
committerDJ Delorie <dj@redhat.com>2005-07-26 03:21:53 +0000
commitfd54057a29e296d29e662780fc6079e42c742228 (patch)
tree1a109b9e7d8a9108edda9722d9e1f392e74cf070 /cpu
parent030cf60a5d8687b18dbe76050ee33490fc96e075 (diff)
downloadfsf-binutils-gdb-fd54057a29e296d29e662780fc6079e42c742228.zip
fsf-binutils-gdb-fd54057a29e296d29e662780fc6079e42c742228.tar.gz
fsf-binutils-gdb-fd54057a29e296d29e662780fc6079e42c742228.tar.bz2
[bfd]
* reloc.c: Remove unused M32C relocs, add BFD_RELOC_M32C_HI8. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. * elf32-m32c.c (m32c_elf_howto_table): Add R_M32C_8, R_M32C_LO16, R_M32C_HI8, R_M32C_HI16. (m32c_reloc_map): Likewise. (m32c_elf_relocate_section): Add R_M32C_HI8 and R_M32C_HI16. [cpu] * m32c.opc (parse_unsigned8): Add %dsp8(). (parse_signed8): Add %hi8(). (parse_unsigned16): Add %dsp16(). (parse_signed16): Add %lo16() and %hi16(). (parse_lab_5_3): Make valuep a bfd_vma *. [gas] * config/tc-m32c.c (md_cgen_lookup_reloc): Add 8 bit operands. Support %mod() modifiers from opcodes. * doc/c-m32c.texi (M32C-Modifiers): New section. [include/elf] * m32c.h: Add R_M32C_8, R_M32C_LO16, R_M32C_HI8, and R_M32C_HI16. [opcodes] * m32c-asm.c Regenerate. * m32c-dis.c Regenerate.
Diffstat (limited to 'cpu')
-rw-r--r--cpu/ChangeLog8
-rw-r--r--cpu/m32c.opc118
2 files changed, 122 insertions, 4 deletions
diff --git a/cpu/ChangeLog b/cpu/ChangeLog
index ca2b7c1..6c9a90d 100644
--- a/cpu/ChangeLog
+++ b/cpu/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-25 DJ Delorie <dj@redhat.com>
+
+ * m32c.opc (parse_unsigned8): Add %dsp8().
+ (parse_signed8): Add %hi8().
+ (parse_unsigned16): Add %dsp16().
+ (parse_signed16): Add %lo16() and %hi16().
+ (parse_lab_5_3): Make valuep a bfd_vma *.
+
2005-07-18 Nick Clifton <nickc@redhat.com>
* m32c.cpu (f-16-8, f-24-8, f-32-16, f-dsp-8-u24): New opcode
diff --git a/cpu/m32c.opc b/cpu/m32c.opc
index 7caf21d..19547ae 100644
--- a/cpu/m32c.opc
+++ b/cpu/m32c.opc
@@ -153,6 +153,28 @@ parse_unsigned8 (CGEN_CPU_DESC cd, const char **strp,
unsigned long value;
long have_zero = 0;
+ if (strncasecmp (*strp, "%dsp8(", 6) == 0)
+ {
+ enum cgen_parse_operand_result result_type;
+ bfd_vma value;
+ const char *errmsg;
+
+ *strp += 6;
+ errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_8,
+ & result_type, & value);
+ if (**strp != ')')
+ return _("missing `)'");
+ (*strp) ++;
+
+ if (errmsg == NULL
+ && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
+ {
+ return _("%dsp8() takes a symbolic address, not a number");
+ }
+ *valuep = value;
+ return errmsg;
+ }
+
if (strncmp (*strp, "0x0", 3) == 0
|| (**strp == '0' && *(*strp + 1) != 'x'))
have_zero = 1;
@@ -201,7 +223,29 @@ parse_signed8 (CGEN_CPU_DESC cd, const char **strp,
{
const char *errmsg = 0;
signed long value;
-
+
+ if (strncasecmp (*strp, "%hi8(", 5) == 0)
+ {
+ enum cgen_parse_operand_result result_type;
+ bfd_vma value;
+ const char *errmsg;
+
+ *strp += 5;
+ errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_M32C_HI8,
+ & result_type, & value);
+ if (**strp != ')')
+ return _("missing `)'");
+ (*strp) ++;
+
+ if (errmsg == NULL
+ && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
+ {
+ value >>= 16;
+ }
+ *valuep = value;
+ return errmsg;
+ }
+
PARSE_SIGNED;
if (value <= 255 && value > 127)
@@ -221,7 +265,29 @@ parse_unsigned16 (CGEN_CPU_DESC cd, const char **strp,
const char *errmsg = 0;
unsigned long value;
long have_zero = 0;
-
+
+ if (strncasecmp (*strp, "%dsp16(", 7) == 0)
+ {
+ enum cgen_parse_operand_result result_type;
+ bfd_vma value;
+ const char *errmsg;
+
+ *strp += 7;
+ errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_16,
+ & result_type, & value);
+ if (**strp != ')')
+ return _("missing `)'");
+ (*strp) ++;
+
+ if (errmsg == NULL
+ && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
+ {
+ return _("%dsp16() takes a symbolic address, not a number");
+ }
+ *valuep = value;
+ return errmsg;
+ }
+
/* Don't successfully parse literals beginning with '['. */
if (**strp == '[')
return "Invalid literal"; /* Anything -- will not be seen. */
@@ -259,6 +325,50 @@ parse_signed16 (CGEN_CPU_DESC cd, const char **strp,
const char *errmsg = 0;
signed long value;
+ if (strncasecmp (*strp, "%lo16(", 6) == 0)
+ {
+ enum cgen_parse_operand_result result_type;
+ bfd_vma value;
+ const char *errmsg;
+
+ *strp += 6;
+ errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16,
+ & result_type, & value);
+ if (**strp != ')')
+ return _("missing `)'");
+ (*strp) ++;
+
+ if (errmsg == NULL
+ && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
+ {
+ value &= 0xffff;
+ }
+ *valuep = value;
+ return errmsg;
+ }
+
+ if (strncasecmp (*strp, "%hi16(", 6) == 0)
+ {
+ enum cgen_parse_operand_result result_type;
+ bfd_vma value;
+ const char *errmsg;
+
+ *strp += 6;
+ errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16,
+ & result_type, & value);
+ if (**strp != ')')
+ return _("missing `)'");
+ (*strp) ++;
+
+ if (errmsg == NULL
+ && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
+ {
+ value >>= 16;
+ }
+ *valuep = value;
+ return errmsg;
+ }
+
PARSE_SIGNED;
if (value <= 65535 && value > 32767)
@@ -380,10 +490,10 @@ parse_lab_5_3 (CGEN_CPU_DESC cd,
int opindex ATTRIBUTE_UNUSED,
int opinfo,
enum cgen_parse_operand_result *type_addr,
- unsigned long *valuep)
+ bfd_vma *valuep)
{
const char *errmsg = 0;
- unsigned long value;
+ bfd_vma value;
enum cgen_parse_operand_result op_res;
errmsg = cgen_parse_address (cd, strp, M32C_OPERAND_LAB_5_3,