itbl-ops.h revision 77298
133965Sjdp/* itbl-ops.h 277298Sobrien Copyright (C) 1997, 1999, 2000 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 1833965Sjdp Software Foundation, 59 Temple Place - Suite 330, Boston, MA 1933965Sjdp 02111-1307, USA. */ 2033965Sjdp 2133965Sjdp/* External functions, constants and defines for itbl support */ 2233965Sjdp 2333965Sjdp#include "ansidecl.h" 2433965Sjdp 2533965Sjdp/* Include file notes: "expr.h" needed before targ-*.h, 2633965Sjdp * "targ-env.h" includes the chain of target dependant headers, 2733965Sjdp * "targ-cpu.h" has the HAVE_ITBL_CPU define, and 2833965Sjdp * as.h includes them all */ 2933965Sjdp#include "as.h" 3033965Sjdp 3133965Sjdp#ifdef HAVE_ITBL_CPU 3233965Sjdp#include "itbl-cpu.h" 3333965Sjdp#endif 3433965Sjdp 3533965Sjdp/* Defaults for definitions required by generic code */ 3633965Sjdp#ifndef ITBL_NUMBER_OF_PROCESSORS 3733965Sjdp#define ITBL_NUMBER_OF_PROCESSORS 1 3833965Sjdp#endif 3933965Sjdp 4033965Sjdp#ifndef ITBL_MAX_BITPOS 4133965Sjdp#define ITBL_MAX_BITPOS 31 4233965Sjdp#endif 4333965Sjdp 4433965Sjdp#ifndef ITBL_TYPE 4533965Sjdp#define ITBL_TYPE unsigned long 4633965Sjdp#endif 4733965Sjdp 4833965Sjdp#ifndef ITBL_IS_INSN 4933965Sjdp#define ITBL_IS_INSN(insn) 1 5033965Sjdp#endif 5133965Sjdp 5233965Sjdp#ifndef ITBL_DECODE_PNUM 5333965Sjdp#define ITBL_DECODE_PNUM(insn) 0 5433965Sjdp#endif 5533965Sjdp 5633965Sjdp#ifndef ITBL_ENCODE_PNUM 5733965Sjdp#define ITBL_ENCODE_PNUM(pnum) 0 5833965Sjdp#endif 5933965Sjdp 6033965Sjdptypedef ITBL_TYPE t_insn; 6133965Sjdp 6233965Sjdp/* types of entries */ 6333965Sjdptypedef enum 6433965Sjdp { 6533965Sjdp e_insn, 6633965Sjdp e_dreg, 6733965Sjdp e_regtype0 = e_dreg, 6833965Sjdp e_creg, 6933965Sjdp e_greg, 7033965Sjdp e_addr, 7133965Sjdp e_nregtypes = e_greg + 1, 7233965Sjdp e_immed, 7333965Sjdp e_ntypes, 7433965Sjdp e_invtype /* invalid type */ 7533965Sjdp } e_type; 7633965Sjdp 7733965Sjdptypedef enum 7833965Sjdp { 7933965Sjdp e_p0, 8033965Sjdp e_nprocs = NUMBER_OF_PROCESSORS, 8133965Sjdp e_invproc /* invalid processor */ 8233965Sjdp } e_processor; 8333965Sjdp 8477298Sobrien/* 0 means an instruction table was not specified. */ 8533965Sjdpextern int itbl_have_entries; 8633965Sjdp 8733965Sjdp/* These routines are visible to the main part of the assembler */ 8833965Sjdp 8933965Sjdpint itbl_parse PARAMS ((char *insntbl)); 9033965Sjdpvoid itbl_init PARAMS ((void)); 9133965Sjdpchar *itbl_get_field PARAMS ((char **s)); 9233965Sjdpunsigned long itbl_assemble PARAMS ((char *name, char *operands)); 9333965Sjdpint itbl_disassemble PARAMS ((char *str, unsigned long insn)); 9433965Sjdpint itbl_parse PARAMS ((char *tbl)); /* parses insn tbl */ 9560484Sobrienint itbl_get_reg_val PARAMS ((char *name, unsigned long *pval)); 9660484Sobrienint itbl_get_val PARAMS ((e_processor processor, e_type type, char *name, 9760484Sobrien unsigned long *pval)); 9833965Sjdpchar *itbl_get_name PARAMS ((e_processor processor, e_type type, 9933965Sjdp unsigned long val)); 10033965Sjdp 10133965Sjdp/* These routines are called by the table parser used to build the 10277298Sobrien dynamic list of new processor instructions and registers. */ 10333965Sjdp 10433965Sjdpstruct itbl_entry *itbl_add_reg PARAMS ((int yyproc, int yytype, 10533965Sjdp char *regname, int regnum)); 10633965Sjdpstruct itbl_entry *itbl_add_insn PARAMS ((int yyproc, char *name, 10733965Sjdp unsigned long value, int sbit, int ebit, unsigned long flags)); 10833965Sjdpstruct itbl_field *itbl_add_operand PARAMS ((struct itbl_entry * e, int yytype, 10933965Sjdp int sbit, int ebit, unsigned long flags)); 110