X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=cpu%2Fxc16x.opc;h=47b7c690e433f382e16515ac43372a8754a251ed;hb=40c75bc8b07abc5d5774ea1c439b69c96e7fd485;hp=8d0d29595563f642264b4666989b5479812bc09f;hpb=d70c5fc7c56fa9915f594aca8de15b478f3ab5b0;p=deliverable%2Fbinutils-gdb.git diff --git a/cpu/xc16x.opc b/cpu/xc16x.opc index 8d0d295955..47b7c690e4 100644 --- a/cpu/xc16x.opc +++ b/cpu/xc16x.opc @@ -1,6 +1,6 @@ /* XC16X opcode support. -*- C -*- - Copyright 2006 Free Software Foundation, Inc. + Copyright 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by KPIT Cummins Infosystems Ltd.; developed under contract from Infineon Systems, GMBH , Germany. @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -59,8 +59,11 @@ parse_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, long *valuep ATTRIBUTE_UNUSED) { if (**strp == '#') - ++*strp; - return NULL; + { + ++*strp; + return NULL; + } + return _("Missing '#' prefix"); } /* Handle '.' prefixes (i.e. skip over them). */ @@ -72,11 +75,14 @@ parse_dot (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, long *valuep ATTRIBUTE_UNUSED) { if (**strp == '.') - ++*strp; - return NULL; + { + ++*strp; + return NULL; + } + return _("Missing '.' prefix"); } -/* Handle '.' prefixes (i.e. skip over them). */ +/* Handle 'pof:' prefixes (i.e. skip over them). */ static const char * parse_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, @@ -84,12 +90,15 @@ parse_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, int opindex ATTRIBUTE_UNUSED, long *valuep ATTRIBUTE_UNUSED) { - if (!strncasecmp (*strp, "pof:", 4)) - *strp += 4; - return NULL; + if (strncasecmp (*strp, "pof:", 4) == 0) + { + *strp += 4; + return NULL; + } + return _("Missing 'pof:' prefix"); } -/* Handle '.' prefixes (i.e. skip over them). */ +/* Handle 'pag:' prefixes (i.e. skip over them). */ static const char * parse_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, @@ -97,51 +106,107 @@ parse_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, int opindex ATTRIBUTE_UNUSED, long *valuep ATTRIBUTE_UNUSED) { - if (!strncasecmp (*strp, "pag:", 4)) - *strp += 4; - return NULL; + if (strncasecmp (*strp, "pag:", 4) == 0) + { + *strp += 4; + return NULL; + } + return _("Missing 'pag:' prefix"); } /* Handle 'sof' prefixes (i.e. skip over them). */ + static const char * parse_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp, int opindex ATTRIBUTE_UNUSED, long *valuep ATTRIBUTE_UNUSED) { - if (!strncasecmp (*strp, "sof:", 4)) - *strp += 4; - return NULL; + if (strncasecmp (*strp, "sof:", 4) == 0) + { + *strp += 4; + return NULL; + } + return _("Missing 'sof:' prefix"); } /* Handle 'seg' prefixes (i.e. skip over them). */ + static const char * parse_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp, int opindex ATTRIBUTE_UNUSED, long *valuep ATTRIBUTE_UNUSED) { - if (!strncasecmp (*strp, "seg:", 4)) - *strp += 4; - return NULL; + if (strncasecmp (*strp, "seg:", 4) == 0) + { + *strp += 4; + return NULL; + } + return _("Missing 'seg:' prefix"); } /* -- */ /* -- dis.c */ -#define CGEN_PRINT_NORMAL(cd, info, value, attrs, pc, length) \ - do \ - { \ - if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_DOT_PREFIX)) \ - info->fprintf_func (info->stream, "."); \ - if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_POF_PREFIX)) \ - info->fprintf_func (info->stream, "#pof:"); \ - if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_PAG_PREFIX)) \ - info->fprintf_func (info->stream, "#pag:"); \ - } \ - while (0) +/* Print an operand with a "." prefix. + NOTE: This prints the operand in hex. + ??? This exists to maintain disassembler compatibility with previous + versions. Ideally we'd print the "." in print_dot. */ + +static void +print_with_dot_prefix (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, + void * dis_info, + long value, + unsigned attrs ATTRIBUTE_UNUSED, + bfd_vma pc ATTRIBUTE_UNUSED, + int length ATTRIBUTE_UNUSED) +{ + disassemble_info *info = (disassemble_info *) dis_info; + + info->fprintf_func (info->stream, "."); + info->fprintf_func (info->stream, "0x%lx", value); +} + +/* Print an operand with a "#pof:" prefix. + NOTE: This prints the operand as an address. + ??? This exists to maintain disassembler compatibility with previous + versions. Ideally we'd print "#pof:" in print_pof. */ + +static void +print_with_pof_prefix (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, + void * dis_info, + bfd_vma value, + unsigned attrs ATTRIBUTE_UNUSED, + bfd_vma pc ATTRIBUTE_UNUSED, + int length ATTRIBUTE_UNUSED) +{ + disassemble_info *info = (disassemble_info *) dis_info; + + info->fprintf_func (info->stream, "#pof:"); + info->fprintf_func (info->stream, "0x%lx", (long) value); +} + +/* Print an operand with a "#pag:" prefix. + NOTE: This prints the operand in hex. + ??? This exists to maintain disassembler compatibility with previous + versions. Ideally we'd print "#pag:" in print_pag. */ + +static void +print_with_pag_prefix (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, + void * dis_info, + long value, + unsigned attrs ATTRIBUTE_UNUSED, + bfd_vma pc ATTRIBUTE_UNUSED, + int length ATTRIBUTE_UNUSED) +{ + disassemble_info *info = (disassemble_info *) dis_info; + + info->fprintf_func (info->stream, "#pag:"); + info->fprintf_func (info->stream, "0x%lx", value); +} -/* Handle '.' prefixes as operands. */ +/* Print a 'pof:' prefix to an operand. */ static void print_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, @@ -153,7 +218,7 @@ print_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, { } -/* Handle '.' prefixes as operands. */ +/* Print a 'pag:' prefix to an operand. */ static void print_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, @@ -165,7 +230,7 @@ print_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, { } -/* Handle '.' prefixes as operands. */ +/* Print a 'sof:' prefix to an operand. */ static void print_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, @@ -180,7 +245,7 @@ print_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, info->fprintf_func (info->stream, "sof:"); } -/* Handle '.' prefixes as operands. */ +/* Print a 'seg:' prefix to an operand. */ static void print_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, @@ -195,7 +260,7 @@ print_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, info->fprintf_func (info->stream, "seg:"); } -/* Handle '#' prefixes as operands. */ +/* Print a '#' prefix to an operand. */ static void print_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, @@ -210,7 +275,7 @@ print_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, info->fprintf_func (info->stream, "#"); } -/* Handle '.' prefixes as operands. */ +/* Print a '.' prefix to an operand. */ static void print_dot (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,