68
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 /* MD reader definitions.
|
145
|
2 Copyright (C) 1987-2020 Free Software Foundation, Inc.
|
68
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 This file is part of GCC.
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 GCC is free software; you can redistribute it and/or modify it under
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 the terms of the GNU General Public License as published by the Free
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 Software Foundation; either version 3, or (at your option) any later
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 version.
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 for more details.
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 along with GCC; see the file COPYING3. If not see
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 <http://www.gnu.org/licenses/>. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19
|
111
|
20 #ifndef GCC_READ_MD_H
|
|
21 #define GCC_READ_MD_H
|
|
22
|
68
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 #include "obstack.h"
|
111
|
24
|
|
25 /* Records a position in the file. */
|
145
|
26 class file_location {
|
|
27 public:
|
111
|
28 file_location () {}
|
|
29 file_location (const char *, int, int);
|
|
30
|
|
31 const char *filename;
|
|
32 int lineno;
|
|
33 int colno;
|
|
34 };
|
|
35
|
|
36 inline file_location::file_location (const char *filename_in, int lineno_in, int colno_in)
|
|
37 : filename (filename_in), lineno (lineno_in), colno (colno_in) {}
|
68
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 /* Holds one symbol or number in the .md file. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 struct md_name {
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 /* The name as it appeared in the .md file. Names are syntactically
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 limited to the length of this buffer. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 char buffer[256];
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45 /* The name that should actually be used by the generator programs.
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 This is an expansion of NAME, after things like constant substitution. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 char *string;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 };
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 /* This structure represents a constant defined by define_constant,
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 define_enum, or such-like. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 struct md_constant {
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 /* The name of the constant. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 char *name;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56 /* The string to which the constants expands. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
57 char *value;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
59 /* If the constant is associated with a enumeration, this field
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60 points to that enumeration, otherwise it is null. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 struct enum_type *parent_enum;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
62 };
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 /* This structure represents one value in an enum_type. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 struct enum_value {
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66 /* The next value in the enum, or null if this is the last. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 struct enum_value *next;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 /* The name of the value as it appears in the .md file. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 char *name;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 /* The definition of the related C value. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73 struct md_constant *def;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74 };
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
75
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
76 /* This structure represents an enum defined by define_enum or the like. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
77 struct enum_type {
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
78 /* The C name of the enumeration. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
79 char *name;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
81 /* True if this is an md-style enum (DEFINE_ENUM) rather than
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 a C-style enum (DEFINE_C_ENUM). */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 bool md_p;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
84
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
85 /* The values of the enumeration. There is always at least one. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
86 struct enum_value *values;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
87
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
88 /* A pointer to the null terminator in VALUES. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
89 struct enum_value **tail_ptr;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 /* The number of enumeration values. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
92 unsigned int num_values;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
93 };
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
94
|
131
|
95 /* Describes one instance of an overloaded_name. */
|
|
96 struct overloaded_instance {
|
|
97 /* The next instance in the chain, or null if none. */
|
|
98 overloaded_instance *next;
|
|
99
|
|
100 /* The values that the overloaded_name arguments should have for this
|
|
101 instance to be chosen. Each value is a C token. */
|
|
102 vec<const char *> arg_values;
|
|
103
|
|
104 /* The full (non-overloaded) name of the pattern. */
|
|
105 const char *name;
|
|
106
|
|
107 /* The corresponding define_expand or define_insn. */
|
|
108 rtx insn;
|
|
109 };
|
|
110
|
|
111 /* Describes a define_expand or define_insn whose name was preceded by '@'.
|
|
112 Overloads are uniquely determined by their name and the types of their
|
|
113 arguments; it's possible to have overloads with the same name but
|
|
114 different argument types. */
|
|
115 struct overloaded_name {
|
|
116 /* The next overloaded name in the chain. */
|
|
117 overloaded_name *next;
|
|
118
|
|
119 /* The overloaded name (i.e. the name with "@" character and
|
|
120 "<...>" placeholders removed). */
|
|
121 const char *name;
|
|
122
|
|
123 /* The C types of the iterators that determine the underlying pattern,
|
|
124 in the same order as in the pattern name. E.g. "<mode>" in the
|
|
125 pattern name would give a "machine_mode" argument here. */
|
|
126 vec<const char *> arg_types;
|
|
127
|
|
128 /* The first instance associated with this overloaded_name. */
|
|
129 overloaded_instance *first_instance;
|
|
130
|
|
131 /* Where to chain new overloaded_instances. */
|
|
132 overloaded_instance **next_instance_ptr;
|
|
133 };
|
|
134
|
|
135 struct mapping;
|
|
136
|
111
|
137 /* A class for reading .md files and RTL dump files.
|
|
138
|
|
139 Implemented in read-md.c.
|
|
140
|
|
141 This class has responsibility for reading chars from input files, and
|
|
142 for certain common top-level directives including the "include"
|
|
143 directive.
|
|
144
|
|
145 It does not handle parsing the hierarchically-nested expressions of
|
|
146 rtl.def; for that see the rtx_reader subclass below (implemented in
|
|
147 read-rtl.c). */
|
|
148
|
|
149 class md_reader
|
|
150 {
|
|
151 public:
|
145
|
152 /* Associates PTR (which can be a string, etc.) with the file location
|
|
153 specified by LOC. */
|
|
154 struct ptr_loc {
|
|
155 const void *ptr;
|
|
156 file_location loc;
|
|
157 };
|
|
158
|
111
|
159 md_reader (bool compact);
|
|
160 virtual ~md_reader ();
|
|
161
|
|
162 bool read_md_files (int, const char **, bool (*) (const char *));
|
|
163 bool read_file (const char *filename);
|
|
164 bool read_file_fragment (const char *filename,
|
|
165 int first_line,
|
|
166 int last_line);
|
|
167
|
|
168 /* A hook that handles a single .md-file directive, up to but not
|
|
169 including the closing ')'. It takes two arguments: the file position
|
|
170 at which the directive started, and the name of the directive. The next
|
|
171 unread character is the optional space after the directive name. */
|
|
172 virtual void handle_unknown_directive (file_location, const char *) = 0;
|
|
173
|
|
174 file_location get_current_location () const;
|
|
175
|
|
176 bool is_compact () const { return m_compact; }
|
|
177
|
|
178 /* Defined in read-md.c. */
|
|
179 int read_char (void);
|
|
180 void unread_char (int ch);
|
|
181 file_location read_name (struct md_name *name);
|
|
182 file_location read_name_or_nil (struct md_name *);
|
|
183 void read_escape ();
|
|
184 char *read_quoted_string ();
|
|
185 char *read_braced_string ();
|
|
186 char *read_string (int star_if_braced);
|
|
187 void read_skip_construct (int depth, file_location loc);
|
|
188 void require_char (char expected);
|
|
189 void require_char_ws (char expected);
|
|
190 void require_word_ws (const char *expected);
|
|
191 int peek_char (void);
|
|
192
|
145
|
193 void set_md_ptr_loc (const void *ptr, file_location);
|
111
|
194 const struct ptr_loc *get_md_ptr_loc (const void *ptr);
|
|
195 void copy_md_ptr_loc (const void *new_ptr, const void *old_ptr);
|
|
196 void fprint_md_ptr_loc (FILE *outf, const void *ptr);
|
|
197 void print_md_ptr_loc (const void *ptr);
|
|
198
|
|
199 struct enum_type *lookup_enum_type (const char *name);
|
|
200 void traverse_enum_types (htab_trav callback, void *info);
|
|
201
|
|
202 void handle_constants ();
|
|
203 void traverse_md_constants (htab_trav callback, void *info);
|
|
204 void handle_enum (file_location loc, bool md_p);
|
|
205
|
|
206 const char *join_c_conditions (const char *cond1, const char *cond2);
|
|
207 void fprint_c_condition (FILE *outf, const char *cond);
|
|
208 void print_c_condition (const char *cond);
|
|
209
|
|
210 /* Defined in read-rtl.c. */
|
|
211 const char *apply_iterator_to_string (const char *string);
|
|
212 rtx copy_rtx_for_iterators (rtx original);
|
|
213 void read_conditions ();
|
|
214 void record_potential_iterator_use (struct iterator_group *group,
|
145
|
215 file_location loc, rtx x,
|
|
216 unsigned int index, const char *name);
|
111
|
217 struct mapping *read_mapping (struct iterator_group *group, htab_t table);
|
131
|
218 overloaded_name *handle_overloaded_name (rtx, vec<mapping *> *);
|
111
|
219
|
|
220 const char *get_top_level_filename () const { return m_toplevel_fname; }
|
|
221 const char *get_filename () const { return m_read_md_filename; }
|
|
222 int get_lineno () const { return m_read_md_lineno; }
|
|
223 int get_colno () const { return m_read_md_colno; }
|
|
224
|
|
225 struct obstack *get_string_obstack () { return &m_string_obstack; }
|
|
226 htab_t get_md_constants () { return m_md_constants; }
|
|
227
|
131
|
228 overloaded_name *get_overloads () const { return m_first_overload; }
|
|
229
|
111
|
230 private:
|
|
231 /* A singly-linked list of filenames. */
|
|
232 struct file_name_list {
|
|
233 struct file_name_list *next;
|
|
234 const char *fname;
|
|
235 };
|
|
236
|
|
237 private:
|
|
238 void handle_file ();
|
|
239 void handle_toplevel_file ();
|
|
240 void handle_include (file_location loc);
|
|
241 void add_include_path (const char *arg);
|
|
242
|
|
243 bool read_name_1 (struct md_name *name, file_location *out_loc);
|
|
244
|
|
245 private:
|
|
246 /* Are we reading a compact dump? */
|
|
247 bool m_compact;
|
|
248
|
|
249 /* The name of the toplevel file that indirectly included
|
|
250 m_read_md_file. */
|
|
251 const char *m_toplevel_fname;
|
68
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
252
|
111
|
253 /* The directory part of m_toplevel_fname
|
|
254 NULL if m_toplevel_fname is a bare filename. */
|
|
255 char *m_base_dir;
|
|
256
|
|
257 /* The file we are reading. */
|
|
258 FILE *m_read_md_file;
|
|
259
|
|
260 /* The filename of m_read_md_file. */
|
|
261 const char *m_read_md_filename;
|
|
262
|
|
263 /* The current line number in m_read_md_file. */
|
|
264 int m_read_md_lineno;
|
|
265
|
|
266 /* The current column number in m_read_md_file. */
|
|
267 int m_read_md_colno;
|
|
268
|
|
269 /* The column number before the last newline, so that
|
|
270 we can handle unread_char ('\n') at least once whilst
|
|
271 retaining column information. */
|
|
272 int m_last_line_colno;
|
|
273
|
|
274 /* The first directory to search. */
|
|
275 file_name_list *m_first_dir_md_include;
|
|
276
|
|
277 /* A pointer to the null terminator of the md include chain. */
|
|
278 file_name_list **m_last_dir_md_include_ptr;
|
|
279
|
|
280 /* Obstack used for allocating MD strings. */
|
|
281 struct obstack m_string_obstack;
|
|
282
|
|
283 /* A table of ptr_locs, hashed on the PTR field. */
|
|
284 htab_t m_ptr_locs;
|
|
285
|
|
286 /* An obstack for the above. Plain xmalloc is a bit heavyweight for a
|
|
287 small structure like ptr_loc. */
|
|
288 struct obstack m_ptr_loc_obstack;
|
|
289
|
|
290 /* A hash table of triples (A, B, C), where each of A, B and C is a condition
|
|
291 and A is equivalent to "B && C". This is used to keep track of the source
|
|
292 of conditions that are made up of separate MD strings (such as the split
|
|
293 condition of a define_insn_and_split). */
|
|
294 htab_t m_joined_conditions;
|
|
295
|
|
296 /* An obstack for allocating joined_conditions entries. */
|
|
297 struct obstack m_joined_conditions_obstack;
|
|
298
|
|
299 /* A table of md_constant structures, hashed by name. Null if no
|
|
300 constant expansion should occur. */
|
|
301 htab_t m_md_constants;
|
|
302
|
|
303 /* A table of enum_type structures, hashed by name. */
|
|
304 htab_t m_enum_types;
|
|
305
|
|
306 /* If non-zero, filter the input to just this subset of lines. */
|
|
307 int m_first_line;
|
|
308 int m_last_line;
|
131
|
309
|
|
310 /* The first overloaded_name. */
|
|
311 overloaded_name *m_first_overload;
|
|
312
|
|
313 /* Where to chain further overloaded_names, */
|
|
314 overloaded_name **m_next_overload_ptr;
|
|
315
|
|
316 /* A hash table of overloaded_names, keyed off their name and the types of
|
|
317 their arguments. */
|
|
318 htab_t m_overloads_htab;
|
111
|
319 };
|
|
320
|
|
321 /* Global singleton; constrast with rtx_reader_ptr below. */
|
|
322 extern md_reader *md_reader_ptr;
|
|
323
|
|
324 /* An md_reader subclass which skips unknown directives, for
|
|
325 the gen* tools that purely use read-md.o. */
|
|
326
|
|
327 class noop_reader : public md_reader
|
|
328 {
|
|
329 public:
|
|
330 noop_reader () : md_reader (false) {}
|
|
331
|
|
332 /* A dummy implementation which skips unknown directives. */
|
|
333 void handle_unknown_directive (file_location, const char *);
|
|
334 };
|
|
335
|
|
336 /* An md_reader subclass that actually handles full hierarchical
|
|
337 rtx expressions.
|
|
338
|
|
339 Implemented in read-rtl.c. */
|
|
340
|
|
341 class rtx_reader : public md_reader
|
|
342 {
|
|
343 public:
|
|
344 rtx_reader (bool compact);
|
|
345 ~rtx_reader ();
|
|
346
|
|
347 bool read_rtx (const char *rtx_name, vec<rtx> *rtxen);
|
145
|
348 rtx rtx_alloc_for_name (const char *);
|
111
|
349 rtx read_rtx_code (const char *code_name);
|
|
350 virtual rtx read_rtx_operand (rtx return_rtx, int idx);
|
|
351 rtx read_nested_rtx ();
|
|
352 rtx read_rtx_variadic (rtx form);
|
|
353 char *read_until (const char *terminator_chars, bool consume_terminator);
|
|
354
|
|
355 virtual void handle_any_trailing_information (rtx) {}
|
|
356 virtual rtx postprocess (rtx x) { return x; }
|
|
357
|
|
358 /* Hook to allow function_reader subclass to put STRINGBUF into gc-managed
|
|
359 memory, rather than within an obstack.
|
|
360 This base class implementation is a no-op. */
|
|
361 virtual const char *finalize_string (char *stringbuf) { return stringbuf; }
|
|
362
|
|
363 protected:
|
|
364 /* Analogous to rtx_writer's m_in_call_function_usage. */
|
|
365 bool m_in_call_function_usage;
|
|
366
|
|
367 /* Support for "reuse_rtx" directives. */
|
|
368 auto_vec<rtx> m_reuse_rtx_by_id;
|
|
369 };
|
|
370
|
|
371 /* Global singleton; constrast with md_reader_ptr above. */
|
|
372 extern rtx_reader *rtx_reader_ptr;
|
|
373
|
68
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
374 extern void (*include_callback) (const char *);
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
375
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
376 /* Read the next character from the MD file. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
377
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
378 static inline int
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
379 read_char (void)
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
380 {
|
111
|
381 return md_reader_ptr->read_char ();
|
68
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
382 }
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
383
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
384 /* Put back CH, which was the last character read from the MD file. */
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
385
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
386 static inline void
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
387 unread_char (int ch)
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
388 {
|
111
|
389 md_reader_ptr->unread_char (ch);
|
68
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
390 }
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
391
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
392 extern hashval_t leading_string_hash (const void *);
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
393 extern int leading_string_eq_p (const void *, const void *);
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
394 extern const char *join_c_conditions (const char *, const char *);
|
111
|
395 extern void message_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2;
|
|
396 extern void error_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2;
|
|
397 extern void fatal_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2;
|
68
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
398 extern void fatal_with_file_and_line (const char *, ...)
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
399 ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
400 extern void fatal_expected_char (int, int) ATTRIBUTE_NORETURN;
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
401 extern int read_skip_spaces (void);
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
402 extern int n_comma_elts (const char *);
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
403 extern const char *scan_comma_elt (const char **);
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
404 extern void upcase_string (char *);
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
405 extern void traverse_enum_types (htab_trav, void *);
|
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
406 extern struct enum_type *lookup_enum_type (const char *);
|
111
|
407
|
|
408 #endif /* GCC_READ_MD_H */
|