1 |
38 |
julius |
/* Sets (bit vectors) of hard registers, and operations on them.
|
2 |
|
|
Copyright (C) 1987, 1992, 1994, 2000, 2003, 2004, 2005, 2007
|
3 |
|
|
Free Software Foundation, Inc.
|
4 |
|
|
|
5 |
|
|
This file is part of GCC
|
6 |
|
|
|
7 |
|
|
GCC is free software; you can redistribute it and/or modify it under
|
8 |
|
|
the terms of the GNU General Public License as published by the Free
|
9 |
|
|
Software Foundation; either version 3, or (at your option) any later
|
10 |
|
|
version.
|
11 |
|
|
|
12 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
13 |
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
14 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
15 |
|
|
for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with GCC; see the file COPYING3. If not see
|
19 |
|
|
<http://www.gnu.org/licenses/>. */
|
20 |
|
|
|
21 |
|
|
#ifndef GCC_HARD_REG_SET_H
|
22 |
|
|
#define GCC_HARD_REG_SET_H
|
23 |
|
|
|
24 |
|
|
/* Define the type of a set of hard registers. */
|
25 |
|
|
|
26 |
|
|
/* HARD_REG_ELT_TYPE is a typedef of the unsigned integral type which
|
27 |
|
|
will be used for hard reg sets, either alone or in an array.
|
28 |
|
|
|
29 |
|
|
If HARD_REG_SET is a macro, its definition is HARD_REG_ELT_TYPE,
|
30 |
|
|
and it has enough bits to represent all the target machine's hard
|
31 |
|
|
registers. Otherwise, it is a typedef for a suitably sized array
|
32 |
|
|
of HARD_REG_ELT_TYPEs. HARD_REG_SET_LONGS is defined as how many.
|
33 |
|
|
|
34 |
|
|
Note that lots of code assumes that the first part of a regset is
|
35 |
|
|
the same format as a HARD_REG_SET. To help make sure this is true,
|
36 |
|
|
we only try the widest fast integer mode (HOST_WIDEST_FAST_INT)
|
37 |
|
|
instead of all the smaller types. This approach loses only if
|
38 |
|
|
there are very few registers and then only in the few cases where
|
39 |
|
|
we have an array of HARD_REG_SETs, so it needn't be as complex as
|
40 |
|
|
it used to be. */
|
41 |
|
|
|
42 |
|
|
typedef unsigned HOST_WIDEST_FAST_INT HARD_REG_ELT_TYPE;
|
43 |
|
|
|
44 |
|
|
#if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDEST_FAST_INT
|
45 |
|
|
|
46 |
|
|
#define HARD_REG_SET HARD_REG_ELT_TYPE
|
47 |
|
|
|
48 |
|
|
#else
|
49 |
|
|
|
50 |
|
|
#define HARD_REG_SET_LONGS \
|
51 |
|
|
((FIRST_PSEUDO_REGISTER + HOST_BITS_PER_WIDEST_FAST_INT - 1) \
|
52 |
|
|
/ HOST_BITS_PER_WIDEST_FAST_INT)
|
53 |
|
|
typedef HARD_REG_ELT_TYPE HARD_REG_SET[HARD_REG_SET_LONGS];
|
54 |
|
|
|
55 |
|
|
#endif
|
56 |
|
|
|
57 |
|
|
/* HARD_CONST is used to cast a constant to the appropriate type
|
58 |
|
|
for use with a HARD_REG_SET. */
|
59 |
|
|
|
60 |
|
|
#define HARD_CONST(X) ((HARD_REG_ELT_TYPE) (X))
|
61 |
|
|
|
62 |
|
|
/* Define macros SET_HARD_REG_BIT, CLEAR_HARD_REG_BIT and TEST_HARD_REG_BIT
|
63 |
|
|
to set, clear or test one bit in a hard reg set of type HARD_REG_SET.
|
64 |
|
|
All three take two arguments: the set and the register number.
|
65 |
|
|
|
66 |
|
|
In the case where sets are arrays of longs, the first argument
|
67 |
|
|
is actually a pointer to a long.
|
68 |
|
|
|
69 |
|
|
Define two macros for initializing a set:
|
70 |
|
|
CLEAR_HARD_REG_SET and SET_HARD_REG_SET.
|
71 |
|
|
These take just one argument.
|
72 |
|
|
|
73 |
|
|
Also define macros for copying hard reg sets:
|
74 |
|
|
COPY_HARD_REG_SET and COMPL_HARD_REG_SET.
|
75 |
|
|
These take two arguments TO and FROM; they read from FROM
|
76 |
|
|
and store into TO. COMPL_HARD_REG_SET complements each bit.
|
77 |
|
|
|
78 |
|
|
Also define macros for combining hard reg sets:
|
79 |
|
|
IOR_HARD_REG_SET and AND_HARD_REG_SET.
|
80 |
|
|
These take two arguments TO and FROM; they read from FROM
|
81 |
|
|
and combine bitwise into TO. Define also two variants
|
82 |
|
|
IOR_COMPL_HARD_REG_SET and AND_COMPL_HARD_REG_SET
|
83 |
|
|
which use the complement of the set FROM.
|
84 |
|
|
|
85 |
|
|
Also define GO_IF_HARD_REG_SUBSET (X, Y, TO):
|
86 |
|
|
if X is a subset of Y, go to TO.
|
87 |
|
|
*/
|
88 |
|
|
|
89 |
|
|
#ifdef HARD_REG_SET
|
90 |
|
|
|
91 |
|
|
#define SET_HARD_REG_BIT(SET, BIT) \
|
92 |
|
|
((SET) |= HARD_CONST (1) << (BIT))
|
93 |
|
|
#define CLEAR_HARD_REG_BIT(SET, BIT) \
|
94 |
|
|
((SET) &= ~(HARD_CONST (1) << (BIT)))
|
95 |
|
|
#define TEST_HARD_REG_BIT(SET, BIT) \
|
96 |
|
|
(!!((SET) & (HARD_CONST (1) << (BIT))))
|
97 |
|
|
|
98 |
|
|
#define CLEAR_HARD_REG_SET(TO) ((TO) = HARD_CONST (0))
|
99 |
|
|
#define SET_HARD_REG_SET(TO) ((TO) = ~ HARD_CONST (0))
|
100 |
|
|
|
101 |
|
|
#define COPY_HARD_REG_SET(TO, FROM) ((TO) = (FROM))
|
102 |
|
|
#define COMPL_HARD_REG_SET(TO, FROM) ((TO) = ~(FROM))
|
103 |
|
|
|
104 |
|
|
#define IOR_HARD_REG_SET(TO, FROM) ((TO) |= (FROM))
|
105 |
|
|
#define IOR_COMPL_HARD_REG_SET(TO, FROM) ((TO) |= ~ (FROM))
|
106 |
|
|
#define AND_HARD_REG_SET(TO, FROM) ((TO) &= (FROM))
|
107 |
|
|
#define AND_COMPL_HARD_REG_SET(TO, FROM) ((TO) &= ~ (FROM))
|
108 |
|
|
|
109 |
|
|
#define GO_IF_HARD_REG_SUBSET(X,Y,TO) if (HARD_CONST (0) == ((X) & ~(Y))) goto TO
|
110 |
|
|
|
111 |
|
|
#define GO_IF_HARD_REG_EQUAL(X,Y,TO) if ((X) == (Y)) goto TO
|
112 |
|
|
|
113 |
|
|
#else
|
114 |
|
|
|
115 |
|
|
#define UHOST_BITS_PER_WIDE_INT ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT)
|
116 |
|
|
|
117 |
|
|
#define SET_HARD_REG_BIT(SET, BIT) \
|
118 |
|
|
((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
|
119 |
|
|
|= HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))
|
120 |
|
|
|
121 |
|
|
#define CLEAR_HARD_REG_BIT(SET, BIT) \
|
122 |
|
|
((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
|
123 |
|
|
&= ~(HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)))
|
124 |
|
|
|
125 |
|
|
#define TEST_HARD_REG_BIT(SET, BIT) \
|
126 |
|
|
(!!((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
|
127 |
|
|
& (HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))))
|
128 |
|
|
|
129 |
|
|
#if FIRST_PSEUDO_REGISTER <= 2*HOST_BITS_PER_WIDEST_FAST_INT
|
130 |
|
|
#define CLEAR_HARD_REG_SET(TO) \
|
131 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
|
132 |
|
|
scan_tp_[0] = 0; \
|
133 |
|
|
scan_tp_[1] = 0; } while (0)
|
134 |
|
|
|
135 |
|
|
#define SET_HARD_REG_SET(TO) \
|
136 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
|
137 |
|
|
scan_tp_[0] = -1; \
|
138 |
|
|
scan_tp_[1] = -1; } while (0)
|
139 |
|
|
|
140 |
|
|
#define COPY_HARD_REG_SET(TO, FROM) \
|
141 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
142 |
|
|
scan_tp_[0] = scan_fp_[0]; \
|
143 |
|
|
scan_tp_[1] = scan_fp_[1]; } while (0)
|
144 |
|
|
|
145 |
|
|
#define COMPL_HARD_REG_SET(TO, FROM) \
|
146 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
147 |
|
|
scan_tp_[0] = ~ scan_fp_[0]; \
|
148 |
|
|
scan_tp_[1] = ~ scan_fp_[1]; } while (0)
|
149 |
|
|
|
150 |
|
|
#define AND_HARD_REG_SET(TO, FROM) \
|
151 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
152 |
|
|
scan_tp_[0] &= scan_fp_[0]; \
|
153 |
|
|
scan_tp_[1] &= scan_fp_[1]; } while (0)
|
154 |
|
|
|
155 |
|
|
#define AND_COMPL_HARD_REG_SET(TO, FROM) \
|
156 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
157 |
|
|
scan_tp_[0] &= ~ scan_fp_[0]; \
|
158 |
|
|
scan_tp_[1] &= ~ scan_fp_[1]; } while (0)
|
159 |
|
|
|
160 |
|
|
#define IOR_HARD_REG_SET(TO, FROM) \
|
161 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
162 |
|
|
scan_tp_[0] |= scan_fp_[0]; \
|
163 |
|
|
scan_tp_[1] |= scan_fp_[1]; } while (0)
|
164 |
|
|
|
165 |
|
|
#define IOR_COMPL_HARD_REG_SET(TO, FROM) \
|
166 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
167 |
|
|
scan_tp_[0] |= ~ scan_fp_[0]; \
|
168 |
|
|
scan_tp_[1] |= ~ scan_fp_[1]; } while (0)
|
169 |
|
|
|
170 |
|
|
#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
|
171 |
|
|
do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
|
172 |
|
|
if ((0 == (scan_xp_[0] & ~ scan_yp_[0])) \
|
173 |
|
|
&& (0 == (scan_xp_[1] & ~ scan_yp_[1]))) \
|
174 |
|
|
goto TO; } while (0)
|
175 |
|
|
|
176 |
|
|
#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
|
177 |
|
|
do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
|
178 |
|
|
if ((scan_xp_[0] == scan_yp_[0]) \
|
179 |
|
|
&& (scan_xp_[1] == scan_yp_[1])) \
|
180 |
|
|
goto TO; } while (0)
|
181 |
|
|
|
182 |
|
|
#else
|
183 |
|
|
#if FIRST_PSEUDO_REGISTER <= 3*HOST_BITS_PER_WIDEST_FAST_INT
|
184 |
|
|
#define CLEAR_HARD_REG_SET(TO) \
|
185 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
|
186 |
|
|
scan_tp_[0] = 0; \
|
187 |
|
|
scan_tp_[1] = 0; \
|
188 |
|
|
scan_tp_[2] = 0; } while (0)
|
189 |
|
|
|
190 |
|
|
#define SET_HARD_REG_SET(TO) \
|
191 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
|
192 |
|
|
scan_tp_[0] = -1; \
|
193 |
|
|
scan_tp_[1] = -1; \
|
194 |
|
|
scan_tp_[2] = -1; } while (0)
|
195 |
|
|
|
196 |
|
|
#define COPY_HARD_REG_SET(TO, FROM) \
|
197 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
198 |
|
|
scan_tp_[0] = scan_fp_[0]; \
|
199 |
|
|
scan_tp_[1] = scan_fp_[1]; \
|
200 |
|
|
scan_tp_[2] = scan_fp_[2]; } while (0)
|
201 |
|
|
|
202 |
|
|
#define COMPL_HARD_REG_SET(TO, FROM) \
|
203 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
204 |
|
|
scan_tp_[0] = ~ scan_fp_[0]; \
|
205 |
|
|
scan_tp_[1] = ~ scan_fp_[1]; \
|
206 |
|
|
scan_tp_[2] = ~ scan_fp_[2]; } while (0)
|
207 |
|
|
|
208 |
|
|
#define AND_HARD_REG_SET(TO, FROM) \
|
209 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
210 |
|
|
scan_tp_[0] &= scan_fp_[0]; \
|
211 |
|
|
scan_tp_[1] &= scan_fp_[1]; \
|
212 |
|
|
scan_tp_[2] &= scan_fp_[2]; } while (0)
|
213 |
|
|
|
214 |
|
|
#define AND_COMPL_HARD_REG_SET(TO, FROM) \
|
215 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
216 |
|
|
scan_tp_[0] &= ~ scan_fp_[0]; \
|
217 |
|
|
scan_tp_[1] &= ~ scan_fp_[1]; \
|
218 |
|
|
scan_tp_[2] &= ~ scan_fp_[2]; } while (0)
|
219 |
|
|
|
220 |
|
|
#define IOR_HARD_REG_SET(TO, FROM) \
|
221 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
222 |
|
|
scan_tp_[0] |= scan_fp_[0]; \
|
223 |
|
|
scan_tp_[1] |= scan_fp_[1]; \
|
224 |
|
|
scan_tp_[2] |= scan_fp_[2]; } while (0)
|
225 |
|
|
|
226 |
|
|
#define IOR_COMPL_HARD_REG_SET(TO, FROM) \
|
227 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
228 |
|
|
scan_tp_[0] |= ~ scan_fp_[0]; \
|
229 |
|
|
scan_tp_[1] |= ~ scan_fp_[1]; \
|
230 |
|
|
scan_tp_[2] |= ~ scan_fp_[2]; } while (0)
|
231 |
|
|
|
232 |
|
|
#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
|
233 |
|
|
do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
|
234 |
|
|
if ((0 == (scan_xp_[0] & ~ scan_yp_[0])) \
|
235 |
|
|
&& (0 == (scan_xp_[1] & ~ scan_yp_[1])) \
|
236 |
|
|
&& (0 == (scan_xp_[2] & ~ scan_yp_[2]))) \
|
237 |
|
|
goto TO; } while (0)
|
238 |
|
|
|
239 |
|
|
#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
|
240 |
|
|
do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
|
241 |
|
|
if ((scan_xp_[0] == scan_yp_[0]) \
|
242 |
|
|
&& (scan_xp_[1] == scan_yp_[1]) \
|
243 |
|
|
&& (scan_xp_[2] == scan_yp_[2])) \
|
244 |
|
|
goto TO; } while (0)
|
245 |
|
|
|
246 |
|
|
#else
|
247 |
|
|
#if FIRST_PSEUDO_REGISTER <= 4*HOST_BITS_PER_WIDEST_FAST_INT
|
248 |
|
|
#define CLEAR_HARD_REG_SET(TO) \
|
249 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
|
250 |
|
|
scan_tp_[0] = 0; \
|
251 |
|
|
scan_tp_[1] = 0; \
|
252 |
|
|
scan_tp_[2] = 0; \
|
253 |
|
|
scan_tp_[3] = 0; } while (0)
|
254 |
|
|
|
255 |
|
|
#define SET_HARD_REG_SET(TO) \
|
256 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
|
257 |
|
|
scan_tp_[0] = -1; \
|
258 |
|
|
scan_tp_[1] = -1; \
|
259 |
|
|
scan_tp_[2] = -1; \
|
260 |
|
|
scan_tp_[3] = -1; } while (0)
|
261 |
|
|
|
262 |
|
|
#define COPY_HARD_REG_SET(TO, FROM) \
|
263 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
264 |
|
|
scan_tp_[0] = scan_fp_[0]; \
|
265 |
|
|
scan_tp_[1] = scan_fp_[1]; \
|
266 |
|
|
scan_tp_[2] = scan_fp_[2]; \
|
267 |
|
|
scan_tp_[3] = scan_fp_[3]; } while (0)
|
268 |
|
|
|
269 |
|
|
#define COMPL_HARD_REG_SET(TO, FROM) \
|
270 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
271 |
|
|
scan_tp_[0] = ~ scan_fp_[0]; \
|
272 |
|
|
scan_tp_[1] = ~ scan_fp_[1]; \
|
273 |
|
|
scan_tp_[2] = ~ scan_fp_[2]; \
|
274 |
|
|
scan_tp_[3] = ~ scan_fp_[3]; } while (0)
|
275 |
|
|
|
276 |
|
|
#define AND_HARD_REG_SET(TO, FROM) \
|
277 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
278 |
|
|
scan_tp_[0] &= scan_fp_[0]; \
|
279 |
|
|
scan_tp_[1] &= scan_fp_[1]; \
|
280 |
|
|
scan_tp_[2] &= scan_fp_[2]; \
|
281 |
|
|
scan_tp_[3] &= scan_fp_[3]; } while (0)
|
282 |
|
|
|
283 |
|
|
#define AND_COMPL_HARD_REG_SET(TO, FROM) \
|
284 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
285 |
|
|
scan_tp_[0] &= ~ scan_fp_[0]; \
|
286 |
|
|
scan_tp_[1] &= ~ scan_fp_[1]; \
|
287 |
|
|
scan_tp_[2] &= ~ scan_fp_[2]; \
|
288 |
|
|
scan_tp_[3] &= ~ scan_fp_[3]; } while (0)
|
289 |
|
|
|
290 |
|
|
#define IOR_HARD_REG_SET(TO, FROM) \
|
291 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
292 |
|
|
scan_tp_[0] |= scan_fp_[0]; \
|
293 |
|
|
scan_tp_[1] |= scan_fp_[1]; \
|
294 |
|
|
scan_tp_[2] |= scan_fp_[2]; \
|
295 |
|
|
scan_tp_[3] |= scan_fp_[3]; } while (0)
|
296 |
|
|
|
297 |
|
|
#define IOR_COMPL_HARD_REG_SET(TO, FROM) \
|
298 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
299 |
|
|
scan_tp_[0] |= ~ scan_fp_[0]; \
|
300 |
|
|
scan_tp_[1] |= ~ scan_fp_[1]; \
|
301 |
|
|
scan_tp_[2] |= ~ scan_fp_[2]; \
|
302 |
|
|
scan_tp_[3] |= ~ scan_fp_[3]; } while (0)
|
303 |
|
|
|
304 |
|
|
#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
|
305 |
|
|
do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
|
306 |
|
|
if ((0 == (scan_xp_[0] & ~ scan_yp_[0])) \
|
307 |
|
|
&& (0 == (scan_xp_[1] & ~ scan_yp_[1])) \
|
308 |
|
|
&& (0 == (scan_xp_[2] & ~ scan_yp_[2])) \
|
309 |
|
|
&& (0 == (scan_xp_[3] & ~ scan_yp_[3]))) \
|
310 |
|
|
goto TO; } while (0)
|
311 |
|
|
|
312 |
|
|
#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
|
313 |
|
|
do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
|
314 |
|
|
if ((scan_xp_[0] == scan_yp_[0]) \
|
315 |
|
|
&& (scan_xp_[1] == scan_yp_[1]) \
|
316 |
|
|
&& (scan_xp_[2] == scan_yp_[2]) \
|
317 |
|
|
&& (scan_xp_[3] == scan_yp_[3])) \
|
318 |
|
|
goto TO; } while (0)
|
319 |
|
|
|
320 |
|
|
#else /* FIRST_PSEUDO_REGISTER > 3*HOST_BITS_PER_WIDEST_FAST_INT */
|
321 |
|
|
|
322 |
|
|
#define CLEAR_HARD_REG_SET(TO) \
|
323 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
|
324 |
|
|
int i; \
|
325 |
|
|
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
|
326 |
|
|
*scan_tp_++ = 0; } while (0)
|
327 |
|
|
|
328 |
|
|
#define SET_HARD_REG_SET(TO) \
|
329 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
|
330 |
|
|
int i; \
|
331 |
|
|
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
|
332 |
|
|
*scan_tp_++ = -1; } while (0)
|
333 |
|
|
|
334 |
|
|
#define COPY_HARD_REG_SET(TO, FROM) \
|
335 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
336 |
|
|
int i; \
|
337 |
|
|
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
|
338 |
|
|
*scan_tp_++ = *scan_fp_++; } while (0)
|
339 |
|
|
|
340 |
|
|
#define COMPL_HARD_REG_SET(TO, FROM) \
|
341 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
342 |
|
|
int i; \
|
343 |
|
|
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
|
344 |
|
|
*scan_tp_++ = ~ *scan_fp_++; } while (0)
|
345 |
|
|
|
346 |
|
|
#define AND_HARD_REG_SET(TO, FROM) \
|
347 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
348 |
|
|
int i; \
|
349 |
|
|
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
|
350 |
|
|
*scan_tp_++ &= *scan_fp_++; } while (0)
|
351 |
|
|
|
352 |
|
|
#define AND_COMPL_HARD_REG_SET(TO, FROM) \
|
353 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
354 |
|
|
int i; \
|
355 |
|
|
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
|
356 |
|
|
*scan_tp_++ &= ~ *scan_fp_++; } while (0)
|
357 |
|
|
|
358 |
|
|
#define IOR_HARD_REG_SET(TO, FROM) \
|
359 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
360 |
|
|
int i; \
|
361 |
|
|
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
|
362 |
|
|
*scan_tp_++ |= *scan_fp_++; } while (0)
|
363 |
|
|
|
364 |
|
|
#define IOR_COMPL_HARD_REG_SET(TO, FROM) \
|
365 |
|
|
do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
|
366 |
|
|
int i; \
|
367 |
|
|
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
|
368 |
|
|
*scan_tp_++ |= ~ *scan_fp_++; } while (0)
|
369 |
|
|
|
370 |
|
|
#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
|
371 |
|
|
do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
|
372 |
|
|
int i; \
|
373 |
|
|
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
|
374 |
|
|
if (0 != (*scan_xp_++ & ~ *scan_yp_++)) break; \
|
375 |
|
|
if (i == HARD_REG_SET_LONGS) goto TO; } while (0)
|
376 |
|
|
|
377 |
|
|
#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
|
378 |
|
|
do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
|
379 |
|
|
int i; \
|
380 |
|
|
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
|
381 |
|
|
if (*scan_xp_++ != *scan_yp_++) break; \
|
382 |
|
|
if (i == HARD_REG_SET_LONGS) goto TO; } while (0)
|
383 |
|
|
|
384 |
|
|
#endif
|
385 |
|
|
#endif
|
386 |
|
|
#endif
|
387 |
|
|
#endif
|
388 |
|
|
|
389 |
|
|
/* Define some standard sets of registers. */
|
390 |
|
|
|
391 |
|
|
/* Indexed by hard register number, contains 1 for registers
|
392 |
|
|
that are fixed use (stack pointer, pc, frame pointer, etc.).
|
393 |
|
|
These are the registers that cannot be used to allocate
|
394 |
|
|
a pseudo reg whose life does not cross calls. */
|
395 |
|
|
|
396 |
|
|
extern char fixed_regs[FIRST_PSEUDO_REGISTER];
|
397 |
|
|
|
398 |
|
|
/* The same info as a HARD_REG_SET. */
|
399 |
|
|
|
400 |
|
|
extern HARD_REG_SET fixed_reg_set;
|
401 |
|
|
|
402 |
|
|
/* Indexed by hard register number, contains 1 for registers
|
403 |
|
|
that are fixed use or are clobbered by function calls.
|
404 |
|
|
These are the registers that cannot be used to allocate
|
405 |
|
|
a pseudo reg whose life crosses calls. */
|
406 |
|
|
|
407 |
|
|
extern char call_used_regs[FIRST_PSEUDO_REGISTER];
|
408 |
|
|
|
409 |
|
|
#ifdef CALL_REALLY_USED_REGISTERS
|
410 |
|
|
extern char call_really_used_regs[];
|
411 |
|
|
#endif
|
412 |
|
|
|
413 |
|
|
/* The same info as a HARD_REG_SET. */
|
414 |
|
|
|
415 |
|
|
extern HARD_REG_SET call_used_reg_set;
|
416 |
|
|
|
417 |
|
|
/* Registers that we don't want to caller save. */
|
418 |
|
|
extern HARD_REG_SET losing_caller_save_reg_set;
|
419 |
|
|
|
420 |
|
|
/* Indexed by hard register number, contains 1 for registers that are
|
421 |
|
|
fixed use -- i.e. in fixed_regs -- or a function value return register
|
422 |
|
|
or TARGET_STRUCT_VALUE_RTX or STATIC_CHAIN_REGNUM. These are the
|
423 |
|
|
registers that cannot hold quantities across calls even if we are
|
424 |
|
|
willing to save and restore them. */
|
425 |
|
|
|
426 |
|
|
extern char call_fixed_regs[FIRST_PSEUDO_REGISTER];
|
427 |
|
|
|
428 |
|
|
/* The same info as a HARD_REG_SET. */
|
429 |
|
|
|
430 |
|
|
extern HARD_REG_SET call_fixed_reg_set;
|
431 |
|
|
|
432 |
|
|
/* Indexed by hard register number, contains 1 for registers
|
433 |
|
|
that are being used for global register decls.
|
434 |
|
|
These must be exempt from ordinary flow analysis
|
435 |
|
|
and are also considered fixed. */
|
436 |
|
|
|
437 |
|
|
extern char global_regs[FIRST_PSEUDO_REGISTER];
|
438 |
|
|
|
439 |
|
|
/* Contains 1 for registers that are set or clobbered by calls. */
|
440 |
|
|
/* ??? Ideally, this would be just call_used_regs plus global_regs, but
|
441 |
|
|
for someone's bright idea to have call_used_regs strictly include
|
442 |
|
|
fixed_regs. Which leaves us guessing as to the set of fixed_regs
|
443 |
|
|
that are actually preserved. We know for sure that those associated
|
444 |
|
|
with the local stack frame are safe, but scant others. */
|
445 |
|
|
|
446 |
|
|
extern HARD_REG_SET regs_invalidated_by_call;
|
447 |
|
|
|
448 |
|
|
#ifdef REG_ALLOC_ORDER
|
449 |
|
|
/* Table of register numbers in the order in which to try to use them. */
|
450 |
|
|
|
451 |
|
|
extern int reg_alloc_order[FIRST_PSEUDO_REGISTER];
|
452 |
|
|
|
453 |
|
|
/* The inverse of reg_alloc_order. */
|
454 |
|
|
|
455 |
|
|
extern int inv_reg_alloc_order[FIRST_PSEUDO_REGISTER];
|
456 |
|
|
#endif
|
457 |
|
|
|
458 |
|
|
/* For each reg class, a HARD_REG_SET saying which registers are in it. */
|
459 |
|
|
|
460 |
|
|
extern HARD_REG_SET reg_class_contents[N_REG_CLASSES];
|
461 |
|
|
|
462 |
|
|
/* For each reg class, number of regs it contains. */
|
463 |
|
|
|
464 |
|
|
extern unsigned int reg_class_size[N_REG_CLASSES];
|
465 |
|
|
|
466 |
|
|
/* For each pair of reg classes,
|
467 |
|
|
a largest reg class contained in their union. */
|
468 |
|
|
|
469 |
|
|
extern enum reg_class reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES];
|
470 |
|
|
|
471 |
|
|
/* For each pair of reg classes,
|
472 |
|
|
the smallest reg class that contains their union. */
|
473 |
|
|
|
474 |
|
|
extern enum reg_class reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES];
|
475 |
|
|
|
476 |
|
|
/* Vector indexed by hardware reg giving its name. */
|
477 |
|
|
|
478 |
|
|
extern const char * reg_names[FIRST_PSEUDO_REGISTER];
|
479 |
|
|
|
480 |
|
|
/* Vector indexed by reg class giving its name. */
|
481 |
|
|
|
482 |
|
|
extern const char * reg_class_names[];
|
483 |
|
|
|
484 |
|
|
/* Given a hard REGN a FROM mode and a TO mode, return nonzero if
|
485 |
|
|
REGN cannot change modes between the specified modes. */
|
486 |
|
|
#define REG_CANNOT_CHANGE_MODE_P(REGN, FROM, TO) \
|
487 |
|
|
CANNOT_CHANGE_MODE_CLASS (FROM, TO, REGNO_REG_CLASS (REGN))
|
488 |
|
|
|
489 |
|
|
#endif /* ! GCC_HARD_REG_SET_H */
|