]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/igen/gen.h
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / sim / igen / gen.h
CommitLineData
feaee4bd
AC
1/* The IGEN simulator generator for GDB, the GNU Debugger.
2
8acc9f48 3 Copyright 2002-2013 Free Software Foundation, Inc.
feaee4bd
AC
4
5 Contributed by Andrew Cagney.
6
7 This file is part of GDB.
8
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
4744ac1b 11 the Free Software Foundation; either version 3 of the License, or
feaee4bd
AC
12 (at your option) any later version.
13
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.
18
19 You should have received a copy of the GNU General Public License
4744ac1b 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c
SS
21
22
23typedef struct _opcode_field opcode_field;
4e0bf4c4
AC
24struct _opcode_field
25{
c906108c
SS
26 int word_nr;
27 int first;
28 int last;
29 int is_boolean;
30 int nr_opcodes;
31 unsigned boolean_constant;
32 opcode_field *parent;
33};
34
35typedef struct _opcode_bits opcode_bits;
4e0bf4c4
AC
36struct _opcode_bits
37{
c906108c
SS
38 int value;
39 int first;
40 int last;
41 insn_field_entry *field;
42 opcode_field *opcode;
43 opcode_bits *next;
44};
45
46typedef struct _insn_opcodes insn_opcodes;
4e0bf4c4
AC
47struct _insn_opcodes
48{
c906108c
SS
49 opcode_field *opcode;
50 insn_opcodes *next;
51};
52
53typedef struct _insn_list insn_list;
4e0bf4c4
AC
54struct _insn_list
55{
c906108c
SS
56 /* the instruction */
57 insn_entry *insn;
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
61 instruction */
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 */
66 insn_list *semantic;
67 /* linked list */
68 insn_list *next;
69};
70
71/* forward */
72typedef struct _gen_list gen_list;
73
74typedef struct _gen_entry gen_entry;
4e0bf4c4
AC
75struct _gen_entry
76{
c906108c
SS
77
78 /* as an entry in a table */
79 int word_nr;
80 int opcode_nr;
81 gen_entry *sibling;
82 opcode_bits *expanded_bits;
4e0bf4c4 83 gen_entry *parent; /* parent has the opcode* data */
c906108c
SS
84
85 /* as a table containing entries */
86 decode_table *opcode_rule;
87 opcode_field *opcode;
88 int nr_prefetched_words;
89 int nr_entries;
90 gen_entry *entries;
91
92 /* as both an entry and a table */
93 int nr_insns;
94 insn_list *insns;
95
96 /* if siblings are being combined */
97 gen_entry *combined_next;
98 gen_entry *combined_parent;
99
100 /* our top-of-tree */
101 gen_list *top;
102};
103
104
4e0bf4c4
AC
105struct _gen_list
106{
c906108c
SS
107 model_entry *model;
108 insn_table *isa;
109 gen_entry *table;
110 gen_list *next;
111};
112
113
114typedef struct _gen_table gen_table;
4e0bf4c4
AC
115struct _gen_table
116{
c906108c
SS
117 /* list of all the instructions */
118 insn_table *isa;
119 /* list of all the semantic functions */
120 decode_table *rules;
121 /* list of all the generated instruction tables */
122 gen_list *tables;
123 /* list of all the semantic functions */
124 int nr_semantics;
125 insn_list *semantics;
126};
127
128
4e0bf4c4 129extern gen_table *make_gen_tables (insn_table *isa, decode_table *rules);
c906108c
SS
130
131
4e0bf4c4 132extern void gen_tables_expand_insns (gen_table *gen);
c906108c 133
4e0bf4c4 134extern void gen_tables_expand_semantics (gen_table *gen);
c906108c 135
4e0bf4c4 136extern int gen_entry_depth (gen_entry *table);
c906108c
SS
137
138
139
140/* Traverse the created data structure */
141
142typedef void gen_entry_handler
4e0bf4c4 143 (lf *file, gen_entry *entry, int depth, void *data);
c906108c
SS
144
145extern void gen_entry_traverse_tree
4e0bf4c4
AC
146 (lf *file,
147 gen_entry *table,
148 int depth,
149 gen_entry_handler * start,
150 gen_entry_handler * leaf, gen_entry_handler * end, void *data);
c906108c
SS
151
152
153
154/* Misc functions - actually in igen.c */
155
156
157/* Cache functions: */
158
4e0bf4c4 159extern int print_icache_function_formal (lf *file, int nr_prefetched_words);
c906108c 160
4e0bf4c4 161extern int print_icache_function_actual (lf *file, int nr_prefetched_words);
c906108c 162
4e0bf4c4 163extern int print_icache_function_type (lf *file);
c906108c 164
4e0bf4c4 165extern int print_semantic_function_formal (lf *file, int nr_prefetched_words);
c906108c 166
4e0bf4c4 167extern int print_semantic_function_actual (lf *file, int nr_prefetched_words);
c906108c 168
4e0bf4c4 169extern int print_semantic_function_type (lf *file);
c906108c 170
4e0bf4c4 171extern int print_idecode_function_formal (lf *file, int nr_prefetched_words);
c906108c 172
4e0bf4c4 173extern int print_idecode_function_actual (lf *file, int nr_prefetched_words);
c906108c 174
4e0bf4c4
AC
175typedef enum
176{
c906108c
SS
177 function_name_prefix_semantics,
178 function_name_prefix_idecode,
179 function_name_prefix_itable,
180 function_name_prefix_icache,
181 function_name_prefix_engine,
182 function_name_prefix_none
4e0bf4c4
AC
183}
184lf_function_name_prefixes;
c906108c 185
4e0bf4c4
AC
186typedef enum
187{
c906108c
SS
188 is_function_declaration = 0,
189 is_function_definition = 1,
190 is_function_variable,
4e0bf4c4
AC
191}
192function_decl_type;
c906108c
SS
193
194extern int print_function_name
4e0bf4c4
AC
195 (lf *file,
196 const char *basename,
197 const char *format_name,
198 const char *model_name,
199 opcode_bits *expanded_bits, lf_function_name_prefixes prefix);
c906108c
SS
200
201extern void print_my_defines
4e0bf4c4
AC
202 (lf *file,
203 const char *basename, const char *format_name, opcode_bits *expanded_bits);
c906108c 204
4e0bf4c4 205extern void print_itrace (lf *file, insn_entry * insn, int idecode);
c906108c 206
4e0bf4c4 207extern void print_sim_engine_abort (lf *file, const char *message);
c906108c
SS
208
209
210extern void print_include (lf *file, igen_module module);
4e0bf4c4 211extern void print_include_inline (lf *file, igen_module module);
c906108c 212extern void print_includes (lf *file);