[PATCH 37/57][Arm][OBJDUMP] Add framework for MVE instructions
[binutils-gdb.git] / sim / ppc / ld-insn.h
blob88318ffa2b34d28888241b029660a5c0df4a8d0a
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/>.
21 # --
24 # Fields:
26 # 1 Instruction format as a `start-bit,content' pairs.
27 # the content is one of a digit, field name or `/' (aka.0)
29 # 2 Format specifier
31 # 3 Flags: 64 - 64bit only
32 # f - floating point enabled required
34 # 4 short name
36 # 5 Description
39 # For flags marked 'model', the fields are interpreted as follows:
41 # 1 Not used
43 # 2 Not used
45 # 3 "macro"
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 */
58 enum {
59 max_insn_bit_size = 32,
63 typedef struct _insn_field insn_field;
64 struct _insn_field {
65 int first;
66 int last;
67 int width;
68 int is_int;
69 int is_slash;
70 int is_string;
71 int val_int;
72 char *pos_string;
73 char *val_string;
74 insn_field *next;
75 insn_field *prev;
78 typedef struct _insn_fields insn_fields;
79 struct _insn_fields {
80 insn_field *bits[max_insn_bit_size];
81 insn_field *first;
82 insn_field *last;
83 unsigned value;
87 /****************************************************************/
89 typedef struct _opcode_field opcode_field;
90 struct _opcode_field {
91 int first;
92 int last;
93 int is_boolean;
94 unsigned boolean_constant;
95 opcode_field *parent;
99 /****************************************************************/
101 typedef struct _insn_bits insn_bits;
102 struct _insn_bits {
103 int is_expanded;
104 int value;
105 insn_field *field;
106 opcode_field *opcode;
107 insn_bits *last;
111 /****************************************************************/
114 typedef enum {
115 insn_format,
116 insn_form,
117 insn_flags,
118 insn_mnemonic,
119 insn_name,
120 insn_comment,
121 insn_field_6,
122 insn_field_7,
123 nr_insn_table_fields
124 } insn_table_fields;
126 typedef enum {
127 function_type = insn_format,
128 function_name = insn_name,
129 function_param = insn_comment
130 } function_table_fields;
132 typedef enum {
133 model_name = insn_mnemonic,
134 model_identifer = insn_name,
135 model_default = insn_comment,
136 } model_table_fields;
138 typedef enum {
139 include_flags = insn_flags,
140 include_path = insn_name,
141 } model_include_fields;
143 typedef enum {
144 cache_type_def = insn_name,
145 cache_derived_name = insn_comment,
146 cache_name = insn_field_6,
147 cache_expression = insn_field_7,
148 } cache_fields;
150 typedef struct _insn insn;
151 struct _insn {
152 table_entry *file_entry;
153 insn_fields *fields;
154 insn *next;
157 typedef struct _insn_undef insn_undef;
158 struct _insn_undef {
159 insn_undef *next;
160 char *name;
163 typedef struct _model model;
164 struct _model {
165 model *next;
166 char *name;
167 char *printable_name;
168 char *insn_default;
169 table_model_entry *func_unit_start;
170 table_model_entry *func_unit_end;
173 typedef struct _insn_table insn_table;
174 struct _insn_table {
175 int opcode_nr;
176 insn_bits *expanded_bits;
177 int nr_insn;
178 insn *insns;
179 insn *functions;
180 insn *last_function;
181 decode_table *opcode_rule;
182 opcode_field *opcode;
183 int nr_entries;
184 insn_table *entries;
185 insn_table *sibling;
186 insn_table *parent;
189 typedef enum {
190 insn_model_name,
191 insn_model_fields,
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,
199 filter *filters,
200 table_include *includes,
201 cache_table **cache_rules);
203 model *models;
204 model *last_model;
206 insn *model_macros;
207 insn *last_model_macro;
209 insn *model_functions;
210 insn *last_model_function;
212 insn *model_internal;
213 insn *last_model_internal;
215 insn *model_static;
216 insn *last_model_static;
218 insn *model_data;
219 insn *last_model_data;
221 int max_model_fields_len;
223 extern void insn_table_insert_insn
224 (insn_table *table,
225 table_entry *file_entry,
226 insn_fields *fields);
229 /****************************************************************/
231 /****************************************************************/
233 typedef void leaf_handler
234 (insn_table *entry,
235 lf *file,
236 void *data,
237 int depth);
239 typedef void insn_handler
240 (insn_table *table,
241 lf *file,
242 void *data,
243 insn *instruction,
244 int depth);
246 typedef void padding_handler
247 (insn_table *table,
248 lf *file,
249 void *data,
250 int depth,
251 int opcode_nr);
254 extern void insn_table_traverse_tree
255 (insn_table *table,
256 lf *file,
257 void *data,
258 int depth,
259 leaf_handler *start,
260 insn_handler *handler,
261 leaf_handler *end,
262 padding_handler *padding);
265 extern void insn_table_traverse_insn
266 (insn_table *table,
267 lf *file,
268 void *data,
269 insn_handler *handler);
273 /****************************************************************/
275 typedef void function_handler
276 (insn_table *table,
277 lf *file,
278 void *data,
279 table_entry *function);
281 extern void
282 insn_table_traverse_function
283 (insn_table *table,
284 lf *file,
285 void *data,
286 function_handler *leaf);
288 /****************************************************************/
292 extern void insn_table_expand_insns
293 (insn_table *table);
295 extern int insn_table_depth
296 (insn_table *table);