itbl-ops.h revision 130562
160786Sps/* itbl-ops.h
260786Sps   Copyright 1997, 1999, 2000 Free Software Foundation, Inc.
360786Sps
460786Sps   This file is part of GAS, the GNU Assembler.
560786Sps
660786Sps   GAS is free software; you can redistribute it and/or modify
760786Sps   it under the terms of the GNU General Public License as published by
860786Sps   the Free Software Foundation; either version 2, or (at your option)
960786Sps   any later version.
1060786Sps
1160786Sps   GAS is distributed in the hope that it will be useful,
1260786Sps   but WITHOUT ANY WARRANTY; without even the implied warranty of
1360786Sps   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1460786Sps   GNU General Public License for more details.
1560786Sps
1660786Sps   You should have received a copy of the GNU General Public License
1760786Sps   along with GAS; see the file COPYING.  If not, write to the Free
1860786Sps   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
1960786Sps   02111-1307, USA.  */
2060786Sps
2160786Sps/* External functions, constants and defines for itbl support */
2260786Sps
2360786Sps#include "ansidecl.h"
2460786Sps
2560786Sps/* Include file notes: "expr.h" needed before targ-*.h,
2660786Sps * "targ-env.h" includes the chain of target dependant headers,
2760786Sps * "targ-cpu.h" has the HAVE_ITBL_CPU define, and
2860786Sps * as.h includes them all */
2960786Sps#include "as.h"
3060786Sps
3160786Sps#ifdef HAVE_ITBL_CPU
3260786Sps#include "itbl-cpu.h"
3360786Sps#endif
3460786Sps
3589019Sps/* Defaults for definitions required by generic code */
3660786Sps#ifndef ITBL_NUMBER_OF_PROCESSORS
3789019Sps#define ITBL_NUMBER_OF_PROCESSORS 1
3860786Sps#endif
3960786Sps
4060786Sps#ifndef ITBL_MAX_BITPOS
4160786Sps#define ITBL_MAX_BITPOS 31
4260786Sps#endif
4360786Sps
4460786Sps#ifndef ITBL_TYPE
4589019Sps#define ITBL_TYPE unsigned long
4689019Sps#endif
4789019Sps
4889019Sps#ifndef ITBL_IS_INSN
4989019Sps#define ITBL_IS_INSN(insn) 1
5089019Sps#endif
5189019Sps
5289019Sps#ifndef ITBL_DECODE_PNUM
5389019Sps#define ITBL_DECODE_PNUM(insn) 0
5460786Sps#endif
5560786Sps
5660786Sps#ifndef ITBL_ENCODE_PNUM
5760786Sps#define ITBL_ENCODE_PNUM(pnum) 0
5860786Sps#endif
5960786Sps
6060786Spstypedef ITBL_TYPE t_insn;
6160786Sps
6260786Sps/* types of entries */
6360786Spstypedef enum
6460786Sps  {
6560786Sps    e_insn,
6660786Sps    e_dreg,
6760786Sps    e_regtype0 = e_dreg,
6860786Sps    e_creg,
6960786Sps    e_greg,
7060786Sps    e_addr,
7160786Sps    e_nregtypes = e_greg + 1,
7260786Sps    e_immed,
7360786Sps    e_ntypes,
7460786Sps    e_invtype			/* invalid type */
7560786Sps  } e_type;
7660786Sps
7760786Spstypedef enum
7860786Sps  {
7960786Sps    e_p0,
8060786Sps    e_nprocs = NUMBER_OF_PROCESSORS,
8160786Sps    e_invproc			/* invalid processor */
8260786Sps  } e_processor;
8360786Sps
8460786Sps/* 0 means an instruction table was not specified.  */
8560786Spsextern int itbl_have_entries;
8660786Sps
8760786Sps/* These routines are visible to the main part of the assembler */
8860786Sps
8960786Spsint itbl_parse (char *insntbl);
9060786Spsvoid itbl_init (void);
9160786Spschar *itbl_get_field (char **s);
9260786Spsunsigned long itbl_assemble (char *name, char *operands);
9360786Spsint itbl_disassemble (char *str, unsigned long insn);
9460786Spsint itbl_parse (char *tbl);	/* parses insn tbl */
9560786Spsint itbl_get_reg_val (char *name, unsigned long *pval);
9660786Spsint itbl_get_val (e_processor processor, e_type type, char *name,
9760786Sps		  unsigned long *pval);
9860786Spschar *itbl_get_name (e_processor processor, e_type type, unsigned long val);
9960786Sps
10060786Sps/* These routines are called by the table parser used to build the
10160786Sps   dynamic list of new processor instructions and registers.  */
10260786Sps
10360786Spsstruct itbl_entry *itbl_add_reg (int yyproc, int yytype,
10460786Sps				 char *regname, int regnum);
10560786Spsstruct itbl_entry *itbl_add_insn (int yyproc, char *name,
10660786Sps	     unsigned long value, int sbit, int ebit, unsigned long flags);
10760786Spsstruct itbl_field *itbl_add_operand (struct itbl_entry * e, int yytype,
10860786Sps				  int sbit, int ebit, unsigned long flags);
10960786Sps