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 3 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, see <http://www.gnu.org/licenses/>.
26 # 1 Instruction format as a `start-bit,content' pairs.
27 # the content is one of a digit, field name or `/' (aka.0)
31 # 3 Flags: 64 - 64bit only
32 # f - floating point enabled required
39 # For flags marked 'model', the fields are interpreted as follows:
47 # 4 String name for model
49 # 5 Specific CPU model, must be an identifier
51 # 6 Comma separated list of functional units
56 /* Global constants */
59 max_insn_bit_size = 32,
63 typedef struct _insn_field insn_field;
78 typedef struct _insn_fields insn_fields;
80 insn_field *bits[max_insn_bit_size];
87 /****************************************************************/
89 typedef struct _opcode_field opcode_field;
90 struct _opcode_field {
94 unsigned boolean_constant;
99 /****************************************************************/
101 typedef struct _insn_bits insn_bits;
106 opcode_field *opcode;
111 /****************************************************************/
127 function_type = insn_format,
128 function_name = insn_name,
129 function_param = insn_comment
130 } function_table_fields;
133 model_name = insn_mnemonic,
134 model_identifer = insn_name,
135 model_default = insn_comment,
136 } model_table_fields;
139 include_flags = insn_flags,
140 include_path = insn_name,
141 } model_include_fields;
144 cache_type_def = insn_name,
145 cache_derived_name = insn_comment,
146 cache_name = insn_field_6,
147 cache_expression = insn_field_7,
150 typedef struct _insn insn;
152 table_entry *file_entry;
157 typedef struct _insn_undef insn_undef;
163 typedef struct _model model;
167 char *printable_name;
169 table_model_entry *func_unit_start;
170 table_model_entry *func_unit_end;
173 typedef struct _insn_table insn_table;
176 insn_bits *expanded_bits;
181 decode_table *opcode_rule;
182 opcode_field *opcode;
192 nr_insn_model_table_fields
193 } insn_model_table_fields;
196 extern insn_table *load_insn_table
197 (const char *file_name,
198 decode_table *decode_rules,
200 table_include *includes,
201 cache_table **cache_rules);
207 insn *last_model_macro;
209 insn *model_functions;
210 insn *last_model_function;
212 insn *model_internal;
213 insn *last_model_internal;
216 insn *last_model_static;
219 insn *last_model_data;
221 int max_model_fields_len;
223 extern void insn_table_insert_insn
225 table_entry *file_entry,
226 insn_fields *fields);
229 /****************************************************************/
231 /****************************************************************/
233 typedef void leaf_handler
239 typedef void insn_handler
246 typedef void padding_handler
254 extern void insn_table_traverse_tree
260 insn_handler *handler,
262 padding_handler *padding);
265 extern void insn_table_traverse_insn
269 insn_handler *handler);
273 /****************************************************************/
275 typedef void function_handler
279 table_entry *function);
282 insn_table_traverse_function
286 function_handler *leaf);
288 /****************************************************************/
292 extern void insn_table_expand_insns
295 extern int insn_table_depth