itbl-ops.h revision 302408
1130812Smarcel/* itbl-ops.h
2130812Smarcel   Copyright 1997, 1999, 2000, 2003, 2006, 2007 Free Software Foundation, Inc.
3130812Smarcel
4130812Smarcel   This file is part of GAS, the GNU Assembler.
5130812Smarcel
6130812Smarcel   GAS is free software; you can redistribute it and/or modify
7130812Smarcel   it under the terms of the GNU General Public License as published by
8130812Smarcel   the Free Software Foundation; either version 2, or (at your option)
9130812Smarcel   any later version.
10130812Smarcel
11130812Smarcel   GAS is distributed in the hope that it will be useful,
12130812Smarcel   but WITHOUT ANY WARRANTY; without even the implied warranty of
13130812Smarcel   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14130812Smarcel   GNU General Public License for more details.
15130812Smarcel
16130812Smarcel   You should have received a copy of the GNU General Public License
17130812Smarcel   along with GAS; see the file COPYING.  If not, write to the Free
18130812Smarcel   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19130812Smarcel   02110-1301, USA.  */
20130812Smarcel
21130812Smarcel/* External functions, constants and defines for itbl support */
22130812Smarcel
23130812Smarcel#ifdef HAVE_ITBL_CPU
24130812Smarcel#include "itbl-cpu.h"
25130812Smarcel#endif
26130812Smarcel
27130812Smarcel/* Defaults for definitions required by generic code */
28130812Smarcel#ifndef ITBL_NUMBER_OF_PROCESSORS
29130812Smarcel#define ITBL_NUMBER_OF_PROCESSORS 1
30130812Smarcel#endif
31130812Smarcel
32130812Smarcel#ifndef ITBL_MAX_BITPOS
33130812Smarcel#define ITBL_MAX_BITPOS 31
34130812Smarcel#endif
35130812Smarcel
36130812Smarcel#ifndef ITBL_TYPE
37130812Smarcel#define ITBL_TYPE unsigned long
38130812Smarcel#endif
39130812Smarcel
40130812Smarcel#ifndef ITBL_IS_INSN
41130812Smarcel#define ITBL_IS_INSN(insn) 1
42130812Smarcel#endif
43130812Smarcel
44130812Smarcel#ifndef ITBL_DECODE_PNUM
45130812Smarcel#define ITBL_DECODE_PNUM(insn) 0
46130812Smarcel#endif
47130812Smarcel
48130812Smarcel#ifndef ITBL_ENCODE_PNUM
49130812Smarcel#define ITBL_ENCODE_PNUM(pnum) 0
50130812Smarcel#endif
51130812Smarcel
52130812Smarceltypedef ITBL_TYPE t_insn;
53130812Smarcel
54130812Smarcel/* types of entries */
55130812Smarceltypedef enum
56130812Smarcel  {
57130812Smarcel    e_insn,
58130812Smarcel    e_dreg,
59130812Smarcel    e_regtype0 = e_dreg,
60130812Smarcel    e_creg,
61130812Smarcel    e_greg,
62130812Smarcel    e_addr,
63130812Smarcel    e_nregtypes = e_greg + 1,
64130812Smarcel    e_immed,
65130812Smarcel    e_ntypes,
66130812Smarcel    e_invtype			/* invalid type */
67130812Smarcel  } e_type;
68130812Smarcel
69130812Smarceltypedef enum
70130812Smarcel  {
71130812Smarcel    e_p0,
72130812Smarcel    e_nprocs = ITBL_NUMBER_OF_PROCESSORS,
73130812Smarcel    e_invproc			/* invalid processor */
74130812Smarcel  } e_processor;
75130812Smarcel
76130812Smarcel/* 0 means an instruction table was not specified.  */
77130812Smarcelextern int itbl_have_entries;
78130812Smarcel
79130812Smarcel/* These routines are visible to the main part of the assembler */
80130812Smarcel
81130812Smarcelint itbl_parse (char *insntbl);
82130812Smarcelvoid itbl_init (void);
83130812Smarcelchar *itbl_get_field (char **s);
84130812Smarcelunsigned long itbl_assemble (char *name, char *operands);
85130812Smarcelint itbl_disassemble (char *str, unsigned long insn);
86130812Smarcelint itbl_parse (char *tbl);	/* parses insn tbl */
87130812Smarcelint itbl_get_reg_val (char *name, unsigned long *pval);
88130812Smarcelint itbl_get_val (e_processor processor, e_type type, char *name,
89130812Smarcel		  unsigned long *pval);
90130812Smarcelchar *itbl_get_name (e_processor processor, e_type type, unsigned long val);
91130812Smarcel
92130812Smarcel/* These routines are called by the table parser used to build the
93130812Smarcel   dynamic list of new processor instructions and registers.  */
94130812Smarcel
95130812Smarcelstruct itbl_entry *itbl_add_reg (int yyproc, int yytype,
96130812Smarcel				 char *regname, int regnum);
97130812Smarcelstruct itbl_entry *itbl_add_insn (int yyproc, char *name,
98130812Smarcel	     unsigned long value, int sbit, int ebit, unsigned long flags);
99130812Smarcelstruct itbl_field *itbl_add_operand (struct itbl_entry * e, int yytype,
100130812Smarcel				  int sbit, int ebit, unsigned long flags);
101130812Smarcel