1 /* Sets (bit vectors) of hard registers, and operations on them.
2 Copyright (C) 1987, 1992, 1994, 2000, 2003, 2004, 2005, 2007, 2008, 2009,
3 2010, 2012 Free Software Foundation, Inc.
5 This file is part of GCC
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
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
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/>. */
21 #ifndef GCC_HARD_REG_SET_H
22 #define GCC_HARD_REG_SET_H
24 /* Define the type of a set of hard registers. */
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.
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.
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
42 typedef unsigned HOST_WIDEST_FAST_INT HARD_REG_ELT_TYPE
;
44 #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDEST_FAST_INT
46 #define HARD_REG_SET HARD_REG_ELT_TYPE
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
];
57 /* HARD_REG_SET wrapped into a structure, to make it possible to
58 use HARD_REG_SET even in APIs that should not include
60 struct hard_reg_set_container
65 /* HARD_CONST is used to cast a constant to the appropriate type
66 for use with a HARD_REG_SET. */
68 #define HARD_CONST(X) ((HARD_REG_ELT_TYPE) (X))
70 /* Define macros SET_HARD_REG_BIT, CLEAR_HARD_REG_BIT and TEST_HARD_REG_BIT
71 to set, clear or test one bit in a hard reg set of type HARD_REG_SET.
72 All three take two arguments: the set and the register number.
74 In the case where sets are arrays of longs, the first argument
75 is actually a pointer to a long.
77 Define two macros for initializing a set:
78 CLEAR_HARD_REG_SET and SET_HARD_REG_SET.
79 These take just one argument.
81 Also define macros for copying hard reg sets:
82 COPY_HARD_REG_SET and COMPL_HARD_REG_SET.
83 These take two arguments TO and FROM; they read from FROM
84 and store into TO. COMPL_HARD_REG_SET complements each bit.
86 Also define macros for combining hard reg sets:
87 IOR_HARD_REG_SET and AND_HARD_REG_SET.
88 These take two arguments TO and FROM; they read from FROM
89 and combine bitwise into TO. Define also two variants
90 IOR_COMPL_HARD_REG_SET and AND_COMPL_HARD_REG_SET
91 which use the complement of the set FROM.
95 hard_reg_set_subset_p (X, Y), which returns true if X is a subset of Y.
96 hard_reg_set_equal_p (X, Y), which returns true if X and Y are equal.
97 hard_reg_set_intersect_p (X, Y), which returns true if X and Y intersect.
98 hard_reg_set_empty_p (X), which returns true if X is empty. */
100 #define UHOST_BITS_PER_WIDE_INT ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT)
104 #define SET_HARD_REG_BIT(SET, BIT) \
105 ((SET) |= HARD_CONST (1) << (BIT))
106 #define CLEAR_HARD_REG_BIT(SET, BIT) \
107 ((SET) &= ~(HARD_CONST (1) << (BIT)))
108 #define TEST_HARD_REG_BIT(SET, BIT) \
109 (!!((SET) & (HARD_CONST (1) << (BIT))))
111 #define CLEAR_HARD_REG_SET(TO) ((TO) = HARD_CONST (0))
112 #define SET_HARD_REG_SET(TO) ((TO) = ~ HARD_CONST (0))
114 #define COPY_HARD_REG_SET(TO, FROM) ((TO) = (FROM))
115 #define COMPL_HARD_REG_SET(TO, FROM) ((TO) = ~(FROM))
117 #define IOR_HARD_REG_SET(TO, FROM) ((TO) |= (FROM))
118 #define IOR_COMPL_HARD_REG_SET(TO, FROM) ((TO) |= ~ (FROM))
119 #define AND_HARD_REG_SET(TO, FROM) ((TO) &= (FROM))
120 #define AND_COMPL_HARD_REG_SET(TO, FROM) ((TO) &= ~ (FROM))
123 hard_reg_set_subset_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
125 return (x
& ~y
) == HARD_CONST (0);
129 hard_reg_set_equal_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
135 hard_reg_set_intersect_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
137 return (x
& y
) != HARD_CONST (0);
141 hard_reg_set_empty_p (const HARD_REG_SET x
)
143 return x
== HARD_CONST (0);
148 #define SET_HARD_REG_BIT(SET, BIT) \
149 ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
150 |= HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))
152 #define CLEAR_HARD_REG_BIT(SET, BIT) \
153 ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
154 &= ~(HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)))
156 #define TEST_HARD_REG_BIT(SET, BIT) \
157 (!!((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
158 & (HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))))
160 #if FIRST_PSEUDO_REGISTER <= 2*HOST_BITS_PER_WIDEST_FAST_INT
161 #define CLEAR_HARD_REG_SET(TO) \
162 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
164 scan_tp_[1] = 0; } while (0)
166 #define SET_HARD_REG_SET(TO) \
167 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
169 scan_tp_[1] = -1; } while (0)
171 #define COPY_HARD_REG_SET(TO, FROM) \
172 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
173 scan_tp_[0] = scan_fp_[0]; \
174 scan_tp_[1] = scan_fp_[1]; } while (0)
176 #define COMPL_HARD_REG_SET(TO, FROM) \
177 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
178 scan_tp_[0] = ~ scan_fp_[0]; \
179 scan_tp_[1] = ~ scan_fp_[1]; } while (0)
181 #define AND_HARD_REG_SET(TO, FROM) \
182 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
183 scan_tp_[0] &= scan_fp_[0]; \
184 scan_tp_[1] &= scan_fp_[1]; } while (0)
186 #define AND_COMPL_HARD_REG_SET(TO, FROM) \
187 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
188 scan_tp_[0] &= ~ scan_fp_[0]; \
189 scan_tp_[1] &= ~ scan_fp_[1]; } while (0)
191 #define IOR_HARD_REG_SET(TO, FROM) \
192 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
193 scan_tp_[0] |= scan_fp_[0]; \
194 scan_tp_[1] |= scan_fp_[1]; } while (0)
196 #define IOR_COMPL_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]; } while (0)
202 hard_reg_set_subset_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
204 return (x
[0] & ~y
[0]) == 0 && (x
[1] & ~y
[1]) == 0;
208 hard_reg_set_equal_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
210 return x
[0] == y
[0] && x
[1] == y
[1];
214 hard_reg_set_intersect_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
216 return (x
[0] & y
[0]) != 0 || (x
[1] & y
[1]) != 0;
220 hard_reg_set_empty_p (const HARD_REG_SET x
)
222 return x
[0] == 0 && x
[1] == 0;
226 #if FIRST_PSEUDO_REGISTER <= 3*HOST_BITS_PER_WIDEST_FAST_INT
227 #define CLEAR_HARD_REG_SET(TO) \
228 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
231 scan_tp_[2] = 0; } while (0)
233 #define SET_HARD_REG_SET(TO) \
234 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
237 scan_tp_[2] = -1; } while (0)
239 #define COPY_HARD_REG_SET(TO, FROM) \
240 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
241 scan_tp_[0] = scan_fp_[0]; \
242 scan_tp_[1] = scan_fp_[1]; \
243 scan_tp_[2] = scan_fp_[2]; } while (0)
245 #define COMPL_HARD_REG_SET(TO, FROM) \
246 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
247 scan_tp_[0] = ~ scan_fp_[0]; \
248 scan_tp_[1] = ~ scan_fp_[1]; \
249 scan_tp_[2] = ~ scan_fp_[2]; } while (0)
251 #define AND_HARD_REG_SET(TO, FROM) \
252 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
253 scan_tp_[0] &= scan_fp_[0]; \
254 scan_tp_[1] &= scan_fp_[1]; \
255 scan_tp_[2] &= scan_fp_[2]; } while (0)
257 #define AND_COMPL_HARD_REG_SET(TO, FROM) \
258 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
259 scan_tp_[0] &= ~ scan_fp_[0]; \
260 scan_tp_[1] &= ~ scan_fp_[1]; \
261 scan_tp_[2] &= ~ scan_fp_[2]; } while (0)
263 #define IOR_HARD_REG_SET(TO, FROM) \
264 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
265 scan_tp_[0] |= scan_fp_[0]; \
266 scan_tp_[1] |= scan_fp_[1]; \
267 scan_tp_[2] |= scan_fp_[2]; } while (0)
269 #define IOR_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]; } while (0)
276 hard_reg_set_subset_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
278 return ((x
[0] & ~y
[0]) == 0
279 && (x
[1] & ~y
[1]) == 0
280 && (x
[2] & ~y
[2]) == 0);
284 hard_reg_set_equal_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
286 return x
[0] == y
[0] && x
[1] == y
[1] && x
[2] == y
[2];
290 hard_reg_set_intersect_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
292 return ((x
[0] & y
[0]) != 0
293 || (x
[1] & y
[1]) != 0
294 || (x
[2] & y
[2]) != 0);
298 hard_reg_set_empty_p (const HARD_REG_SET x
)
300 return x
[0] == 0 && x
[1] == 0 && x
[2] == 0;
304 #if FIRST_PSEUDO_REGISTER <= 4*HOST_BITS_PER_WIDEST_FAST_INT
305 #define CLEAR_HARD_REG_SET(TO) \
306 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
310 scan_tp_[3] = 0; } while (0)
312 #define SET_HARD_REG_SET(TO) \
313 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
317 scan_tp_[3] = -1; } while (0)
319 #define COPY_HARD_REG_SET(TO, FROM) \
320 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
321 scan_tp_[0] = scan_fp_[0]; \
322 scan_tp_[1] = scan_fp_[1]; \
323 scan_tp_[2] = scan_fp_[2]; \
324 scan_tp_[3] = scan_fp_[3]; } while (0)
326 #define COMPL_HARD_REG_SET(TO, FROM) \
327 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
328 scan_tp_[0] = ~ scan_fp_[0]; \
329 scan_tp_[1] = ~ scan_fp_[1]; \
330 scan_tp_[2] = ~ scan_fp_[2]; \
331 scan_tp_[3] = ~ scan_fp_[3]; } while (0)
333 #define AND_HARD_REG_SET(TO, FROM) \
334 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
335 scan_tp_[0] &= scan_fp_[0]; \
336 scan_tp_[1] &= scan_fp_[1]; \
337 scan_tp_[2] &= scan_fp_[2]; \
338 scan_tp_[3] &= scan_fp_[3]; } while (0)
340 #define AND_COMPL_HARD_REG_SET(TO, FROM) \
341 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
342 scan_tp_[0] &= ~ scan_fp_[0]; \
343 scan_tp_[1] &= ~ scan_fp_[1]; \
344 scan_tp_[2] &= ~ scan_fp_[2]; \
345 scan_tp_[3] &= ~ scan_fp_[3]; } while (0)
347 #define IOR_HARD_REG_SET(TO, FROM) \
348 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
349 scan_tp_[0] |= scan_fp_[0]; \
350 scan_tp_[1] |= scan_fp_[1]; \
351 scan_tp_[2] |= scan_fp_[2]; \
352 scan_tp_[3] |= scan_fp_[3]; } while (0)
354 #define IOR_COMPL_HARD_REG_SET(TO, FROM) \
355 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
356 scan_tp_[0] |= ~ scan_fp_[0]; \
357 scan_tp_[1] |= ~ scan_fp_[1]; \
358 scan_tp_[2] |= ~ scan_fp_[2]; \
359 scan_tp_[3] |= ~ scan_fp_[3]; } while (0)
362 hard_reg_set_subset_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
364 return ((x
[0] & ~y
[0]) == 0
365 && (x
[1] & ~y
[1]) == 0
366 && (x
[2] & ~y
[2]) == 0
367 && (x
[3] & ~y
[3]) == 0);
371 hard_reg_set_equal_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
373 return x
[0] == y
[0] && x
[1] == y
[1] && x
[2] == y
[2] && x
[3] == y
[3];
377 hard_reg_set_intersect_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
379 return ((x
[0] & y
[0]) != 0
380 || (x
[1] & y
[1]) != 0
381 || (x
[2] & y
[2]) != 0
382 || (x
[3] & y
[3]) != 0);
386 hard_reg_set_empty_p (const HARD_REG_SET x
)
388 return x
[0] == 0 && x
[1] == 0 && x
[2] == 0 && x
[3] == 0;
391 #else /* FIRST_PSEUDO_REGISTER > 4*HOST_BITS_PER_WIDEST_FAST_INT */
393 #define CLEAR_HARD_REG_SET(TO) \
394 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
396 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
397 *scan_tp_++ = 0; } while (0)
399 #define SET_HARD_REG_SET(TO) \
400 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
402 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
403 *scan_tp_++ = -1; } while (0)
405 #define COPY_HARD_REG_SET(TO, FROM) \
406 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
408 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
409 *scan_tp_++ = *scan_fp_++; } while (0)
411 #define COMPL_HARD_REG_SET(TO, FROM) \
412 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
414 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
415 *scan_tp_++ = ~ *scan_fp_++; } while (0)
417 #define AND_HARD_REG_SET(TO, FROM) \
418 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
420 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
421 *scan_tp_++ &= *scan_fp_++; } while (0)
423 #define AND_COMPL_HARD_REG_SET(TO, FROM) \
424 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
426 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
427 *scan_tp_++ &= ~ *scan_fp_++; } while (0)
429 #define IOR_HARD_REG_SET(TO, FROM) \
430 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
432 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
433 *scan_tp_++ |= *scan_fp_++; } while (0)
435 #define IOR_COMPL_HARD_REG_SET(TO, FROM) \
436 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
438 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
439 *scan_tp_++ |= ~ *scan_fp_++; } while (0)
442 hard_reg_set_subset_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
446 for (i
= 0; i
< HARD_REG_SET_LONGS
; i
++)
447 if ((x
[i
] & ~y
[i
]) != 0)
453 hard_reg_set_equal_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
457 for (i
= 0; i
< HARD_REG_SET_LONGS
; i
++)
464 hard_reg_set_intersect_p (const HARD_REG_SET x
, const HARD_REG_SET y
)
468 for (i
= 0; i
< HARD_REG_SET_LONGS
; i
++)
469 if ((x
[i
] & y
[i
]) != 0)
475 hard_reg_set_empty_p (const HARD_REG_SET x
)
479 for (i
= 0; i
< HARD_REG_SET_LONGS
; i
++)
490 /* Iterator for hard register sets. */
494 /* Pointer to the current element. */
495 HARD_REG_ELT_TYPE
*pelt
;
497 /* The length of the set. */
498 unsigned short length
;
500 /* Word within the current element. */
501 unsigned short word_no
;
503 /* Contents of the actually processed word. When finding next bit
504 it is shifted right, so that the actual bit is always the least
505 significant bit of ACTUAL. */
506 HARD_REG_ELT_TYPE bits
;
507 } hard_reg_set_iterator
;
509 #define HARD_REG_ELT_BITS UHOST_BITS_PER_WIDE_INT
511 /* The implementation of the iterator functions is fully analogous to
512 the bitmap iterators. */
514 hard_reg_set_iter_init (hard_reg_set_iterator
*iter
, HARD_REG_SET set
,
515 unsigned min
, unsigned *regno
)
517 #ifdef HARD_REG_SET_LONGS
519 iter
->length
= HARD_REG_SET_LONGS
;
524 iter
->word_no
= min
/ HARD_REG_ELT_BITS
;
525 if (iter
->word_no
< iter
->length
)
527 iter
->bits
= iter
->pelt
[iter
->word_no
];
528 iter
->bits
>>= min
% HARD_REG_ELT_BITS
;
530 /* This is required for correct search of the next bit. */
537 hard_reg_set_iter_set (hard_reg_set_iterator
*iter
, unsigned *regno
)
541 /* Return false when we're advanced past the end of the set. */
542 if (iter
->word_no
>= iter
->length
)
547 /* Find the correct bit and return it. */
548 while (!(iter
->bits
& 1))
553 return (*regno
< FIRST_PSEUDO_REGISTER
);
556 /* Round to the beginning of the next word. */
557 *regno
= (*regno
+ HARD_REG_ELT_BITS
- 1);
558 *regno
-= *regno
% HARD_REG_ELT_BITS
;
560 /* Find the next non-zero word. */
561 while (++iter
->word_no
< iter
->length
)
563 iter
->bits
= iter
->pelt
[iter
->word_no
];
566 *regno
+= HARD_REG_ELT_BITS
;
572 hard_reg_set_iter_next (hard_reg_set_iterator
*iter
, unsigned *regno
)
578 #define EXECUTE_IF_SET_IN_HARD_REG_SET(SET, MIN, REGNUM, ITER) \
579 for (hard_reg_set_iter_init (&(ITER), (SET), (MIN), &(REGNUM)); \
580 hard_reg_set_iter_set (&(ITER), &(REGNUM)); \
581 hard_reg_set_iter_next (&(ITER), &(REGNUM)))
584 /* Define some standard sets of registers. */
586 /* Indexed by hard register number, contains 1 for registers
587 that are being used for global register decls.
588 These must be exempt from ordinary flow analysis
589 and are also considered fixed. */
591 extern char global_regs
[FIRST_PSEUDO_REGISTER
];
593 struct target_hard_regs
{
594 /* The set of registers that actually exist on the current target. */
595 HARD_REG_SET x_accessible_reg_set
;
597 /* The set of registers that should be considered to be register
598 operands. It is a subset of x_accessible_reg_set. */
599 HARD_REG_SET x_operand_reg_set
;
601 /* Indexed by hard register number, contains 1 for registers
602 that are fixed use (stack pointer, pc, frame pointer, etc.;.
603 These are the registers that cannot be used to allocate
604 a pseudo reg whose life does not cross calls. */
605 char x_fixed_regs
[FIRST_PSEUDO_REGISTER
];
607 /* The same info as a HARD_REG_SET. */
608 HARD_REG_SET x_fixed_reg_set
;
610 /* Indexed by hard register number, contains 1 for registers
611 that are fixed use or are clobbered by function calls.
612 These are the registers that cannot be used to allocate
613 a pseudo reg whose life crosses calls. */
614 char x_call_used_regs
[FIRST_PSEUDO_REGISTER
];
616 char x_call_really_used_regs
[FIRST_PSEUDO_REGISTER
];
618 /* The same info as a HARD_REG_SET. */
619 HARD_REG_SET x_call_used_reg_set
;
621 /* Contains registers that are fixed use -- i.e. in fixed_reg_set -- or
622 a function value return register or TARGET_STRUCT_VALUE_RTX or
623 STATIC_CHAIN_REGNUM. These are the registers that cannot hold quantities
624 across calls even if we are willing to save and restore them. */
625 HARD_REG_SET x_call_fixed_reg_set
;
627 /* Contains 1 for registers that are set or clobbered by calls. */
628 /* ??? Ideally, this would be just call_used_regs plus global_regs, but
629 for someone's bright idea to have call_used_regs strictly include
630 fixed_regs. Which leaves us guessing as to the set of fixed_regs
631 that are actually preserved. We know for sure that those associated
632 with the local stack frame are safe, but scant others. */
633 HARD_REG_SET x_regs_invalidated_by_call
;
635 /* Call used hard registers which can not be saved because there is no
637 HARD_REG_SET x_no_caller_save_reg_set
;
639 /* Table of register numbers in the order in which to try to use them. */
640 int x_reg_alloc_order
[FIRST_PSEUDO_REGISTER
];
642 /* The inverse of reg_alloc_order. */
643 int x_inv_reg_alloc_order
[FIRST_PSEUDO_REGISTER
];
645 /* For each reg class, a HARD_REG_SET saying which registers are in it. */
646 HARD_REG_SET x_reg_class_contents
[N_REG_CLASSES
];
648 /* For each reg class, a boolean saying whether the class contains only
650 bool x_class_only_fixed_regs
[N_REG_CLASSES
];
652 /* For each reg class, number of regs it contains. */
653 unsigned int x_reg_class_size
[N_REG_CLASSES
];
655 /* For each reg class, table listing all the classes contained in it. */
656 enum reg_class x_reg_class_subclasses
[N_REG_CLASSES
][N_REG_CLASSES
];
658 /* For each pair of reg classes,
659 a largest reg class contained in their union. */
660 enum reg_class x_reg_class_subunion
[N_REG_CLASSES
][N_REG_CLASSES
];
662 /* For each pair of reg classes,
663 the smallest reg class that contains their union. */
664 enum reg_class x_reg_class_superunion
[N_REG_CLASSES
][N_REG_CLASSES
];
666 /* Vector indexed by hardware reg giving its name. */
667 const char *x_reg_names
[FIRST_PSEUDO_REGISTER
];
670 extern struct target_hard_regs default_target_hard_regs
;
671 #if SWITCHABLE_TARGET
672 extern struct target_hard_regs
*this_target_hard_regs
;
674 #define this_target_hard_regs (&default_target_hard_regs)
677 #define accessible_reg_set \
678 (this_target_hard_regs->x_accessible_reg_set)
679 #define operand_reg_set \
680 (this_target_hard_regs->x_operand_reg_set)
682 (this_target_hard_regs->x_fixed_regs)
683 #define fixed_reg_set \
684 (this_target_hard_regs->x_fixed_reg_set)
685 #define call_used_regs \
686 (this_target_hard_regs->x_call_used_regs)
687 #define call_really_used_regs \
688 (this_target_hard_regs->x_call_really_used_regs)
689 #define call_used_reg_set \
690 (this_target_hard_regs->x_call_used_reg_set)
691 #define call_fixed_reg_set \
692 (this_target_hard_regs->x_call_fixed_reg_set)
693 #define regs_invalidated_by_call \
694 (this_target_hard_regs->x_regs_invalidated_by_call)
695 #define no_caller_save_reg_set \
696 (this_target_hard_regs->x_no_caller_save_reg_set)
697 #define reg_alloc_order \
698 (this_target_hard_regs->x_reg_alloc_order)
699 #define inv_reg_alloc_order \
700 (this_target_hard_regs->x_inv_reg_alloc_order)
701 #define reg_class_contents \
702 (this_target_hard_regs->x_reg_class_contents)
703 #define class_only_fixed_regs \
704 (this_target_hard_regs->x_class_only_fixed_regs)
705 #define reg_class_size \
706 (this_target_hard_regs->x_reg_class_size)
707 #define reg_class_subclasses \
708 (this_target_hard_regs->x_reg_class_subclasses)
709 #define reg_class_subunion \
710 (this_target_hard_regs->x_reg_class_subunion)
711 #define reg_class_superunion \
712 (this_target_hard_regs->x_reg_class_superunion)
714 (this_target_hard_regs->x_reg_names)
716 /* Vector indexed by reg class giving its name. */
718 extern const char * reg_class_names
[];
720 /* Given a hard REGN a FROM mode and a TO mode, return nonzero if
721 REGN cannot change modes between the specified modes. */
722 #define REG_CANNOT_CHANGE_MODE_P(REGN, FROM, TO) \
723 CANNOT_CHANGE_MODE_CLASS (FROM, TO, REGNO_REG_CLASS (REGN))
725 #endif /* ! GCC_HARD_REG_SET_H */