1 /* The IGEN simulator generator for GDB, the GNU Debugger.
3 Copyright 2002-2023 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/>. */
23 typedef struct _opcode_field opcode_field
;
31 unsigned boolean_constant
;
35 typedef struct _opcode_bits opcode_bits
;
41 insn_field_entry
*field
;
46 typedef struct _insn_opcodes insn_opcodes
;
53 typedef struct _insn_list insn_list
;
58 /* list of non constant bits that have been made constant */
59 opcode_bits
*expanded_bits
;
60 /* list of the various opcode field paths used to reach this
62 insn_opcodes
*opcodes
;
63 /* number of prefetched words for this instruction */
64 int nr_prefetched_words
;
65 /* The semantic function list_entry corresponding to this insn */
72 typedef struct _gen_list gen_list
;
74 typedef struct _gen_entry gen_entry
;
78 /* as an entry in a table */
82 opcode_bits
*expanded_bits
;
83 gen_entry
*parent
; /* parent has the opcode* data */
85 /* as a table containing entries */
86 const decode_table
*opcode_rule
;
88 int nr_prefetched_words
;
92 /* as both an entry and a table */
96 /* if siblings are being combined */
97 gen_entry
*combined_next
;
98 gen_entry
*combined_parent
;
100 /* our top-of-tree */
107 const model_entry
*model
;
108 const insn_table
*isa
;
114 typedef struct _gen_table gen_table
;
117 /* list of all the instructions */
118 const insn_table
*isa
;
119 /* list of all the semantic functions */
120 const decode_table
*rules
;
121 /* list of all the generated instruction tables */
123 /* list of all the semantic functions */
125 insn_list
*semantics
;
129 extern gen_table
*make_gen_tables
130 (const insn_table
*isa
, const decode_table
*rules
);
133 extern void gen_tables_expand_insns (gen_table
*gen
);
135 extern void gen_tables_expand_semantics (gen_table
*gen
);
137 extern int gen_entry_depth (const gen_entry
*table
);
141 /* Traverse the created data structure */
143 typedef void gen_entry_handler
144 (lf
*file
, const gen_entry
*entry
, int depth
, void *data
);
146 extern void gen_entry_traverse_tree
148 const gen_entry
*table
,
150 gen_entry_handler
* start
,
151 gen_entry_handler
* leaf
, gen_entry_handler
* end
, void *data
);
155 /* Misc functions - actually in igen.c */
158 /* Cache functions: */
160 extern int print_icache_function_formal (lf
*file
, int nr_prefetched_words
);
162 extern int print_icache_function_actual (lf
*file
, int nr_prefetched_words
);
164 extern int print_icache_function_type (lf
*file
);
166 extern int print_semantic_function_formal (lf
*file
, int nr_prefetched_words
);
168 extern int print_semantic_function_actual (lf
*file
, int nr_prefetched_words
);
170 extern int print_semantic_function_type (lf
*file
);
172 extern int print_idecode_function_formal (lf
*file
, int nr_prefetched_words
);
174 extern int print_idecode_function_actual (lf
*file
, int nr_prefetched_words
);
178 function_name_prefix_semantics
,
179 function_name_prefix_idecode
,
180 function_name_prefix_itable
,
181 function_name_prefix_icache
,
182 function_name_prefix_engine
,
183 function_name_prefix_none
185 lf_function_name_prefixes
;
189 is_function_declaration
= 0,
190 is_function_definition
= 1,
191 is_function_variable
,
195 extern int print_function_name
197 const char *basename
,
198 const char *format_name
,
199 const char *model_name
,
200 const opcode_bits
*expanded_bits
,
201 lf_function_name_prefixes prefix
);
203 extern void print_my_defines
205 const char *basename
,
206 const char *format_name
,
207 const opcode_bits
*expanded_bits
);
209 extern void print_itrace (lf
*file
, const insn_entry
*insn
, int idecode
);
211 extern void print_sim_engine_abort (lf
*file
, const char *message
);
214 extern void print_include (lf
*file
, igen_module module
);
215 extern void print_include_inline (lf
*file
, igen_module module
);
216 extern void print_includes (lf
*file
);