X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=opcodes%2Fip2k-opc.c;h=4e5f626c054f742e126eac150e96c7c3f3fd90b0;hb=1f730c46141c1513e72cb24d471834b448d6d0e6;hp=311a0f76d96ade74a95c721d922e654a11baa5d3;hpb=a40cbfa3c951ac0fcbdf8f98ab668beacca2b872;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/ip2k-opc.c b/opcodes/ip2k-opc.c index 311a0f76d9..4e5f626c05 100644 --- a/opcodes/ip2k-opc.c +++ b/opcodes/ip2k-opc.c @@ -1,24 +1,25 @@ +/* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */ /* Instruction opcode table for ip2k. THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. -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, or (at your option) -any later version. + This file 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 3, or (at your option) + any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -32,16 +33,17 @@ with this program; if not, write to the Free Software Foundation, Inc., /* -- opc.c */ -/* A better hash function for instruction mnemonics. */ +#include "safe-ctype.h" + +/* A better hash function for instruction mnemonics. */ unsigned int -ip2k_asm_hash (insn) - const char* insn; +ip2k_asm_hash (const char* insn) { unsigned int hash; const char* m = insn; - for (hash = 0; *m && !isspace(*m); m++) - hash = (hash * 23) ^ (0x1F & tolower(*m)); + for (hash = 0; *m && ! ISSPACE (*m); m++) + hash = (hash * 23) ^ (0x1F & TOLOWER (*m)); /* printf ("%s %d\n", insn, (hash % CGEN_ASM_HASH_SIZE)); */ @@ -49,80 +51,81 @@ ip2k_asm_hash (insn) } +/* Special check to ensure that instruction exists for given machine. */ + +int +ip2k_cgen_insn_supported (CGEN_CPU_DESC cd, const CGEN_INSN *insn) +{ + int machs = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH); + + /* No mach attribute? Assume it's supported for all machs. */ + if (machs == 0) + return 1; + + return (machs & cd->machs) != 0; +} /* -- asm.c */ /* The hash functions are recorded here to help keep assembler code out of the disassembler and vice versa. */ -static int asm_hash_insn_p PARAMS ((const CGEN_INSN *)); -static unsigned int asm_hash_insn PARAMS ((const char *)); -static int dis_hash_insn_p PARAMS ((const CGEN_INSN *)); -static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT)); +static int asm_hash_insn_p (const CGEN_INSN *); +static unsigned int asm_hash_insn (const char *); +static int dis_hash_insn_p (const CGEN_INSN *); +static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT); /* Instruction formats. */ -#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) #define F(f) & ip2k_cgen_ifld_table[IP2K_##f] -#else -#define F(f) & ip2k_cgen_ifld_table[IP2K_/**/f] -#endif -static const CGEN_IFMT ifmt_empty = { +static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED = { 0, 0, 0x0, { { 0 } } }; -static const CGEN_IFMT ifmt_jmp = { +static const CGEN_IFMT ifmt_jmp ATTRIBUTE_UNUSED = { 16, 16, 0xe000, { { F (F_OP3) }, { F (F_ADDR16CJP) }, { 0 } } }; -static const CGEN_IFMT ifmt_sb = { +static const CGEN_IFMT ifmt_sb ATTRIBUTE_UNUSED = { 16, 16, 0xf000, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } } }; -static const CGEN_IFMT ifmt_xorw_l = { +static const CGEN_IFMT ifmt_xorw_l ATTRIBUTE_UNUSED = { 16, 16, 0xff00, { { F (F_OP4) }, { F (F_OP4MID) }, { F (F_IMM8) }, { 0 } } }; -static const CGEN_IFMT ifmt_loadl_a = { +static const CGEN_IFMT ifmt_loadl_a ATTRIBUTE_UNUSED = { 16, 16, 0xff00, { { F (F_OP4) }, { F (F_OP4MID) }, { F (F_IMM8) }, { 0 } } }; -static const CGEN_IFMT ifmt_loadh_a = { +static const CGEN_IFMT ifmt_loadh_a ATTRIBUTE_UNUSED = { 16, 16, 0xff00, { { F (F_OP4) }, { F (F_OP4MID) }, { F (F_IMM8) }, { 0 } } }; -static const CGEN_IFMT ifmt_addcfr_w = { +static const CGEN_IFMT ifmt_addcfr_w ATTRIBUTE_UNUSED = { 16, 16, 0xfe00, { { F (F_OP6) }, { F (F_DIR) }, { F (F_REG) }, { 0 } } }; -static const CGEN_IFMT ifmt_speed = { +static const CGEN_IFMT ifmt_speed ATTRIBUTE_UNUSED = { 16, 16, 0xff00, { { F (F_OP8) }, { F (F_IMM8) }, { 0 } } }; -static const CGEN_IFMT ifmt_ireadi = { +static const CGEN_IFMT ifmt_ireadi ATTRIBUTE_UNUSED = { 16, 16, 0xffff, { { F (F_OP6) }, { F (F_OP6_10LOW) }, { 0 } } }; -static const CGEN_IFMT ifmt_page = { +static const CGEN_IFMT ifmt_page ATTRIBUTE_UNUSED = { 16, 16, 0xfff8, { { F (F_OP6) }, { F (F_OP6_7LOW) }, { F (F_PAGE3) }, { 0 } } }; -static const CGEN_IFMT ifmt_reti = { +static const CGEN_IFMT ifmt_reti ATTRIBUTE_UNUSED = { 16, 16, 0xfff8, { { F (F_OP6) }, { F (F_OP6_7LOW) }, { F (F_RETI3) }, { 0 } } }; #undef F -#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) #define A(a) (1 << CGEN_INSN_##a) -#else -#define A(a) (1 << CGEN_INSN_/**/a) -#endif -#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) #define OPERAND(op) IP2K_OPERAND_##op -#else -#define OPERAND(op) IP2K_OPERAND_/**/op -#endif #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */ #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field)) @@ -659,32 +662,28 @@ static const CGEN_OPCODE ip2k_cgen_insn_opcode_table[MAX_INSNS] = /* Formats for ALIAS macro-insns. */ -#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) #define F(f) & ip2k_cgen_ifld_table[IP2K_##f] -#else -#define F(f) & ip2k_cgen_ifld_table[IP2K_/**/f] -#endif -static const CGEN_IFMT ifmt_sc = { +static const CGEN_IFMT ifmt_sc ATTRIBUTE_UNUSED = { 16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } } }; -static const CGEN_IFMT ifmt_snc = { +static const CGEN_IFMT ifmt_snc ATTRIBUTE_UNUSED = { 16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } } }; -static const CGEN_IFMT ifmt_sz = { +static const CGEN_IFMT ifmt_sz ATTRIBUTE_UNUSED = { 16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } } }; -static const CGEN_IFMT ifmt_snz = { +static const CGEN_IFMT ifmt_snz ATTRIBUTE_UNUSED = { 16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } } }; -static const CGEN_IFMT ifmt_skip = { +static const CGEN_IFMT ifmt_skip ATTRIBUTE_UNUSED = { 16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } } }; -static const CGEN_IFMT ifmt_skipb = { +static const CGEN_IFMT ifmt_skipb ATTRIBUTE_UNUSED = { 16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } } }; @@ -692,16 +691,8 @@ static const CGEN_IFMT ifmt_skipb = { /* Each non-simple macro entry points to an array of expansion possibilities. */ -#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) #define A(a) (1 << CGEN_INSN_##a) -#else -#define A(a) (1 << CGEN_INSN_/**/a) -#endif -#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) #define OPERAND(op) IP2K_OPERAND_##op -#else -#define OPERAND(op) IP2K_OPERAND_/**/op -#endif #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */ #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field)) @@ -712,32 +703,32 @@ static const CGEN_IBASE ip2k_cgen_macro_insn_table[] = /* sc */ { -1, "sc", "sc", 16, - { 0|A(ALIAS), { (1<= 1) + memset (insns, 0, num_macros * sizeof (CGEN_INSN)); for (i = 0; i < num_macros; ++i) { insns[i].base = &ib[i];