gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / sim / ppc / ld-insn.h
CommitLineData
c906108c
SS
1/* This file is part of the program psim.
2
d81bb16a 3 Copyright 1994, 1995, 1996, 2003 Andrew Cagney
c906108c
SS
4
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
3fd725ef 7 the Free Software Foundation; either version 3 of the License, or
c906108c
SS
8 (at your option) any later version.
9
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.
14
15 You should have received a copy of the GNU General Public License
51b318de 16 along with this program; if not, see <http://www.gnu.org/licenses/>.
c906108c
SS
17
18 */
19
20/*
21# --
22#
23#
24# Fields:
25#
26# 1 Instruction format as a `start-bit,content' pairs.
27# the content is one of a digit, field name or `/' (aka.0)
28#
29# 2 Format specifier
30#
31# 3 Flags: 64 - 64bit only
32# f - floating point enabled required
33#
34# 4 short name
35#
36# 5 Description
37#
38#
39# For flags marked 'model', the fields are interpreted as follows:
40#
41# 1 Not used
42#
43# 2 Not used
44#
45# 3 "macro"
46#
47# 4 String name for model
48#
49# 5 Specific CPU model, must be an identifier
50#
51# 6 Comma separated list of functional units
52
53*/
54
55
56/* Global constants */
57
58enum {
59 max_insn_bit_size = 32,
60};
61
62
63typedef struct _insn_field insn_field;
64struct _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;
76};
77
78typedef struct _insn_fields insn_fields;
79struct _insn_fields {
80 insn_field *bits[max_insn_bit_size];
81 insn_field *first;
82 insn_field *last;
83 unsigned value;
84};
85
86
87/****************************************************************/
88
89typedef struct _opcode_field opcode_field;
90struct _opcode_field {
91 int first;
92 int last;
93 int is_boolean;
94 unsigned boolean_constant;
95 opcode_field *parent;
96};
97
98
99/****************************************************************/
100
101typedef struct _insn_bits insn_bits;
102struct _insn_bits {
103 int is_expanded;
104 int value;
105 insn_field *field;
106 opcode_field *opcode;
107 insn_bits *last;
108};
109
110
111/****************************************************************/
112
113
114typedef enum {
115 insn_format,
116 insn_form,
117 insn_flags,
118 insn_mnemonic,
119 insn_name,
120 insn_comment,
d81bb16a
AC
121 insn_field_6,
122 insn_field_7,
c906108c
SS
123 nr_insn_table_fields
124} insn_table_fields;
125
126typedef enum {
127 function_type = insn_format,
128 function_name = insn_name,
129 function_param = insn_comment
130} function_table_fields;
131
132typedef enum {
133 model_name = insn_mnemonic,
134 model_identifer = insn_name,
135 model_default = insn_comment,
136} model_table_fields;
137
43c4bab0
MG
138typedef enum {
139 include_flags = insn_flags,
140 include_path = insn_name,
141} model_include_fields;
142
d81bb16a
AC
143typedef 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;
149
c906108c
SS
150typedef struct _insn insn;
151struct _insn {
152 table_entry *file_entry;
153 insn_fields *fields;
154 insn *next;
155};
156
157typedef struct _insn_undef insn_undef;
158struct _insn_undef {
159 insn_undef *next;
160 char *name;
161};
162
163typedef struct _model model;
164struct _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;
171};
172
173typedef struct _insn_table insn_table;
174struct _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;
187};
188
189typedef enum {
190 insn_model_name,
191 insn_model_fields,
192 nr_insn_model_table_fields
193} insn_model_table_fields;
194
195
196extern insn_table *load_insn_table
197(const char *file_name,
198 decode_table *decode_rules,
43c4bab0 199 filter *filters,
d81bb16a
AC
200 table_include *includes,
201 cache_table **cache_rules);
c906108c
SS
202
203model *models;
204model *last_model;
205
206insn *model_macros;
207insn *last_model_macro;
208
209insn *model_functions;
210insn *last_model_function;
211
212insn *model_internal;
213insn *last_model_internal;
214
215insn *model_static;
216insn *last_model_static;
217
218insn *model_data;
219insn *last_model_data;
220
221int max_model_fields_len;
222
223extern void insn_table_insert_insn
224(insn_table *table,
225 table_entry *file_entry,
226 insn_fields *fields);
227
228
229/****************************************************************/
230
231/****************************************************************/
232
233typedef void leaf_handler
234(insn_table *entry,
235 lf *file,
236 void *data,
237 int depth);
238
239typedef void insn_handler
240(insn_table *table,
241 lf *file,
242 void *data,
243 insn *instruction,
244 int depth);
245
246typedef void padding_handler
247(insn_table *table,
248 lf *file,
249 void *data,
250 int depth,
251 int opcode_nr);
252
253
254extern 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);
263
264
265extern void insn_table_traverse_insn
266(insn_table *table,
267 lf *file,
268 void *data,
269 insn_handler *handler);
270
271
272
273/****************************************************************/
274
275typedef void function_handler
276(insn_table *table,
277 lf *file,
278 void *data,
279 table_entry *function);
280
281extern void
282insn_table_traverse_function
283(insn_table *table,
284 lf *file,
285 void *data,
286 function_handler *leaf);
287
288/****************************************************************/
289
290
291
292extern void insn_table_expand_insns
293(insn_table *table);
294
295extern int insn_table_depth
296(insn_table *table);
This page took 1.016332 seconds and 4 git commands to generate.