annotate gcc/read-md.h @ 118:fd00160c1b76

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