diff options
author | DJ Delorie <dj@redhat.com> | 2005-07-26 03:21:53 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2005-07-26 03:21:53 +0000 |
commit | fd54057a29e296d29e662780fc6079e42c742228 (patch) | |
tree | 1a109b9e7d8a9108edda9722d9e1f392e74cf070 /opcodes/m32c-asm.c | |
parent | daily update (diff) | |
download | binutils-gdb-fd54057a29e296d29e662780fc6079e42c742228.tar.gz binutils-gdb-fd54057a29e296d29e662780fc6079e42c742228.tar.bz2 binutils-gdb-fd54057a29e296d29e662780fc6079e42c742228.zip |
[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 'opcodes/m32c-asm.c')
-rw-r--r-- | opcodes/m32c-asm.c | 118 |
1 files changed, 114 insertions, 4 deletions
diff --git a/opcodes/m32c-asm.c b/opcodes/m32c-asm.c index 60c1055c954..1bfa926efdb 100644 --- a/opcodes/m32c-asm.c +++ b/opcodes/m32c-asm.c @@ -127,6 +127,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; @@ -175,7 +197,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) @@ -195,7 +239,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. */ @@ -233,6 +299,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) @@ -354,10 +464,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, |