1130803Smarcel/* Internal definitions for configurable Xtensa ISA support. 2130803Smarcel Copyright 2003 Free Software Foundation, Inc. 3130803Smarcel 4130803Smarcel This file is part of BFD, the Binary File Descriptor library. 5130803Smarcel 6130803Smarcel This program is free software; you can redistribute it and/or modify 7130803Smarcel it under the terms of the GNU General Public License as published by 8130803Smarcel the Free Software Foundation; either version 2 of the License, or 9130803Smarcel (at your option) any later version. 10130803Smarcel 11130803Smarcel This program is distributed in the hope that it will be useful, 12130803Smarcel but WITHOUT ANY WARRANTY; without even the implied warranty of 13130803Smarcel MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14130803Smarcel GNU General Public License for more details. 15130803Smarcel 16130803Smarcel You should have received a copy of the GNU General Public License 17130803Smarcel along with this program; if not, write to the Free Software 18130803Smarcel Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 19130803Smarcel 20130803Smarcel/* Use the statically-linked version for the GNU tools. */ 21130803Smarcel#define STATIC_LIBISA 1 22130803Smarcel 23130803Smarcel#define ISA_INTERFACE_VERSION 3 24130803Smarcel 25130803Smarcelstruct config_struct 26130803Smarcel{ 27130803Smarcel char *param_name; 28130803Smarcel char *param_value; 29130803Smarcel}; 30130803Smarcel 31130803Smarcel/* Encode/decode function types for immediate operands. */ 32130803Smarceltypedef uint32 (*xtensa_immed_decode_fn) (uint32); 33130803Smarceltypedef xtensa_encode_result (*xtensa_immed_encode_fn) (uint32 *); 34130803Smarcel 35130803Smarcel/* Field accessor function types. */ 36130803Smarceltypedef uint32 (*xtensa_get_field_fn) (const xtensa_insnbuf); 37130803Smarceltypedef void (*xtensa_set_field_fn) (xtensa_insnbuf, uint32); 38130803Smarcel 39130803Smarcel/* PC-relative relocation function types. */ 40130803Smarceltypedef uint32 (*xtensa_do_reloc_fn) (uint32, uint32); 41130803Smarceltypedef uint32 (*xtensa_undo_reloc_fn) (uint32, uint32); 42130803Smarcel 43130803Smarcel/* Instruction decode function type. */ 44130803Smarceltypedef int (*xtensa_insn_decode_fn) (const xtensa_insnbuf); 45130803Smarcel 46130803Smarcel/* Instruction encoding template function type (each of these functions 47130803Smarcel returns a constant template; they exist only to make it easier for the 48130803Smarcel TIE compiler to generate endian-independent DLLs). */ 49130803Smarceltypedef xtensa_insnbuf (*xtensa_encoding_template_fn) (void); 50130803Smarcel 51130803Smarcel 52130803Smarceltypedef struct xtensa_operand_internal_struct 53130803Smarcel{ 54130803Smarcel char *operand_kind; /* e.g., "a", "f", "i", "l".... */ 55130803Smarcel char inout; /* '<', '>', or '='. */ 56130803Smarcel char isPCRelative; /* Is this a PC-relative offset? */ 57130803Smarcel xtensa_get_field_fn get_field; /* Get encoded value of the field. */ 58130803Smarcel xtensa_set_field_fn set_field; /* Set field with an encoded value. */ 59130803Smarcel xtensa_immed_encode_fn encode; /* Encode the operand value. */ 60130803Smarcel xtensa_immed_decode_fn decode; /* Decode the value from the field. */ 61130803Smarcel xtensa_do_reloc_fn do_reloc; /* Perform a PC-relative relocation. */ 62130803Smarcel xtensa_undo_reloc_fn undo_reloc; /* Undo a PC-relative relocation. */ 63130803Smarcel} xtensa_operand_internal; 64130803Smarcel 65130803Smarcel 66130803Smarceltypedef struct xtensa_iclass_internal_struct 67130803Smarcel{ 68130803Smarcel int num_operands; /* Size of "operands" array. */ 69130803Smarcel xtensa_operand_internal **operands; /* Array of operand structures. */ 70130803Smarcel} xtensa_iclass_internal; 71130803Smarcel 72130803Smarcel 73130803Smarceltypedef struct xtensa_opcode_internal_struct 74130803Smarcel{ 75130803Smarcel const char *name; /* Opcode mnemonic. */ 76130803Smarcel int length; /* Length in bytes of the insn. */ 77130803Smarcel xtensa_encoding_template_fn template; /* Fn returning encoding template. */ 78130803Smarcel xtensa_iclass_internal *iclass; /* Iclass for this opcode. */ 79130803Smarcel} xtensa_opcode_internal; 80130803Smarcel 81130803Smarcel 82130803Smarceltypedef struct opname_lookup_entry_struct 83130803Smarcel{ 84130803Smarcel const char *key; /* Opcode mnemonic. */ 85130803Smarcel xtensa_opcode opcode; /* Internal opcode number. */ 86130803Smarcel} opname_lookup_entry; 87130803Smarcel 88130803Smarcel 89130803Smarceltypedef struct xtensa_isa_internal_struct 90130803Smarcel{ 91130803Smarcel int is_big_endian; /* Endianness. */ 92130803Smarcel int insn_size; /* Maximum length in bytes. */ 93130803Smarcel int insnbuf_size; /* Number of insnbuf_words. */ 94130803Smarcel int num_opcodes; /* Total number for all modules. */ 95130803Smarcel xtensa_opcode_internal **opcode_table;/* Indexed by internal opcode #. */ 96130803Smarcel int num_modules; /* Number of modules (DLLs) loaded. */ 97130803Smarcel int *module_opcode_base; /* Starting opcode # for each module. */ 98130803Smarcel xtensa_insn_decode_fn *module_decode_fn; /* Decode fn for each module. */ 99130803Smarcel opname_lookup_entry *opname_lookup_table; /* Lookup table for each module. */ 100130803Smarcel struct config_struct *config; /* Table of configuration parameters. */ 101130803Smarcel int has_density; /* Is density option available? */ 102130803Smarcel} xtensa_isa_internal; 103130803Smarcel 104130803Smarcel 105130803Smarceltypedef struct xtensa_isa_module_struct 106130803Smarcel{ 107130803Smarcel int (*get_num_opcodes_fn) (void); 108130803Smarcel xtensa_opcode_internal **(*get_opcodes_fn) (void); 109130803Smarcel int (*decode_insn_fn) (const xtensa_insnbuf); 110130803Smarcel struct config_struct *(*get_config_table_fn) (void); 111130803Smarcel} xtensa_isa_module; 112130803Smarcel 113130803Smarcelextern xtensa_isa_module xtensa_isa_modules[]; 114130803Smarcel 115