1 /* Internal definitions for configurable Xtensa ISA support.
2 Copyright 2003 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 /* Use the statically-linked version for the GNU tools. */
21 #define STATIC_LIBISA 1
23 #define ISA_INTERFACE_VERSION 3
31 /* Encode/decode function types for immediate operands. */
32 typedef uint32 (*xtensa_immed_decode_fn
) (uint32
);
33 typedef xtensa_encode_result (*xtensa_immed_encode_fn
) (uint32
*);
35 /* Field accessor function types. */
36 typedef uint32 (*xtensa_get_field_fn
) (const xtensa_insnbuf
);
37 typedef void (*xtensa_set_field_fn
) (xtensa_insnbuf
, uint32
);
39 /* PC-relative relocation function types. */
40 typedef uint32 (*xtensa_do_reloc_fn
) (uint32
, uint32
);
41 typedef uint32 (*xtensa_undo_reloc_fn
) (uint32
, uint32
);
43 /* Instruction decode function type. */
44 typedef int (*xtensa_insn_decode_fn
) (const xtensa_insnbuf
);
46 /* Instruction encoding template function type (each of these functions
47 returns a constant template; they exist only to make it easier for the
48 TIE compiler to generate endian-independent DLLs). */
49 typedef xtensa_insnbuf (*xtensa_encoding_template_fn
) (void);
52 typedef struct xtensa_operand_internal_struct
54 char *operand_kind
; /* e.g., "a", "f", "i", "l".... */
55 char inout
; /* '<', '>', or '='. */
56 char isPCRelative
; /* Is this a PC-relative offset? */
57 xtensa_get_field_fn get_field
; /* Get encoded value of the field. */
58 xtensa_set_field_fn set_field
; /* Set field with an encoded value. */
59 xtensa_immed_encode_fn encode
; /* Encode the operand value. */
60 xtensa_immed_decode_fn decode
; /* Decode the value from the field. */
61 xtensa_do_reloc_fn do_reloc
; /* Perform a PC-relative relocation. */
62 xtensa_undo_reloc_fn undo_reloc
; /* Undo a PC-relative relocation. */
63 } xtensa_operand_internal
;
66 typedef struct xtensa_iclass_internal_struct
68 int num_operands
; /* Size of "operands" array. */
69 xtensa_operand_internal
**operands
; /* Array of operand structures. */
70 } xtensa_iclass_internal
;
73 typedef struct xtensa_opcode_internal_struct
75 const char *name
; /* Opcode mnemonic. */
76 int length
; /* Length in bytes of the insn. */
77 xtensa_encoding_template_fn
template; /* Fn returning encoding template. */
78 xtensa_iclass_internal
*iclass
; /* Iclass for this opcode. */
79 } xtensa_opcode_internal
;
82 typedef struct opname_lookup_entry_struct
84 const char *key
; /* Opcode mnemonic. */
85 xtensa_opcode opcode
; /* Internal opcode number. */
86 } opname_lookup_entry
;
89 typedef struct xtensa_isa_internal_struct
91 int is_big_endian
; /* Endianness. */
92 int insn_size
; /* Maximum length in bytes. */
93 int insnbuf_size
; /* Number of insnbuf_words. */
94 int num_opcodes
; /* Total number for all modules. */
95 xtensa_opcode_internal
**opcode_table
;/* Indexed by internal opcode #. */
96 int num_modules
; /* Number of modules (DLLs) loaded. */
97 int *module_opcode_base
; /* Starting opcode # for each module. */
98 xtensa_insn_decode_fn
*module_decode_fn
; /* Decode fn for each module. */
99 opname_lookup_entry
*opname_lookup_table
; /* Lookup table for each module. */
100 struct config_struct
*config
; /* Table of configuration parameters. */
101 int has_density
; /* Is density option available? */
102 } xtensa_isa_internal
;
105 typedef struct xtensa_isa_module_struct
107 const int (*get_num_opcodes_fn
) (void);
108 xtensa_opcode_internal
**(*get_opcodes_fn
) (void);
109 int (*decode_insn_fn
) (const xtensa_insnbuf
);
110 struct config_struct
*(*get_config_table_fn
) (void);
113 extern xtensa_isa_module xtensa_isa_modules
[];