1 /* This file is part of the program psim.
3 Copyright 1994, 1995, 1996, 2003 Andrew Cagney
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 # 1 Instruction format as a `start-bit,content' pairs.
28 # the content is one of a digit, field name or `/' (aka.0)
32 # 3 Flags: 64 - 64bit only
33 # f - floating point enabled required
40 # For flags marked 'model', the fields are interpreted as follows:
48 # 4 String name for model
50 # 5 Specific CPU model, must be an identifier
52 # 6 Comma separated list of functional units
57 /* Global constants */
60 max_insn_bit_size
= 32,
64 typedef struct _insn_field insn_field
;
79 typedef struct _insn_fields insn_fields
;
81 insn_field
*bits
[max_insn_bit_size
];
88 /****************************************************************/
90 typedef struct _opcode_field opcode_field
;
91 struct _opcode_field
{
95 unsigned boolean_constant
;
100 /****************************************************************/
102 typedef struct _insn_bits insn_bits
;
107 opcode_field
*opcode
;
112 /****************************************************************/
128 function_type
= insn_format
,
129 function_name
= insn_name
,
130 function_param
= insn_comment
131 } function_table_fields
;
134 model_name
= insn_mnemonic
,
135 model_identifer
= insn_name
,
136 model_default
= insn_comment
,
137 } model_table_fields
;
140 include_flags
= insn_flags
,
141 include_path
= insn_name
,
142 } model_include_fields
;
145 cache_type_def
= insn_name
,
146 cache_derived_name
= insn_comment
,
147 cache_name
= insn_field_6
,
148 cache_expression
= insn_field_7
,
151 typedef struct _insn insn
;
153 table_entry
*file_entry
;
158 typedef struct _insn_undef insn_undef
;
164 typedef struct _model model
;
168 char *printable_name
;
170 table_model_entry
*func_unit_start
;
171 table_model_entry
*func_unit_end
;
174 typedef struct _insn_table insn_table
;
177 insn_bits
*expanded_bits
;
182 decode_table
*opcode_rule
;
183 opcode_field
*opcode
;
193 nr_insn_model_table_fields
194 } insn_model_table_fields
;
197 extern insn_table
*load_insn_table
198 (const char *file_name
,
199 decode_table
*decode_rules
,
201 table_include
*includes
,
202 cache_table
**cache_rules
);
208 insn
*last_model_macro
;
210 insn
*model_functions
;
211 insn
*last_model_function
;
213 insn
*model_internal
;
214 insn
*last_model_internal
;
217 insn
*last_model_static
;
220 insn
*last_model_data
;
222 int max_model_fields_len
;
224 extern void insn_table_insert_insn
226 table_entry
*file_entry
,
227 insn_fields
*fields
);
230 /****************************************************************/
232 /****************************************************************/
234 typedef void leaf_handler
240 typedef void insn_handler
247 typedef void padding_handler
255 extern void insn_table_traverse_tree
261 insn_handler
*handler
,
263 padding_handler
*padding
);
266 extern void insn_table_traverse_insn
270 insn_handler
*handler
);
274 /****************************************************************/
276 typedef void function_handler
280 table_entry
*function
);
283 insn_table_traverse_function
287 function_handler
*leaf
);
289 /****************************************************************/
293 extern void insn_table_expand_insns
296 extern int insn_table_depth