More updated translations
[binutils-gdb.git] / sim / igen / gen.h
blobab64faab1ba4186bd11b4e7f48db326761b32fb7
1 /* The IGEN simulator generator for GDB, the GNU Debugger.
3 Copyright 2002-2024 Free Software Foundation, Inc.
5 Contributed by Andrew Cagney.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 #ifndef IGEN_GEN_H
23 #define IGEN_GEN_H
25 typedef struct _opcode_field opcode_field;
26 struct _opcode_field
28 int word_nr;
29 int first;
30 int last;
31 int is_boolean;
32 int nr_opcodes;
33 unsigned boolean_constant;
34 opcode_field *parent;
37 typedef struct _opcode_bits opcode_bits;
38 struct _opcode_bits
40 int value;
41 int first;
42 int last;
43 insn_field_entry *field;
44 opcode_field *opcode;
45 opcode_bits *next;
48 typedef struct _insn_opcodes insn_opcodes;
49 struct _insn_opcodes
51 opcode_field *opcode;
52 insn_opcodes *next;
55 typedef struct _insn_list insn_list;
56 struct _insn_list
58 /* the instruction */
59 insn_entry *insn;
60 /* list of non constant bits that have been made constant */
61 opcode_bits *expanded_bits;
62 /* list of the various opcode field paths used to reach this
63 instruction */
64 insn_opcodes *opcodes;
65 /* number of prefetched words for this instruction */
66 int nr_prefetched_words;
67 /* The semantic function list_entry corresponding to this insn */
68 insn_list *semantic;
69 /* linked list */
70 insn_list *next;
73 /* forward */
74 typedef struct _gen_list gen_list;
76 typedef struct _gen_entry gen_entry;
77 struct _gen_entry
80 /* as an entry in a table */
81 int word_nr;
82 int opcode_nr;
83 gen_entry *sibling;
84 opcode_bits *expanded_bits;
85 gen_entry *parent; /* parent has the opcode* data */
87 /* as a table containing entries */
88 const decode_table *opcode_rule;
89 opcode_field *opcode;
90 int nr_prefetched_words;
91 int nr_entries;
92 gen_entry *entries;
94 /* as both an entry and a table */
95 int nr_insns;
96 insn_list *insns;
98 /* if siblings are being combined */
99 gen_entry *combined_next;
100 gen_entry *combined_parent;
102 /* our top-of-tree */
103 gen_list *top;
107 struct _gen_list
109 const model_entry *model;
110 const insn_table *isa;
111 gen_entry *table;
112 gen_list *next;
116 typedef struct _gen_table gen_table;
117 struct _gen_table
119 /* list of all the instructions */
120 const insn_table *isa;
121 /* list of all the semantic functions */
122 const decode_table *rules;
123 /* list of all the generated instruction tables */
124 gen_list *tables;
125 /* list of all the semantic functions */
126 int nr_semantics;
127 insn_list *semantics;
131 extern gen_table *make_gen_tables
132 (const insn_table *isa, const decode_table *rules);
135 extern void gen_tables_expand_insns (gen_table *gen);
137 extern void gen_tables_expand_semantics (gen_table *gen);
139 extern int gen_entry_depth (const gen_entry *table);
143 /* Traverse the created data structure */
145 typedef void gen_entry_handler
146 (lf *file, const gen_entry *entry, int depth, void *data);
148 extern void gen_entry_traverse_tree
149 (lf *file,
150 const gen_entry *table,
151 int depth,
152 gen_entry_handler * start,
153 gen_entry_handler * leaf, gen_entry_handler * end, void *data);
157 /* Misc functions - actually in igen.c */
160 /* Cache functions: */
162 extern int print_icache_function_formal (lf *file, int nr_prefetched_words);
164 extern int print_icache_function_actual (lf *file, int nr_prefetched_words);
166 extern int print_icache_function_type (lf *file);
168 extern int print_semantic_function_formal (lf *file, int nr_prefetched_words);
170 extern int print_semantic_function_actual (lf *file, int nr_prefetched_words);
172 extern int print_semantic_function_type (lf *file);
174 extern int print_idecode_function_formal (lf *file, int nr_prefetched_words);
176 extern int print_idecode_function_actual (lf *file, int nr_prefetched_words);
178 typedef enum
180 function_name_prefix_semantics,
181 function_name_prefix_idecode,
182 function_name_prefix_itable,
183 function_name_prefix_icache,
184 function_name_prefix_engine,
185 function_name_prefix_none
187 lf_function_name_prefixes;
189 typedef enum
191 is_function_declaration = 0,
192 is_function_definition = 1,
193 is_function_variable,
195 function_decl_type;
197 extern int print_function_name
198 (lf *file,
199 const char *basename,
200 const char *format_name,
201 const char *model_name,
202 const opcode_bits *expanded_bits,
203 lf_function_name_prefixes prefix);
205 extern void print_my_defines
206 (lf *file,
207 const char *basename,
208 const char *format_name,
209 const opcode_bits *expanded_bits);
211 extern void print_itrace (lf *file, const insn_entry *insn, int idecode);
213 extern void print_sim_engine_abort (lf *file, const char *message);
216 extern void print_include (lf *file, igen_module module);
217 extern void print_include_inline (lf *file, igen_module module);
218 extern void print_includes (lf *file);
220 #endif /* IGEN_GEN_H */