Branch data Line data Source code
1 : : /* Sets (bit vectors) of hard registers, and operations on them.
2 : : Copyright (C) 1987-2025 Free Software Foundation, Inc.
3 : :
4 : : This file is part of GCC
5 : :
6 : : GCC is free software; you can redistribute it and/or modify it under
7 : : the terms of the GNU General Public License as published by the Free
8 : : Software Foundation; either version 3, or (at your option) any later
9 : : version.
10 : :
11 : : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 : : WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 : : for more details.
15 : :
16 : : You should have received a copy of the GNU General Public License
17 : : along with GCC; see the file COPYING3. If not see
18 : : <http://www.gnu.org/licenses/>. */
19 : :
20 : : #ifndef GCC_HARD_REG_SET_H
21 : : #define GCC_HARD_REG_SET_H
22 : :
23 : : #include "array-traits.h"
24 : :
25 : : /* Define the type of a set of hard registers. */
26 : :
27 : : /* HARD_REG_ELT_TYPE is a typedef of the unsigned integral type which
28 : : will be used for hard reg sets, either alone or in an array.
29 : :
30 : : If HARD_REG_SET is a macro, its definition is HARD_REG_ELT_TYPE,
31 : : and it has enough bits to represent all the target machine's hard
32 : : registers. Otherwise, it is a typedef for a suitably sized array
33 : : of HARD_REG_ELT_TYPEs. HARD_REG_SET_LONGS is defined as how many.
34 : :
35 : : Note that lots of code assumes that the first part of a regset is
36 : : the same format as a HARD_REG_SET. To help make sure this is true,
37 : : we only try the widest fast integer mode (HOST_WIDEST_FAST_INT)
38 : : instead of all the smaller types. This approach loses only if
39 : : there are very few registers and then only in the few cases where
40 : : we have an array of HARD_REG_SETs, so it needn't be as complex as
41 : : it used to be. */
42 : :
43 : : typedef unsigned HOST_WIDEST_FAST_INT HARD_REG_ELT_TYPE;
44 : :
45 : : #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDEST_FAST_INT
46 : :
47 : : typedef HARD_REG_ELT_TYPE HARD_REG_SET;
48 : : typedef const HARD_REG_SET const_hard_reg_set;
49 : :
50 : : #else
51 : :
52 : : #define HARD_REG_SET_LONGS \
53 : : ((FIRST_PSEUDO_REGISTER + HOST_BITS_PER_WIDEST_FAST_INT - 1) \
54 : : / HOST_BITS_PER_WIDEST_FAST_INT)
55 : :
56 : : struct HARD_REG_SET
57 : : {
58 : : HARD_REG_SET
59 : 18773809588 : operator~ () const
60 : : {
61 : 18773809588 : HARD_REG_SET res;
62 : 56321428764 : for (unsigned int i = 0; i < ARRAY_SIZE (elts); ++i)
63 : 37547619176 : res.elts[i] = ~elts[i];
64 : 18773809588 : return res;
65 : : }
66 : :
67 : : HARD_REG_SET
68 : 18727565461 : operator& (const HARD_REG_SET &other) const
69 : : {
70 : 18727565461 : HARD_REG_SET res;
71 : 56182696383 : for (unsigned int i = 0; i < ARRAY_SIZE (elts); ++i)
72 : 37455130922 : res.elts[i] = elts[i] & other.elts[i];
73 : 18727565461 : return res;
74 : : }
75 : :
76 : : HARD_REG_SET &
77 : 2230008889 : operator&= (const HARD_REG_SET &other)
78 : : {
79 : 6602326980 : for (unsigned int i = 0; i < ARRAY_SIZE (elts); ++i)
80 : 4461652824 : elts[i] &= other.elts[i];
81 : 2228520808 : return *this;
82 : : }
83 : :
84 : : HARD_REG_SET
85 : 3912130050 : operator| (const HARD_REG_SET &other) const
86 : : {
87 : 3912130050 : HARD_REG_SET res;
88 : 11736390150 : for (unsigned int i = 0; i < ARRAY_SIZE (elts); ++i)
89 : 7824260100 : res.elts[i] = elts[i] | other.elts[i];
90 : 3912130050 : return res;
91 : : }
92 : :
93 : : HARD_REG_SET &
94 : 2534276362 : operator|= (const HARD_REG_SET &other)
95 : : {
96 : 9555901690 : for (unsigned int i = 0; i < ARRAY_SIZE (elts); ++i)
97 : 6408627882 : elts[i] |= other.elts[i];
98 : 2506402448 : return *this;
99 : : }
100 : :
101 : : bool
102 : 455845586 : operator== (const HARD_REG_SET &other) const
103 : : {
104 : 455845586 : HARD_REG_ELT_TYPE bad = 0;
105 : 5890212384 : for (unsigned int i = 0; i < ARRAY_SIZE (elts); ++i)
106 : 3926808256 : bad |= (elts[i] ^ other.elts[i]);
107 : 1961889355 : return bad == 0;
108 : : }
109 : :
110 : : bool
111 : 1514773 : operator!= (const HARD_REG_SET &other) const
112 : : {
113 : 3029546 : return !operator== (other);
114 : : }
115 : :
116 : : HARD_REG_ELT_TYPE elts[HARD_REG_SET_LONGS];
117 : : };
118 : : typedef const HARD_REG_SET &const_hard_reg_set;
119 : :
120 : : template<>
121 : : struct array_traits<HARD_REG_SET>
122 : : {
123 : : typedef HARD_REG_ELT_TYPE element_type;
124 : : static const bool has_constant_size = true;
125 : : static const size_t constant_size = HARD_REG_SET_LONGS;
126 : 157156490 : static const element_type *base (const HARD_REG_SET &x) { return x.elts; }
127 : 157156490 : static size_t size (const HARD_REG_SET &) { return HARD_REG_SET_LONGS; }
128 : : };
129 : :
130 : : #endif
131 : :
132 : : /* HARD_REG_SET wrapped into a structure, to make it possible to
133 : : use HARD_REG_SET even in APIs that should not include
134 : : hard-reg-set.h. */
135 : : struct hard_reg_set_container
136 : : {
137 : : HARD_REG_SET set;
138 : : };
139 : :
140 : : /* HARD_CONST is used to cast a constant to the appropriate type
141 : : for use with a HARD_REG_SET. */
142 : :
143 : : #define HARD_CONST(X) ((HARD_REG_ELT_TYPE) (X))
144 : :
145 : : /* Define macros SET_HARD_REG_BIT, CLEAR_HARD_REG_BIT and TEST_HARD_REG_BIT
146 : : to set, clear or test one bit in a hard reg set of type HARD_REG_SET.
147 : : All three take two arguments: the set and the register number.
148 : :
149 : : In the case where sets are arrays of longs, the first argument
150 : : is actually a pointer to a long.
151 : :
152 : : Define two macros for initializing a set:
153 : : CLEAR_HARD_REG_SET and SET_HARD_REG_SET.
154 : : These take just one argument.
155 : :
156 : : Also define:
157 : :
158 : : hard_reg_set_subset_p (X, Y), which returns true if X is a subset of Y.
159 : : hard_reg_set_intersect_p (X, Y), which returns true if X and Y intersect.
160 : : hard_reg_set_empty_p (X), which returns true if X is empty. */
161 : :
162 : : #define UHOST_BITS_PER_WIDE_INT ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT)
163 : :
164 : : #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDEST_FAST_INT
165 : :
166 : : #define SET_HARD_REG_BIT(SET, BIT) \
167 : : ((SET) |= HARD_CONST (1) << (BIT))
168 : : #define CLEAR_HARD_REG_BIT(SET, BIT) \
169 : : ((SET) &= ~(HARD_CONST (1) << (BIT)))
170 : : #define TEST_HARD_REG_BIT(SET, BIT) \
171 : : (!!((SET) & (HARD_CONST (1) << (BIT))))
172 : :
173 : : #define CLEAR_HARD_REG_SET(TO) ((TO) = HARD_CONST (0))
174 : : #define SET_HARD_REG_SET(TO) ((TO) = ~ HARD_CONST (0))
175 : :
176 : : inline bool
177 : : hard_reg_set_subset_p (const_hard_reg_set x, const_hard_reg_set y)
178 : : {
179 : : return (x & ~y) == HARD_CONST (0);
180 : : }
181 : :
182 : : inline bool
183 : : hard_reg_set_intersect_p (const_hard_reg_set x, const_hard_reg_set y)
184 : : {
185 : : return (x & y) != HARD_CONST (0);
186 : : }
187 : :
188 : : inline bool
189 : : hard_reg_set_empty_p (const_hard_reg_set x)
190 : : {
191 : : return x == HARD_CONST (0);
192 : : }
193 : :
194 : : inline int
195 : : hard_reg_set_popcount (const_hard_reg_set x)
196 : : {
197 : : return popcount_hwi (x);
198 : : }
199 : :
200 : : /* Return 0 if there aren't any differences between X and Y after the first
201 : : SKIP registers, or 1 + the register number of the lowest-numbered
202 : : difference, negated if it's set in Y. The return value is suitable for
203 : : qsort. */
204 : : inline int
205 : : hard_reg_set_first_diff (const_hard_reg_set x, const_hard_reg_set y,
206 : : unsigned skip)
207 : : {
208 : : if (skip >= UHOST_BITS_PER_WIDE_INT)
209 : : return 0;
210 : : const HARD_REG_ELT_TYPE full_mask = -1;
211 : : HARD_REG_ELT_TYPE mask = full_mask << skip;
212 : : HARD_REG_ELT_TYPE dif = (x ^ y) & mask;
213 : : if (dif == 0)
214 : : return 0;
215 : : int bit = ctz_hwi (dif);
216 : : int regp1 = bit + 1;
217 : : if (y & (HARD_CONST (1) << bit))
218 : : return -regp1;
219 : : return regp1;
220 : : }
221 : :
222 : : #else
223 : :
224 : : inline void
225 : 22123544067 : SET_HARD_REG_BIT (HARD_REG_SET &set, unsigned int bit)
226 : : {
227 : 22123544067 : set.elts[bit / UHOST_BITS_PER_WIDE_INT]
228 : 8029288926 : |= HARD_CONST (1) << (bit % UHOST_BITS_PER_WIDE_INT);
229 : 14689699444 : }
230 : :
231 : : inline void
232 : 982440524 : CLEAR_HARD_REG_BIT (HARD_REG_SET &set, unsigned int bit)
233 : : {
234 : 982440524 : set.elts[bit / UHOST_BITS_PER_WIDE_INT]
235 : 971277512 : &= ~(HARD_CONST (1) << (bit % UHOST_BITS_PER_WIDE_INT));
236 : 246992171 : }
237 : :
238 : : inline bool
239 : >11079*10^7 : TEST_HARD_REG_BIT (const_hard_reg_set set, unsigned int bit)
240 : : {
241 : >11077*10^7 : return (set.elts[bit / UHOST_BITS_PER_WIDE_INT]
242 : >10239*10^7 : & (HARD_CONST (1) << (bit % UHOST_BITS_PER_WIDE_INT)));
243 : : }
244 : :
245 : : inline void
246 : 6259323468 : CLEAR_HARD_REG_SET (HARD_REG_SET &set)
247 : : {
248 : 25599736103 : for (unsigned int i = 0; i < ARRAY_SIZE (set.elts); ++i)
249 : 18517976972 : set.elts[i] = 0;
250 : : }
251 : :
252 : : inline void
253 : 29464996 : SET_HARD_REG_SET (HARD_REG_SET &set)
254 : : {
255 : 90751499 : for (unsigned int i = 0; i < ARRAY_SIZE (set.elts); ++i)
256 : 60503370 : set.elts[i] = -1;
257 : : }
258 : :
259 : : inline bool
260 : >11620*10^7 : hard_reg_set_subset_p (const_hard_reg_set x, const_hard_reg_set y)
261 : : {
262 : >11620*10^7 : HARD_REG_ELT_TYPE bad = 0;
263 : >58071*10^7 : for (unsigned int i = 0; i < ARRAY_SIZE (x.elts); ++i)
264 : >38714*10^7 : bad |= (x.elts[i] & ~y.elts[i]);
265 : >19356*10^7 : return bad == 0;
266 : : }
267 : :
268 : : inline bool
269 : 58773844849 : hard_reg_set_intersect_p (const_hard_reg_set x, const_hard_reg_set y)
270 : : {
271 : 59517410899 : HARD_REG_ELT_TYPE good = 0;
272 : >21287*10^7 : for (unsigned int i = 0; i < ARRAY_SIZE (x.elts); ++i)
273 : >14191*10^7 : good |= (x.elts[i] & y.elts[i]);
274 : 70956912906 : return good != 0;
275 : : }
276 : :
277 : : inline bool
278 : 10841858772 : hard_reg_set_empty_p (const_hard_reg_set x)
279 : : {
280 : 10841858772 : HARD_REG_ELT_TYPE bad = 0;
281 : 33427073904 : for (unsigned int i = 0; i < ARRAY_SIZE (x.elts); ++i)
282 : 22284715936 : bad |= x.elts[i];
283 : 11142357968 : return bad == 0;
284 : : }
285 : :
286 : : inline int
287 : : hard_reg_set_popcount (const_hard_reg_set x)
288 : : {
289 : : int count = 0;
290 : : for (unsigned int i = 0; i < ARRAY_SIZE (x.elts); ++i)
291 : : count += popcount_hwi (x.elts[i]);
292 : : return count;
293 : : }
294 : :
295 : : /* Return 0 if there aren't any differences between X and Y after the first
296 : : SKIP registers, or 1 + the register number of the lowest-numbered
297 : : difference, negated if it's set in Y. The return value is suitable for
298 : : qsort. */
299 : : inline int
300 : 2136943 : hard_reg_set_first_diff (const_hard_reg_set x, const_hard_reg_set y,
301 : : unsigned skip)
302 : : {
303 : 2136943 : const HARD_REG_ELT_TYPE full_mask = -1;
304 : 2136943 : HARD_REG_ELT_TYPE mask = full_mask << (skip % UHOST_BITS_PER_WIDE_INT);
305 : 2136943 : for (unsigned int i = skip / UHOST_BITS_PER_WIDE_INT;
306 : 2137201 : i < ARRAY_SIZE (x.elts); ++i)
307 : : {
308 : 2137201 : HARD_REG_ELT_TYPE dif = (x.elts[i] ^ y.elts[i]) & mask;
309 : 2137201 : if (dif == 0)
310 : : {
311 : 258 : mask = full_mask;
312 : 258 : continue;
313 : : }
314 : 2136943 : int bit = ctz_hwi (dif);
315 : 2136943 : int regp1 = bit + 1 + i * UHOST_BITS_PER_WIDE_INT;
316 : 2136943 : if (y.elts[i] & (HARD_CONST (1) << bit))
317 : 1178704 : return -regp1;
318 : : return regp1;
319 : : }
320 : : return 0;
321 : : }
322 : : #endif
323 : :
324 : : /* Iterator for hard register sets. */
325 : :
326 : : struct hard_reg_set_iterator
327 : : {
328 : : /* Pointer to the current element. */
329 : : const HARD_REG_ELT_TYPE *pelt;
330 : :
331 : : /* The length of the set. */
332 : : unsigned short length;
333 : :
334 : : /* Word within the current element. */
335 : : unsigned short word_no;
336 : :
337 : : /* Contents of the actually processed word. When finding next bit
338 : : it is shifted right, so that the actual bit is always the least
339 : : significant bit of ACTUAL. */
340 : : HARD_REG_ELT_TYPE bits;
341 : : };
342 : :
343 : : #define HARD_REG_ELT_BITS UHOST_BITS_PER_WIDE_INT
344 : :
345 : : /* The implementation of the iterator functions is a simplified version of
346 : : those of bitmap iterators. */
347 : : inline void
348 : 37042001 : hard_reg_set_iter_init (hard_reg_set_iterator *iter, const_hard_reg_set set,
349 : : unsigned min, unsigned *regno)
350 : : {
351 : : #ifdef HARD_REG_SET_LONGS
352 : 37042001 : iter->pelt = set.elts;
353 : 37042001 : iter->length = HARD_REG_SET_LONGS;
354 : : #else
355 : : iter->pelt = &set;
356 : : iter->length = 1;
357 : : #endif
358 : 37042001 : iter->word_no = min / HARD_REG_ELT_BITS;
359 : 37042001 : if (iter->word_no < iter->length)
360 : : {
361 : 37042001 : iter->bits = iter->pelt[iter->word_no];
362 : 37042001 : iter->bits >>= min % HARD_REG_ELT_BITS;
363 : 37042001 : *regno = min;
364 : : }
365 : 37042001 : }
366 : :
367 : : inline bool
368 : 3016931898 : hard_reg_set_iter_set (hard_reg_set_iterator *iter, unsigned *regno)
369 : : {
370 : 3090302193 : while (1)
371 : : {
372 : : /* Return false when we're advanced past the end of the set. */
373 : 3090302193 : if (iter->word_no >= iter->length)
374 : : return false;
375 : :
376 : 3053260709 : if (iter->bits)
377 : : {
378 : 2979890414 : unsigned skip = ctz_hwi (iter->bits);
379 : 2979890414 : iter->bits >>= skip;
380 : 2979890414 : *regno += skip;
381 : 2979890414 : return (*regno < FIRST_PSEUDO_REGISTER);
382 : : }
383 : :
384 : : /* Find the next non-zero word. */
385 : 74082968 : while (++iter->word_no < iter->length)
386 : : {
387 : 37041484 : iter->bits = iter->pelt[iter->word_no];
388 : 37041484 : if (iter->bits)
389 : : {
390 : 36328811 : *regno = iter->word_no * HARD_REG_ELT_BITS;
391 : 36328811 : break;
392 : : }
393 : : }
394 : : }
395 : : }
396 : :
397 : : inline void
398 : 2979889897 : hard_reg_set_iter_next (hard_reg_set_iterator *iter, unsigned *)
399 : : {
400 : : /* Only clear the bit, so that we skip it in iter_set. */
401 : 2979889897 : iter->bits &= ~ HARD_CONST (1);
402 : 2979889897 : }
403 : :
404 : : /* SET must not change throughout the iteration.
405 : : REGNUM (and ITER) may only be changed by the iteration functions. */
406 : : #define EXECUTE_IF_SET_IN_HARD_REG_SET(SET, MIN, REGNUM, ITER) \
407 : : for (hard_reg_set_iter_init (&(ITER), (SET), (MIN), &(REGNUM)); \
408 : : hard_reg_set_iter_set (&(ITER), &(REGNUM)); \
409 : : hard_reg_set_iter_next (&(ITER), &(REGNUM)))
410 : :
411 : :
412 : : /* Define some standard sets of registers. */
413 : :
414 : : /* Indexed by hard register number, contains 1 for registers
415 : : that are being used for global register decls.
416 : : These must be exempt from ordinary flow analysis
417 : : and are also considered fixed. */
418 : :
419 : : extern char global_regs[FIRST_PSEUDO_REGISTER];
420 : :
421 : : extern HARD_REG_SET global_reg_set;
422 : :
423 : : class simplifiable_subreg;
424 : : class subreg_shape;
425 : :
426 : : struct simplifiable_subregs_hasher : nofree_ptr_hash <simplifiable_subreg>
427 : : {
428 : : typedef const subreg_shape *compare_type;
429 : :
430 : : static inline hashval_t hash (const simplifiable_subreg *);
431 : : static inline bool equal (const simplifiable_subreg *, const subreg_shape *);
432 : : };
433 : :
434 : : struct target_hard_regs {
435 : : void finalize ();
436 : :
437 : : /* The set of registers that actually exist on the current target. */
438 : : HARD_REG_SET x_accessible_reg_set;
439 : :
440 : : /* The set of registers that should be considered to be register
441 : : operands. It is a subset of x_accessible_reg_set. */
442 : : HARD_REG_SET x_operand_reg_set;
443 : :
444 : : /* Indexed by hard register number, contains 1 for registers
445 : : that are fixed use (stack pointer, pc, frame pointer, etc.;.
446 : : These are the registers that cannot be used to allocate
447 : : a pseudo reg whose life does not cross calls. */
448 : : char x_fixed_regs[FIRST_PSEUDO_REGISTER];
449 : :
450 : : /* The same info as a HARD_REG_SET. */
451 : : HARD_REG_SET x_fixed_reg_set;
452 : :
453 : : /* Indexed by hard register number, contains 1 for registers
454 : : that are fixed use or are clobbered by function calls.
455 : : These are the registers that cannot be used to allocate
456 : : a pseudo reg whose life crosses calls. */
457 : : char x_call_used_regs[FIRST_PSEUDO_REGISTER];
458 : :
459 : : /* For targets that use reload rather than LRA, this is the set
460 : : of registers that we are able to save and restore around calls
461 : : (i.e. those for which we know a suitable mode and set of
462 : : load/store instructions exist). For LRA targets it contains
463 : : all registers.
464 : :
465 : : This is legacy information and should be removed if all targets
466 : : switch to LRA. */
467 : : HARD_REG_SET x_savable_regs;
468 : :
469 : : /* Contains registers that are fixed use -- i.e. in fixed_reg_set -- but
470 : : only if they are not merely part of that set because they are global
471 : : regs. Global regs that are not otherwise fixed can still take part
472 : : in register allocation. */
473 : : HARD_REG_SET x_fixed_nonglobal_reg_set;
474 : :
475 : : /* Contains 1 for registers that are set or clobbered by calls. */
476 : : /* ??? Ideally, this would be just call_used_regs plus global_regs, but
477 : : for someone's bright idea to have call_used_regs strictly include
478 : : fixed_regs. Which leaves us guessing as to the set of fixed_regs
479 : : that are actually preserved. We know for sure that those associated
480 : : with the local stack frame are safe, but scant others. */
481 : : HARD_REG_SET x_regs_invalidated_by_call;
482 : :
483 : : /* The set of registers that are used by EH_RETURN_DATA_REGNO. */
484 : : HARD_REG_SET x_eh_return_data_regs;
485 : :
486 : : /* Table of register numbers in the order in which to try to use them. */
487 : : int x_reg_alloc_order[FIRST_PSEUDO_REGISTER];
488 : :
489 : : /* The inverse of reg_alloc_order. */
490 : : int x_inv_reg_alloc_order[FIRST_PSEUDO_REGISTER];
491 : :
492 : : /* For each reg class, a HARD_REG_SET saying which registers are in it. */
493 : : HARD_REG_SET x_reg_class_contents[N_REG_CLASSES];
494 : :
495 : : /* For each reg class, a boolean saying whether the class contains only
496 : : fixed registers. */
497 : : bool x_class_only_fixed_regs[N_REG_CLASSES];
498 : :
499 : : /* For each reg class, number of regs it contains. */
500 : : unsigned int x_reg_class_size[N_REG_CLASSES];
501 : :
502 : : /* For each reg class, table listing all the classes contained in it. */
503 : : enum reg_class x_reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
504 : :
505 : : /* For each pair of reg classes,
506 : : a largest reg class contained in their union. */
507 : : enum reg_class x_reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES];
508 : :
509 : : /* For each pair of reg classes,
510 : : the smallest reg class that contains their union. */
511 : : enum reg_class x_reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES];
512 : :
513 : : /* Vector indexed by hardware reg giving its name. */
514 : : const char *x_reg_names[FIRST_PSEUDO_REGISTER];
515 : :
516 : : /* Records which registers can form a particular subreg, with the subreg
517 : : being identified by its outer mode, inner mode and offset. */
518 : : hash_table <simplifiable_subregs_hasher> *x_simplifiable_subregs;
519 : : };
520 : :
521 : : extern struct target_hard_regs default_target_hard_regs;
522 : : #if SWITCHABLE_TARGET
523 : : extern struct target_hard_regs *this_target_hard_regs;
524 : : #else
525 : : #define this_target_hard_regs (&default_target_hard_regs)
526 : : #endif
527 : :
528 : : #define accessible_reg_set \
529 : : (this_target_hard_regs->x_accessible_reg_set)
530 : : #define operand_reg_set \
531 : : (this_target_hard_regs->x_operand_reg_set)
532 : : #define fixed_regs \
533 : : (this_target_hard_regs->x_fixed_regs)
534 : : #define fixed_reg_set \
535 : : (this_target_hard_regs->x_fixed_reg_set)
536 : : #define fixed_nonglobal_reg_set \
537 : : (this_target_hard_regs->x_fixed_nonglobal_reg_set)
538 : : #ifdef IN_TARGET_CODE
539 : : #define call_used_regs \
540 : : (this_target_hard_regs->x_call_used_regs)
541 : : #endif
542 : : #define savable_regs \
543 : : (this_target_hard_regs->x_savable_regs)
544 : : #ifdef IN_TARGET_CODE
545 : : #define regs_invalidated_by_call \
546 : : (this_target_hard_regs->x_regs_invalidated_by_call)
547 : : #define call_used_or_fixed_regs \
548 : : (regs_invalidated_by_call | fixed_reg_set)
549 : : #endif
550 : : #define eh_return_data_regs \
551 : : (this_target_hard_regs->x_eh_return_data_regs)
552 : : #define reg_alloc_order \
553 : : (this_target_hard_regs->x_reg_alloc_order)
554 : : #define inv_reg_alloc_order \
555 : : (this_target_hard_regs->x_inv_reg_alloc_order)
556 : : #define reg_class_contents \
557 : : (this_target_hard_regs->x_reg_class_contents)
558 : : #define class_only_fixed_regs \
559 : : (this_target_hard_regs->x_class_only_fixed_regs)
560 : : #define reg_class_size \
561 : : (this_target_hard_regs->x_reg_class_size)
562 : : #define reg_class_subclasses \
563 : : (this_target_hard_regs->x_reg_class_subclasses)
564 : : #define reg_class_subunion \
565 : : (this_target_hard_regs->x_reg_class_subunion)
566 : : #define reg_class_superunion \
567 : : (this_target_hard_regs->x_reg_class_superunion)
568 : : #define reg_names \
569 : : (this_target_hard_regs->x_reg_names)
570 : :
571 : : /* Vector indexed by reg class giving its name. */
572 : :
573 : : extern const char * reg_class_names[];
574 : :
575 : : /* Given a hard REGN a FROM mode and a TO mode, return true if
576 : : REGN can change from mode FROM to mode TO. */
577 : : #define REG_CAN_CHANGE_MODE_P(REGN, FROM, TO) \
578 : : (targetm.can_change_mode_class (FROM, TO, REGNO_REG_CLASS (REGN)))
579 : :
580 : : #ifdef IN_TARGET_CODE
581 : : /* Return true if register REGNO is either fixed or call-used
582 : : (aka call-clobbered). */
583 : :
584 : : inline bool
585 : 361821498 : call_used_or_fixed_reg_p (unsigned int regno)
586 : : {
587 : 361821498 : return fixed_regs[regno] || this_target_hard_regs->x_call_used_regs[regno];
588 : : }
589 : : #endif
590 : :
591 : : #endif /* ! GCC_HARD_REG_SET_H */
|