X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=cpu%2Ffrv.opc;h=1b0b05c29a061cb1d33076aed7e3893cc1179d6d;hb=eff93b4d48eb0e79b7879475bb47eec55dbb41be;hp=5d2dc896039a74486a7469e5b21d91d3cadd89c4;hpb=95b965212b3172ac5dbf9a4d6afbf40eb0b9ab68;p=deliverable%2Fbinutils-gdb.git diff --git a/cpu/frv.opc b/cpu/frv.opc index 5d2dc89603..1b0b05c29a 100644 --- a/cpu/frv.opc +++ b/cpu/frv.opc @@ -1,6 +1,7 @@ /* Fujitsu FRV opcode support, for GNU Binutils. -*- C -*- - Copyright 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright 2000, 2001, 2003, 2004, 2005, 2007, 2009 + Free Software Foundation, Inc. Contributed by Red Hat Inc; developed under contract from Fujitsu. @@ -8,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, @@ -21,6 +22,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + /* This file is an addendum to frv.cpu. Heavy use of C code isn't appropriate in .cpu files, so it resides here. This especially applies to assembly/disassembly where parsing/printing can be quite involved. @@ -76,9 +78,13 @@ int spr_valid (long); /* -- */ /* -- opc.c */ +#include "opintl.h" #include "elf/frv.h" #include +/* DEBUG appears below as argument of OP macro. */ +#undef DEBUG + /* Returns TRUE if {MAJOR,MACH} is a major branch of the FRV development tree. */ @@ -495,9 +501,9 @@ add_next_to_vliw (FRV_VLIW *vliw, CGEN_ATTR_VALUE_ENUM_TYPE unit) if (next <= 0) { - fprintf (stderr, "frv-opc.c line %d: bad vliw->next_slot value.\n", - __LINE__); - abort (); /* Should never happen. */ + /* xgettext:c-format */ + opcodes_error_handler (_("internal error: bad vliw->next_slot value")); + abort (); } /* The table is sorted by units allowed within slots, so vliws with @@ -805,8 +811,8 @@ fr500_check_insn_major_constraints (FRV_VLIW *vliw, CGEN_ATTR_VALUE_ENUM_TYPE ma && ! find_major_in_vliw (vliw, FR500_MAJOR_F_6) && ! find_major_in_vliw (vliw, FR500_MAJOR_F_7); default: - fprintf (stderr, "frv-opc.c, line %d: bad major code, aborting.\n", - __LINE__); + /* xgettext:c-format */ + opcodes_error_handler (_("internal error: bad major code")); abort (); break; } @@ -840,7 +846,7 @@ check_insn_major_constraints (FRV_VLIW *vliw, int frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) { - int index; + int slot_index; CGEN_ATTR_VALUE_ENUM_TYPE major; CGEN_ATTR_VALUE_ENUM_TYPE unit; VLIW_COMBO *new_vliw; @@ -848,16 +854,16 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) if (vliw->constraint_violation || CGEN_INSN_INVALID_P (insn)) return 1; - index = vliw->next_slot; - if (index >= FRV_VLIW_SIZE) + slot_index = vliw->next_slot; + if (slot_index >= FRV_VLIW_SIZE) return 1; unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT); if (unit == UNIT_NIL) { - fprintf (stderr, "frv-opc.c line %d: bad insn unit.\n", - __LINE__); - abort (); /* No UNIT specified for this insn in frv.cpu. */ + /* xgettext:c-format */ + opcodes_error_handler (_("internal error: bad insn unit")); + abort (); } switch (vliw->mach) @@ -876,7 +882,7 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) break; } - if (index <= 0) + if (slot_index <= 0) { /* Any insn can be added to slot 0. */ while (! match_unit (vliw, unit, (*vliw->current_vliw)[0])) @@ -896,8 +902,8 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) if (new_vliw && check_insn_major_constraints (vliw, major, insn)) { vliw->current_vliw = new_vliw; - vliw->major[index] = major; - vliw->insn[index] = insn; + vliw->major[slot_index] = major; + vliw->insn[slot_index] = insn; vliw->next_slot++; return 0; } @@ -1338,11 +1344,11 @@ parse_uhi16 (CGEN_CPU_DESC cd, if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) { - /* If bfd_vma is wider than 32 bits, but we have a sign- - or zero-extension, truncate it. */ - if (value >= - ((bfd_vma)1 << 31) - || value <= ((bfd_vma)1 << 31) - (bfd_vma)1) - value &= (((bfd_vma)1 << 16) << 16) - 1; + /* If value is wider than 32 bits then be + careful about how we extract bits 16-31. */ + if (sizeof (value) > 4) + value &= (((bfd_vma)1 << 16) << 16) - 1; + value >>= 16; } *valuep = value;