annotate gcc/gensupport.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Declarations for rtx-reader support for gen* routines.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2000-2020 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 #ifndef GCC_GENSUPPORT_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #define GCC_GENSUPPORT_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
111
kono
parents: 67
diff changeset
23 #include "read-md.h"
kono
parents: 67
diff changeset
24
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 struct obstack;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 extern struct obstack *rtl_obstack;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
111
kono
parents: 67
diff changeset
28 /* Information about an .md define_* rtx. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
29 class md_rtx_info {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
30 public:
111
kono
parents: 67
diff changeset
31 /* The rtx itself. */
kono
parents: 67
diff changeset
32 rtx def;
kono
parents: 67
diff changeset
33
kono
parents: 67
diff changeset
34 /* The location of the first line of the rtx. */
kono
parents: 67
diff changeset
35 file_location loc;
kono
parents: 67
diff changeset
36
kono
parents: 67
diff changeset
37 /* The unique number attached to the rtx. Currently all define_insns,
kono
parents: 67
diff changeset
38 define_expands, define_splits, define_peepholes and define_peephole2s
kono
parents: 67
diff changeset
39 share the same insn_code index space. */
kono
parents: 67
diff changeset
40 int index;
kono
parents: 67
diff changeset
41 };
kono
parents: 67
diff changeset
42
kono
parents: 67
diff changeset
43 #define OPTAB_CL(name, pat, c, b, l) name,
kono
parents: 67
diff changeset
44 #define OPTAB_CX(name, pat)
kono
parents: 67
diff changeset
45 #define OPTAB_CD(name, pat) name,
kono
parents: 67
diff changeset
46 #define OPTAB_NL(name, pat, c, b, s, l) name,
kono
parents: 67
diff changeset
47 #define OPTAB_NC(name, pat, c) name,
kono
parents: 67
diff changeset
48 #define OPTAB_NX(name, pat)
kono
parents: 67
diff changeset
49 #define OPTAB_VL(name, pat, c, b, s, l) name,
kono
parents: 67
diff changeset
50 #define OPTAB_VC(name, pat, c) name,
kono
parents: 67
diff changeset
51 #define OPTAB_VX(name, pat)
kono
parents: 67
diff changeset
52 #define OPTAB_DC(name, pat, c) name,
kono
parents: 67
diff changeset
53 #define OPTAB_D(name, pat) name,
kono
parents: 67
diff changeset
54
kono
parents: 67
diff changeset
55 /* Enumerates all optabs. */
kono
parents: 67
diff changeset
56 typedef enum optab_tag {
kono
parents: 67
diff changeset
57 unknown_optab,
kono
parents: 67
diff changeset
58 #include "optabs.def"
kono
parents: 67
diff changeset
59 NUM_OPTABS
kono
parents: 67
diff changeset
60 } optab;
kono
parents: 67
diff changeset
61
kono
parents: 67
diff changeset
62 #undef OPTAB_CL
kono
parents: 67
diff changeset
63 #undef OPTAB_CX
kono
parents: 67
diff changeset
64 #undef OPTAB_CD
kono
parents: 67
diff changeset
65 #undef OPTAB_NL
kono
parents: 67
diff changeset
66 #undef OPTAB_NC
kono
parents: 67
diff changeset
67 #undef OPTAB_NX
kono
parents: 67
diff changeset
68 #undef OPTAB_VL
kono
parents: 67
diff changeset
69 #undef OPTAB_VC
kono
parents: 67
diff changeset
70 #undef OPTAB_VX
kono
parents: 67
diff changeset
71 #undef OPTAB_DC
kono
parents: 67
diff changeset
72 #undef OPTAB_D
kono
parents: 67
diff changeset
73
kono
parents: 67
diff changeset
74 /* Describes one entry in optabs.def. */
kono
parents: 67
diff changeset
75 struct optab_def
kono
parents: 67
diff changeset
76 {
kono
parents: 67
diff changeset
77 /* The name of the optab (e.g. "add_optab"). */
kono
parents: 67
diff changeset
78 const char *name;
kono
parents: 67
diff changeset
79
kono
parents: 67
diff changeset
80 /* The pattern that matching define_expands and define_insns have.
kono
parents: 67
diff changeset
81 See the comment at the head of optabs.def for details. */
kono
parents: 67
diff changeset
82 const char *pattern;
kono
parents: 67
diff changeset
83
kono
parents: 67
diff changeset
84 /* The initializers (in the form of C code) for the libcall_basename,
kono
parents: 67
diff changeset
85 libcall_suffix and libcall_gen fields of (convert_)optab_libcall_d. */
kono
parents: 67
diff changeset
86 const char *base;
kono
parents: 67
diff changeset
87 const char *suffix;
kono
parents: 67
diff changeset
88 const char *libcall;
kono
parents: 67
diff changeset
89
kono
parents: 67
diff changeset
90 /* The optab's enum value. */
kono
parents: 67
diff changeset
91 unsigned int op;
kono
parents: 67
diff changeset
92
kono
parents: 67
diff changeset
93 /* The value returned by optab_to_code (OP). */
kono
parents: 67
diff changeset
94 enum rtx_code fcode;
kono
parents: 67
diff changeset
95
kono
parents: 67
diff changeset
96 /* CODE if code_to_optab (CODE) should return OP, otherwise UNKNOWN. */
kono
parents: 67
diff changeset
97 enum rtx_code rcode;
kono
parents: 67
diff changeset
98
kono
parents: 67
diff changeset
99 /* 1: conversion optabs with libcall data,
kono
parents: 67
diff changeset
100 2: conversion optabs without libcall data,
kono
parents: 67
diff changeset
101 3: non-conversion optabs with libcall data ("normal" and "overflow"
kono
parents: 67
diff changeset
102 optabs in the optabs.def comment)
kono
parents: 67
diff changeset
103 4: non-conversion optabs without libcall data ("direct" optabs). */
kono
parents: 67
diff changeset
104 unsigned int kind;
kono
parents: 67
diff changeset
105 };
kono
parents: 67
diff changeset
106
kono
parents: 67
diff changeset
107 extern optab_def optabs[];
kono
parents: 67
diff changeset
108 extern unsigned int num_optabs;
kono
parents: 67
diff changeset
109
kono
parents: 67
diff changeset
110 /* Information about an instruction name that matches an optab pattern. */
kono
parents: 67
diff changeset
111 struct optab_pattern
kono
parents: 67
diff changeset
112 {
kono
parents: 67
diff changeset
113 /* The name of the instruction. */
kono
parents: 67
diff changeset
114 const char *name;
kono
parents: 67
diff changeset
115
kono
parents: 67
diff changeset
116 /* The matching optab. */
kono
parents: 67
diff changeset
117 unsigned int op;
kono
parents: 67
diff changeset
118
kono
parents: 67
diff changeset
119 /* The optab modes. M2 is only significant for conversion optabs;
kono
parents: 67
diff changeset
120 it is zero otherwise. */
kono
parents: 67
diff changeset
121 unsigned int m1, m2;
kono
parents: 67
diff changeset
122
kono
parents: 67
diff changeset
123 /* An index that provides a lexicographical sort of (OP, M2, M1).
kono
parents: 67
diff changeset
124 Used by genopinit.c. */
kono
parents: 67
diff changeset
125 unsigned int sort_num;
kono
parents: 67
diff changeset
126 };
kono
parents: 67
diff changeset
127
kono
parents: 67
diff changeset
128 extern rtx add_implicit_parallel (rtvec);
kono
parents: 67
diff changeset
129 extern rtx_reader *init_rtx_reader_args_cb (int, const char **,
kono
parents: 67
diff changeset
130 bool (*)(const char *));
kono
parents: 67
diff changeset
131 extern rtx_reader *init_rtx_reader_args (int, const char **);
kono
parents: 67
diff changeset
132 extern bool read_md_rtx (md_rtx_info *);
kono
parents: 67
diff changeset
133 extern unsigned int get_num_insn_codes ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 /* Set this to 0 to disable automatic elision of insn patterns which
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 can never be used in this configuration. See genconditions.c.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 Must be set before calling init_md_reader. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 extern int insn_elision;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139
111
kono
parents: 67
diff changeset
140 /* Return the C test that says whether a definition rtx can be used,
kono
parents: 67
diff changeset
141 or "" if it can be used unconditionally. */
kono
parents: 67
diff changeset
142 extern const char *get_c_test (rtx);
kono
parents: 67
diff changeset
143
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 /* If the C test passed as the argument can be evaluated at compile
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 time, return its truth value; else return -1. The test must have
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 appeared somewhere in the machine description when genconditions
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 was run. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 extern int maybe_eval_c_test (const char *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 /* Add an entry to the table of conditions. Used by genconditions and
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 by read-rtl.c. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 extern void add_c_test (const char *, int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 /* This structure is used internally by gensupport.c and genconditions.c. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 struct c_test
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 const char *expr;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 int value;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 #ifdef __HASHTAB_H__
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 extern hashval_t hash_c_test (const void *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 extern int cmp_c_test (const void *, const void *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 extern void traverse_c_tests (htab_trav, void *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 /* Predicate handling: helper functions and data structures. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 struct pred_data
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 struct pred_data *next; /* for iterating over the set of all preds */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 const char *name; /* predicate name */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 bool special; /* special handling of modes? */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 /* data used primarily by genpreds.c */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 const char *c_block; /* C test block */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 rtx exp; /* RTL test expression */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 /* data used primarily by genrecog.c */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 enum rtx_code singleton; /* if pred takes only one code, that code */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 int num_codes; /* number of codes accepted */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 bool allows_non_lvalue; /* if pred allows non-lvalue expressions */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 bool allows_non_const; /* if pred allows non-const expressions */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 bool codes[NUM_RTX_CODE]; /* set of codes accepted */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 extern struct pred_data *first_predicate;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 extern struct pred_data *lookup_predicate (const char *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 extern void add_predicate_code (struct pred_data *, enum rtx_code);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 extern void add_predicate (struct pred_data *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 #define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193
111
kono
parents: 67
diff changeset
194 struct pattern_stats
kono
parents: 67
diff changeset
195 {
kono
parents: 67
diff changeset
196 /* The largest match_operand, match_operator or match_parallel
kono
parents: 67
diff changeset
197 number found. */
kono
parents: 67
diff changeset
198 int max_opno;
kono
parents: 67
diff changeset
199
kono
parents: 67
diff changeset
200 /* The largest match_dup, match_op_dup or match_par_dup number found. */
kono
parents: 67
diff changeset
201 int max_dup_opno;
kono
parents: 67
diff changeset
202
kono
parents: 67
diff changeset
203 /* The smallest and largest match_scratch number found. */
kono
parents: 67
diff changeset
204 int min_scratch_opno;
kono
parents: 67
diff changeset
205 int max_scratch_opno;
kono
parents: 67
diff changeset
206
kono
parents: 67
diff changeset
207 /* The number of times match_dup, match_op_dup or match_par_dup appears
kono
parents: 67
diff changeset
208 in the pattern. */
kono
parents: 67
diff changeset
209 int num_dups;
kono
parents: 67
diff changeset
210
kono
parents: 67
diff changeset
211 /* The number of rtx arguments to the generator function. */
kono
parents: 67
diff changeset
212 int num_generator_args;
kono
parents: 67
diff changeset
213
kono
parents: 67
diff changeset
214 /* The number of rtx operands in an insn. */
kono
parents: 67
diff changeset
215 int num_insn_operands;
kono
parents: 67
diff changeset
216
kono
parents: 67
diff changeset
217 /* The number of operand variables that are needed. */
kono
parents: 67
diff changeset
218 int num_operand_vars;
kono
parents: 67
diff changeset
219 };
kono
parents: 67
diff changeset
220
kono
parents: 67
diff changeset
221 extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec);
kono
parents: 67
diff changeset
222 extern void compute_test_codes (rtx, file_location, char *);
kono
parents: 67
diff changeset
223 extern file_location get_file_location (rtx);
kono
parents: 67
diff changeset
224 extern const char *get_emit_function (rtx);
kono
parents: 67
diff changeset
225 extern bool needs_barrier_p (rtx);
kono
parents: 67
diff changeset
226 extern bool find_optab (optab_pattern *, const char *);
kono
parents: 67
diff changeset
227
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 #endif /* GCC_GENSUPPORT_H */