Back to index

cell-binutils  2.17cvs20070401
itbl-ops.h
Go to the documentation of this file.
00001 /* itbl-ops.h
00002    Copyright 1997, 1999, 2000, 2003, 2006, 2007 Free Software Foundation, Inc.
00003 
00004    This file is part of GAS, the GNU Assembler.
00005 
00006    GAS is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    GAS is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with GAS; see the file COPYING.  If not, write to the Free
00018    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
00019    02110-1301, USA.  */
00020 
00021 /* External functions, constants and defines for itbl support */
00022 
00023 #ifdef HAVE_ITBL_CPU
00024 #include "itbl-cpu.h"
00025 #endif
00026 
00027 /* Defaults for definitions required by generic code */
00028 #ifndef ITBL_NUMBER_OF_PROCESSORS
00029 #define ITBL_NUMBER_OF_PROCESSORS 1
00030 #endif
00031 
00032 #ifndef ITBL_MAX_BITPOS
00033 #define ITBL_MAX_BITPOS 31
00034 #endif
00035 
00036 #ifndef ITBL_TYPE
00037 #define ITBL_TYPE unsigned long
00038 #endif
00039 
00040 #ifndef ITBL_IS_INSN
00041 #define ITBL_IS_INSN(insn) 1
00042 #endif
00043 
00044 #ifndef ITBL_DECODE_PNUM
00045 #define ITBL_DECODE_PNUM(insn) 0
00046 #endif
00047 
00048 #ifndef ITBL_ENCODE_PNUM
00049 #define ITBL_ENCODE_PNUM(pnum) 0
00050 #endif
00051 
00052 typedef ITBL_TYPE t_insn;
00053 
00054 /* types of entries */
00055 typedef enum
00056   {
00057     e_insn,
00058     e_dreg,
00059     e_regtype0 = e_dreg,
00060     e_creg,
00061     e_greg,
00062     e_addr,
00063     e_nregtypes = e_greg + 1,
00064     e_immed,
00065     e_ntypes,
00066     e_invtype               /* invalid type */
00067   } e_type;
00068 
00069 typedef enum
00070   {
00071     e_p0,
00072     e_nprocs = ITBL_NUMBER_OF_PROCESSORS,
00073     e_invproc               /* invalid processor */
00074   } e_processor;
00075 
00076 /* 0 means an instruction table was not specified.  */
00077 extern int itbl_have_entries;
00078 
00079 /* These routines are visible to the main part of the assembler */
00080 
00081 int itbl_parse (char *insntbl);
00082 void itbl_init (void);
00083 char *itbl_get_field (char **s);
00084 unsigned long itbl_assemble (char *name, char *operands);
00085 int itbl_disassemble (char *str, unsigned long insn);
00086 int itbl_parse (char *tbl); /* parses insn tbl */
00087 int itbl_get_reg_val (char *name, unsigned long *pval);
00088 int itbl_get_val (e_processor processor, e_type type, char *name,
00089                 unsigned long *pval);
00090 char *itbl_get_name (e_processor processor, e_type type, unsigned long val);
00091 
00092 /* These routines are called by the table parser used to build the
00093    dynamic list of new processor instructions and registers.  */
00094 
00095 struct itbl_entry *itbl_add_reg (int yyproc, int yytype,
00096                              char *regname, int regnum);
00097 struct itbl_entry *itbl_add_insn (int yyproc, char *name,
00098             unsigned long value, int sbit, int ebit, unsigned long flags);
00099 struct itbl_field *itbl_add_operand (struct itbl_entry * e, int yytype,
00100                               int sbit, int ebit, unsigned long flags);