X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=cpu%2Ffrv.opc;h=1b0b05c29a061cb1d33076aed7e3893cc1179d6d;hb=acdf84a65400f416c60a0c9c14953ba5a73fb0cd;hp=b2f1d1e4ff884e7fd9f92db7a75627d15247721a;hpb=9b201bb5e5daa9b4f783e6ece9cbfbdbf9f1d6f4;p=deliverable%2Fbinutils-gdb.git diff --git a/cpu/frv.opc b/cpu/frv.opc index b2f1d1e4ff..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, 2007 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. @@ -77,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. */ @@ -496,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 @@ -806,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; } @@ -841,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; @@ -849,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) @@ -877,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])) @@ -897,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; } @@ -1339,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;