annotate gcc/gensupport.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
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.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 Copyright (C) 2000-2018 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. */
kono
parents: 67
diff changeset
29 struct md_rtx_info {
kono
parents: 67
diff changeset
30 /* The rtx itself. */
kono
parents: 67
diff changeset
31 rtx def;
kono
parents: 67
diff changeset
32
kono
parents: 67
diff changeset
33 /* The location of the first line of the rtx. */
kono
parents: 67
diff changeset
34 file_location loc;
kono
parents: 67
diff changeset
35
kono
parents: 67
diff changeset
36 /* The unique number attached to the rtx. Currently all define_insns,
kono
parents: 67
diff changeset
37 define_expands, define_splits, define_peepholes and define_peephole2s
kono
parents: 67
diff changeset
38 share the same insn_code index space. */
kono
parents: 67
diff changeset
39 int index;
kono
parents: 67
diff changeset
40 };
kono
parents: 67
diff changeset
41
kono
parents: 67
diff changeset
42 #define OPTAB_CL(name, pat, c, b, l) name,
kono
parents: 67
diff changeset
43 #define OPTAB_CX(name, pat)
kono
parents: 67
diff changeset
44 #define OPTAB_CD(name, pat) name,
kono
parents: 67
diff changeset
45 #define OPTAB_NL(name, pat, c, b, s, l) name,
kono
parents: 67
diff changeset
46 #define OPTAB_NC(name, pat, c) name,
kono
parents: 67
diff changeset
47 #define OPTAB_NX(name, pat)
kono
parents: 67
diff changeset
48 #define OPTAB_VL(name, pat, c, b, s, l) name,
kono
parents: 67
diff changeset
49 #define OPTAB_VC(name, pat, c) name,
kono
parents: 67
diff changeset
50 #define OPTAB_VX(name, pat)
kono
parents: 67
diff changeset
51 #define OPTAB_DC(name, pat, c) name,
kono
parents: 67
diff changeset
52 #define OPTAB_D(name, pat) name,
kono
parents: 67
diff changeset
53
kono
parents: 67
diff changeset
54 /* Enumerates all optabs. */
kono
parents: 67
diff changeset
55 typedef enum optab_tag {
kono
parents: 67
diff changeset
56 unknown_optab,
kono
parents: 67
diff changeset
57 #include "optabs.def"
kono
parents: 67
diff changeset
58 NUM_OPTABS
kono
parents: 67
diff changeset
59 } optab;
kono
parents: 67
diff changeset
60
kono
parents: 67
diff changeset
61 #undef OPTAB_CL
kono
parents: 67
diff changeset
62 #undef OPTAB_CX
kono
parents: 67
diff changeset
63 #undef OPTAB_CD
kono
parents: 67
diff changeset
64 #undef OPTAB_NL
kono
parents: 67
diff changeset
65 #undef OPTAB_NC
kono
parents: 67
diff changeset
66 #undef OPTAB_NX
kono
parents: 67
diff changeset
67 #undef OPTAB_VL
kono
parents: 67
diff changeset
68 #undef OPTAB_VC
kono
parents: 67
diff changeset
69 #undef OPTAB_VX
kono
parents: 67
diff changeset
70 #undef OPTAB_DC
kono
parents: 67
diff changeset
71 #undef OPTAB_D
kono
parents: 67
diff changeset
72
kono
parents: 67
diff changeset
73 /* Describes one entry in optabs.def. */
kono
parents: 67
diff changeset
74 struct optab_def
kono
parents: 67
diff changeset
75 {
kono
parents: 67
diff changeset
76 /* The name of the optab (e.g. "add_optab"). */
kono
parents: 67
diff changeset
77 const char *name;
kono
parents: 67
diff changeset
78
kono
parents: 67
diff changeset
79 /* The pattern that matching define_expands and define_insns have.
kono
parents: 67
diff changeset
80 See the comment at the head of optabs.def for details. */
kono
parents: 67
diff changeset
81 const char *pattern;
kono
parents: 67
diff changeset
82
kono
parents: 67
diff changeset
83 /* The initializers (in the form of C code) for the libcall_basename,
kono
parents: 67
diff changeset
84 libcall_suffix and libcall_gen fields of (convert_)optab_libcall_d. */
kono
parents: 67
diff changeset
85 const char *base;
kono
parents: 67
diff changeset
86 const char *suffix;
kono
parents: 67
diff changeset
87 const char *libcall;
kono
parents: 67
diff changeset
88
kono
parents: 67
diff changeset
89 /* The optab's enum value. */
kono
parents: 67
diff changeset
90 unsigned int op;
kono
parents: 67
diff changeset
91
kono
parents: 67
diff changeset
92 /* The value returned by optab_to_code (OP). */
kono
parents: 67
diff changeset
93 enum rtx_code fcode;
kono
parents: 67
diff changeset
94
kono
parents: 67
diff changeset
95 /* CODE if code_to_optab (CODE) should return OP, otherwise UNKNOWN. */
kono
parents: 67
diff changeset
96 enum rtx_code rcode;
kono
parents: 67
diff changeset
97
kono
parents: 67
diff changeset
98 /* 1: conversion optabs with libcall data,
kono
parents: 67
diff changeset
99 2: conversion optabs without libcall data,
kono
parents: 67
diff changeset
100 3: non-conversion optabs with libcall data ("normal" and "overflow"
kono
parents: 67
diff changeset
101 optabs in the optabs.def comment)
kono
parents: 67
diff changeset
102 4: non-conversion optabs without libcall data ("direct" optabs). */
kono
parents: 67
diff changeset
103 unsigned int kind;
kono
parents: 67
diff changeset
104 };
kono
parents: 67
diff changeset
105
kono
parents: 67
diff changeset
106 extern optab_def optabs[];
kono
parents: 67
diff changeset
107 extern unsigned int num_optabs;
kono
parents: 67
diff changeset
108
kono
parents: 67
diff changeset
109 /* Information about an instruction name that matches an optab pattern. */
kono
parents: 67
diff changeset
110 struct optab_pattern
kono
parents: 67
diff changeset
111 {
kono
parents: 67
diff changeset
112 /* The name of the instruction. */
kono
parents: 67
diff changeset
113 const char *name;
kono
parents: 67
diff changeset
114
kono
parents: 67
diff changeset
115 /* The matching optab. */
kono
parents: 67
diff changeset
116 unsigned int op;
kono
parents: 67
diff changeset
117
kono
parents: 67
diff changeset
118 /* The optab modes. M2 is only significant for conversion optabs;
kono
parents: 67
diff changeset
119 it is zero otherwise. */
kono
parents: 67
diff changeset
120 unsigned int m1, m2;
kono
parents: 67
diff changeset
121
kono
parents: 67
diff changeset
122 /* An index that provides a lexicographical sort of (OP, M2, M1).
kono
parents: 67
diff changeset
123 Used by genopinit.c. */
kono
parents: 67
diff changeset
124 unsigned int sort_num;
kono
parents: 67
diff changeset
125 };
kono
parents: 67
diff changeset
126
kono
parents: 67
diff changeset
127 extern rtx add_implicit_parallel (rtvec);
kono
parents: 67
diff changeset
128 extern rtx_reader *init_rtx_reader_args_cb (int, const char **,
kono
parents: 67
diff changeset
129 bool (*)(const char *));
kono
parents: 67
diff changeset
130 extern rtx_reader *init_rtx_reader_args (int, const char **);
kono
parents: 67
diff changeset
131 extern bool read_md_rtx (md_rtx_info *);
kono
parents: 67
diff changeset
132 extern unsigned int get_num_insn_codes ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 /* 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
135 can never be used in this configuration. See genconditions.c.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 Must be set before calling init_md_reader. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 extern int insn_elision;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138
111
kono
parents: 67
diff changeset
139 /* Return the C test that says whether a definition rtx can be used,
kono
parents: 67
diff changeset
140 or "" if it can be used unconditionally. */
kono
parents: 67
diff changeset
141 extern const char *get_c_test (rtx);
kono
parents: 67
diff changeset
142
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 /* 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
144 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
145 appeared somewhere in the machine description when genconditions
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 was run. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 extern int maybe_eval_c_test (const char *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 /* 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
150 by read-rtl.c. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 extern void add_c_test (const char *, int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 /* 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
154 struct c_test
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 const char *expr;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 int value;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 };
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 #ifdef __HASHTAB_H__
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 extern hashval_t hash_c_test (const void *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 extern int cmp_c_test (const void *, const void *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 extern void traverse_c_tests (htab_trav, void *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 /* Predicate handling: helper functions and data structures. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 struct pred_data
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 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
171 const char *name; /* predicate name */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 bool special; /* special handling of modes? */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 /* data used primarily by genpreds.c */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 const char *c_block; /* C test block */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 rtx exp; /* RTL test expression */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 /* data used primarily by genrecog.c */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 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
180 int num_codes; /* number of codes accepted */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 bool allows_non_lvalue; /* if pred allows non-lvalue expressions */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 bool allows_non_const; /* if pred allows non-const expressions */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 bool codes[NUM_RTX_CODE]; /* set of codes accepted */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 };
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 extern struct pred_data *first_predicate;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 extern struct pred_data *lookup_predicate (const char *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 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
189 extern void add_predicate (struct pred_data *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 #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
192
111
kono
parents: 67
diff changeset
193 struct pattern_stats
kono
parents: 67
diff changeset
194 {
kono
parents: 67
diff changeset
195 /* The largest match_operand, match_operator or match_parallel
kono
parents: 67
diff changeset
196 number found. */
kono
parents: 67
diff changeset
197 int max_opno;
kono
parents: 67
diff changeset
198
kono
parents: 67
diff changeset
199 /* The largest match_dup, match_op_dup or match_par_dup number found. */
kono
parents: 67
diff changeset
200 int max_dup_opno;
kono
parents: 67
diff changeset
201
kono
parents: 67
diff changeset
202 /* The smallest and largest match_scratch number found. */
kono
parents: 67
diff changeset
203 int min_scratch_opno;
kono
parents: 67
diff changeset
204 int max_scratch_opno;
kono
parents: 67
diff changeset
205
kono
parents: 67
diff changeset
206 /* The number of times match_dup, match_op_dup or match_par_dup appears
kono
parents: 67
diff changeset
207 in the pattern. */
kono
parents: 67
diff changeset
208 int num_dups;
kono
parents: 67
diff changeset
209
kono
parents: 67
diff changeset
210 /* The number of rtx arguments to the generator function. */
kono
parents: 67
diff changeset
211 int num_generator_args;
kono
parents: 67
diff changeset
212
kono
parents: 67
diff changeset
213 /* The number of rtx operands in an insn. */
kono
parents: 67
diff changeset
214 int num_insn_operands;
kono
parents: 67
diff changeset
215
kono
parents: 67
diff changeset
216 /* The number of operand variables that are needed. */
kono
parents: 67
diff changeset
217 int num_operand_vars;
kono
parents: 67
diff changeset
218 };
kono
parents: 67
diff changeset
219
kono
parents: 67
diff changeset
220 extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec);
kono
parents: 67
diff changeset
221 extern void compute_test_codes (rtx, file_location, char *);
kono
parents: 67
diff changeset
222 extern file_location get_file_location (rtx);
kono
parents: 67
diff changeset
223 extern const char *get_emit_function (rtx);
kono
parents: 67
diff changeset
224 extern bool needs_barrier_p (rtx);
kono
parents: 67
diff changeset
225 extern bool find_optab (optab_pattern *, const char *);
kono
parents: 67
diff changeset
226
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 #endif /* GCC_GENSUPPORT_H */