OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [sim/] [ppc/] [ld-insn.h] - Blame information for rev 816

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/*  This file is part of the program psim.
2
 
3
    Copyright 1994, 1995, 1996, 2003 Andrew Cagney
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
7
    the Free Software Foundation; either version 2 of the License, or
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
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.
18
 
19
    */
20
 
21
/*
22
#   --
23
#
24
#
25
# Fields:
26
#
27
#       1       Instruction format as a `start-bit,content' pairs.
28
#               the content is one of a digit, field name or `/' (aka.0)
29
#
30
#       2       Format specifier
31
#
32
#       3       Flags:  64 - 64bit only
33
#                       f - floating point enabled required
34
#
35
#       4       short name
36
#
37
#       5       Description
38
#
39
#
40
# For flags marked 'model', the fields are interpreted as follows:
41
#
42
#       1       Not used
43
#
44
#       2       Not used
45
#
46
#       3       "macro"
47
#
48
#       4       String name for model
49
#
50
#       5       Specific CPU model, must be an identifier
51
#
52
#       6       Comma separated list of functional units
53
 
54
*/
55
 
56
 
57
/* Global constants */
58
 
59
enum {
60
  max_insn_bit_size = 32,
61
};
62
 
63
 
64
typedef struct _insn_field insn_field;
65
struct _insn_field {
66
  int first;
67
  int last;
68
  int width;
69
  int is_int;
70
  int is_slash;
71
  int is_string;
72
  int val_int;
73
  char *pos_string;
74
  char *val_string;
75
  insn_field *next;
76
  insn_field *prev;
77
};
78
 
79
typedef struct _insn_fields insn_fields;
80
struct _insn_fields {
81
  insn_field *bits[max_insn_bit_size];
82
  insn_field *first;
83
  insn_field *last;
84
  unsigned value;
85
};
86
 
87
 
88
/****************************************************************/
89
 
90
typedef struct _opcode_field opcode_field;
91
struct _opcode_field {
92
  int first;
93
  int last;
94
  int is_boolean;
95
  unsigned boolean_constant;
96
  opcode_field *parent;
97
};
98
 
99
 
100
/****************************************************************/
101
 
102
typedef struct _insn_bits insn_bits;
103
struct _insn_bits {
104
  int is_expanded;
105
  int value;
106
  insn_field *field;
107
  opcode_field *opcode;
108
  insn_bits *last;
109
};
110
 
111
 
112
/****************************************************************/
113
 
114
 
115
typedef enum {
116
  insn_format,
117
  insn_form,
118
  insn_flags,
119
  insn_mnemonic,
120
  insn_name,
121
  insn_comment,
122
  insn_field_6,
123
  insn_field_7,
124
  nr_insn_table_fields
125
} insn_table_fields;
126
 
127
typedef enum {
128
  function_type = insn_format,
129
  function_name = insn_name,
130
  function_param = insn_comment
131
} function_table_fields;
132
 
133
typedef enum {
134
  model_name = insn_mnemonic,
135
  model_identifer = insn_name,
136
  model_default = insn_comment,
137
} model_table_fields;
138
 
139
typedef enum {
140
  include_flags = insn_flags,
141
  include_path = insn_name,
142
} model_include_fields;
143
 
144
typedef enum {
145
  cache_type_def = insn_name,
146
  cache_derived_name = insn_comment,
147
  cache_name = insn_field_6,
148
  cache_expression = insn_field_7,
149
} cache_fields;
150
 
151
typedef struct _insn insn;
152
struct _insn {
153
  table_entry *file_entry;
154
  insn_fields *fields;
155
  insn *next;
156
};
157
 
158
typedef struct _insn_undef insn_undef;
159
struct _insn_undef {
160
  insn_undef *next;
161
  char *name;
162
};
163
 
164
typedef struct _model model;
165
struct _model {
166
  model *next;
167
  char *name;
168
  char *printable_name;
169
  char *insn_default;
170
  table_model_entry *func_unit_start;
171
  table_model_entry *func_unit_end;
172
};
173
 
174
typedef struct _insn_table insn_table;
175
struct _insn_table {
176
  int opcode_nr;
177
  insn_bits *expanded_bits;
178
  int nr_insn;
179
  insn *insns;
180
  insn *functions;
181
  insn *last_function;
182
  decode_table *opcode_rule;
183
  opcode_field *opcode;
184
  int nr_entries;
185
  insn_table *entries;
186
  insn_table *sibling;
187
  insn_table *parent;
188
};
189
 
190
typedef enum {
191
  insn_model_name,
192
  insn_model_fields,
193
  nr_insn_model_table_fields
194
} insn_model_table_fields;
195
 
196
 
197
extern insn_table *load_insn_table
198
(const char *file_name,
199
 decode_table *decode_rules,
200
 filter *filters,
201
 table_include *includes,
202
 cache_table **cache_rules);
203
 
204
model *models;
205
model *last_model;
206
 
207
insn *model_macros;
208
insn *last_model_macro;
209
 
210
insn *model_functions;
211
insn *last_model_function;
212
 
213
insn *model_internal;
214
insn *last_model_internal;
215
 
216
insn *model_static;
217
insn *last_model_static;
218
 
219
insn *model_data;
220
insn *last_model_data;
221
 
222
int max_model_fields_len;
223
 
224
extern void insn_table_insert_insn
225
(insn_table *table,
226
 table_entry *file_entry,
227
 insn_fields *fields);
228
 
229
 
230
/****************************************************************/
231
 
232
/****************************************************************/
233
 
234
typedef void leaf_handler
235
(insn_table *entry,
236
 lf *file,
237
 void *data,
238
 int depth);
239
 
240
typedef void insn_handler
241
(insn_table *table,
242
 lf *file,
243
 void *data,
244
 insn *instruction,
245
 int depth);
246
 
247
typedef void padding_handler
248
(insn_table *table,
249
 lf *file,
250
 void *data,
251
 int depth,
252
 int opcode_nr);
253
 
254
 
255
extern void insn_table_traverse_tree
256
(insn_table *table,
257
 lf *file,
258
 void *data,
259
 int depth,
260
 leaf_handler *start,
261
 insn_handler *handler,
262
 leaf_handler *end,
263
 padding_handler *padding);
264
 
265
 
266
extern void insn_table_traverse_insn
267
(insn_table *table,
268
 lf *file,
269
 void *data,
270
 insn_handler *handler);
271
 
272
 
273
 
274
/****************************************************************/
275
 
276
typedef void function_handler
277
(insn_table *table,
278
 lf *file,
279
 void *data,
280
 table_entry *function);
281
 
282
extern void
283
insn_table_traverse_function
284
(insn_table *table,
285
 lf *file,
286
 void *data,
287
 function_handler *leaf);
288
 
289
/****************************************************************/
290
 
291
 
292
 
293
extern void insn_table_expand_insns
294
(insn_table *table);
295
 
296
extern int insn_table_depth
297
(insn_table *table);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.