133965Sjdp/* itbl-ops.h 2218822Sdim Copyright 1997, 1999, 2000, 2003, 2006, 2007 Free Software Foundation, Inc. 333965Sjdp 433965Sjdp This file is part of GAS, the GNU Assembler. 533965Sjdp 633965Sjdp GAS is free software; you can redistribute it and/or modify 733965Sjdp it under the terms of the GNU General Public License as published by 833965Sjdp the Free Software Foundation; either version 2, or (at your option) 933965Sjdp any later version. 1033965Sjdp 1133965Sjdp GAS is distributed in the hope that it will be useful, 1233965Sjdp but WITHOUT ANY WARRANTY; without even the implied warranty of 1333965Sjdp MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1433965Sjdp GNU General Public License for more details. 1533965Sjdp 1633965Sjdp You should have received a copy of the GNU General Public License 1733965Sjdp along with GAS; see the file COPYING. If not, write to the Free 18218822Sdim Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 19218822Sdim 02110-1301, USA. */ 2033965Sjdp 2133965Sjdp/* External functions, constants and defines for itbl support */ 2233965Sjdp 2333965Sjdp#ifdef HAVE_ITBL_CPU 2433965Sjdp#include "itbl-cpu.h" 2533965Sjdp#endif 2633965Sjdp 2733965Sjdp/* Defaults for definitions required by generic code */ 2833965Sjdp#ifndef ITBL_NUMBER_OF_PROCESSORS 2933965Sjdp#define ITBL_NUMBER_OF_PROCESSORS 1 3033965Sjdp#endif 3133965Sjdp 3233965Sjdp#ifndef ITBL_MAX_BITPOS 3333965Sjdp#define ITBL_MAX_BITPOS 31 3433965Sjdp#endif 3533965Sjdp 3633965Sjdp#ifndef ITBL_TYPE 3733965Sjdp#define ITBL_TYPE unsigned long 3833965Sjdp#endif 3933965Sjdp 4033965Sjdp#ifndef ITBL_IS_INSN 4133965Sjdp#define ITBL_IS_INSN(insn) 1 4233965Sjdp#endif 4333965Sjdp 4433965Sjdp#ifndef ITBL_DECODE_PNUM 4533965Sjdp#define ITBL_DECODE_PNUM(insn) 0 4633965Sjdp#endif 4733965Sjdp 4833965Sjdp#ifndef ITBL_ENCODE_PNUM 4933965Sjdp#define ITBL_ENCODE_PNUM(pnum) 0 5033965Sjdp#endif 5133965Sjdp 5233965Sjdptypedef ITBL_TYPE t_insn; 5333965Sjdp 5433965Sjdp/* types of entries */ 5533965Sjdptypedef enum 5633965Sjdp { 5733965Sjdp e_insn, 5833965Sjdp e_dreg, 5933965Sjdp e_regtype0 = e_dreg, 6033965Sjdp e_creg, 6133965Sjdp e_greg, 6233965Sjdp e_addr, 6333965Sjdp e_nregtypes = e_greg + 1, 6433965Sjdp e_immed, 6533965Sjdp e_ntypes, 6633965Sjdp e_invtype /* invalid type */ 6733965Sjdp } e_type; 6833965Sjdp 6933965Sjdptypedef enum 7033965Sjdp { 7133965Sjdp e_p0, 72218822Sdim e_nprocs = ITBL_NUMBER_OF_PROCESSORS, 7333965Sjdp e_invproc /* invalid processor */ 7433965Sjdp } e_processor; 7533965Sjdp 7677298Sobrien/* 0 means an instruction table was not specified. */ 7733965Sjdpextern int itbl_have_entries; 7833965Sjdp 7933965Sjdp/* These routines are visible to the main part of the assembler */ 8033965Sjdp 81130561Sobrienint itbl_parse (char *insntbl); 82130561Sobrienvoid itbl_init (void); 83130561Sobrienchar *itbl_get_field (char **s); 84130561Sobrienunsigned long itbl_assemble (char *name, char *operands); 85130561Sobrienint itbl_disassemble (char *str, unsigned long insn); 86130561Sobrienint itbl_parse (char *tbl); /* parses insn tbl */ 87130561Sobrienint itbl_get_reg_val (char *name, unsigned long *pval); 88130561Sobrienint itbl_get_val (e_processor processor, e_type type, char *name, 89130561Sobrien unsigned long *pval); 90130561Sobrienchar *itbl_get_name (e_processor processor, e_type type, unsigned long val); 9133965Sjdp 9233965Sjdp/* These routines are called by the table parser used to build the 9377298Sobrien dynamic list of new processor instructions and registers. */ 9433965Sjdp 95130561Sobrienstruct itbl_entry *itbl_add_reg (int yyproc, int yytype, 96130561Sobrien char *regname, int regnum); 97130561Sobrienstruct itbl_entry *itbl_add_insn (int yyproc, char *name, 98130561Sobrien unsigned long value, int sbit, int ebit, unsigned long flags); 99130561Sobrienstruct itbl_field *itbl_add_operand (struct itbl_entry * e, int yytype, 100130561Sobrien int sbit, int ebit, unsigned long flags); 101