xref: /dflybsd-src/contrib/gcc-4.7/gcc/hard-reg-set.h (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* Sets (bit vectors) of hard registers, and operations on them.
2*e4b17023SJohn Marino    Copyright (C) 1987, 1992, 1994, 2000, 2003, 2004, 2005, 2007, 2008, 2009,
3*e4b17023SJohn Marino    2010, 2012 Free Software Foundation, Inc.
4*e4b17023SJohn Marino 
5*e4b17023SJohn Marino This file is part of GCC
6*e4b17023SJohn Marino 
7*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
8*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
9*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
10*e4b17023SJohn Marino version.
11*e4b17023SJohn Marino 
12*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
14*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15*e4b17023SJohn Marino for more details.
16*e4b17023SJohn Marino 
17*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
18*e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
19*e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
20*e4b17023SJohn Marino 
21*e4b17023SJohn Marino #ifndef GCC_HARD_REG_SET_H
22*e4b17023SJohn Marino #define GCC_HARD_REG_SET_H
23*e4b17023SJohn Marino 
24*e4b17023SJohn Marino /* Define the type of a set of hard registers.  */
25*e4b17023SJohn Marino 
26*e4b17023SJohn Marino /* HARD_REG_ELT_TYPE is a typedef of the unsigned integral type which
27*e4b17023SJohn Marino    will be used for hard reg sets, either alone or in an array.
28*e4b17023SJohn Marino 
29*e4b17023SJohn Marino    If HARD_REG_SET is a macro, its definition is HARD_REG_ELT_TYPE,
30*e4b17023SJohn Marino    and it has enough bits to represent all the target machine's hard
31*e4b17023SJohn Marino    registers.  Otherwise, it is a typedef for a suitably sized array
32*e4b17023SJohn Marino    of HARD_REG_ELT_TYPEs.  HARD_REG_SET_LONGS is defined as how many.
33*e4b17023SJohn Marino 
34*e4b17023SJohn Marino    Note that lots of code assumes that the first part of a regset is
35*e4b17023SJohn Marino    the same format as a HARD_REG_SET.  To help make sure this is true,
36*e4b17023SJohn Marino    we only try the widest fast integer mode (HOST_WIDEST_FAST_INT)
37*e4b17023SJohn Marino    instead of all the smaller types.  This approach loses only if
38*e4b17023SJohn Marino    there are very few registers and then only in the few cases where
39*e4b17023SJohn Marino    we have an array of HARD_REG_SETs, so it needn't be as complex as
40*e4b17023SJohn Marino    it used to be.  */
41*e4b17023SJohn Marino 
42*e4b17023SJohn Marino typedef unsigned HOST_WIDEST_FAST_INT HARD_REG_ELT_TYPE;
43*e4b17023SJohn Marino 
44*e4b17023SJohn Marino #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDEST_FAST_INT
45*e4b17023SJohn Marino 
46*e4b17023SJohn Marino #define HARD_REG_SET HARD_REG_ELT_TYPE
47*e4b17023SJohn Marino 
48*e4b17023SJohn Marino #else
49*e4b17023SJohn Marino 
50*e4b17023SJohn Marino #define HARD_REG_SET_LONGS \
51*e4b17023SJohn Marino  ((FIRST_PSEUDO_REGISTER + HOST_BITS_PER_WIDEST_FAST_INT - 1)	\
52*e4b17023SJohn Marino   / HOST_BITS_PER_WIDEST_FAST_INT)
53*e4b17023SJohn Marino typedef HARD_REG_ELT_TYPE HARD_REG_SET[HARD_REG_SET_LONGS];
54*e4b17023SJohn Marino 
55*e4b17023SJohn Marino #endif
56*e4b17023SJohn Marino 
57*e4b17023SJohn Marino /* HARD_REG_SET wrapped into a structure, to make it possible to
58*e4b17023SJohn Marino    use HARD_REG_SET even in APIs that should not include
59*e4b17023SJohn Marino    hard-reg-set.h.  */
60*e4b17023SJohn Marino struct hard_reg_set_container
61*e4b17023SJohn Marino {
62*e4b17023SJohn Marino   HARD_REG_SET set;
63*e4b17023SJohn Marino };
64*e4b17023SJohn Marino 
65*e4b17023SJohn Marino /* HARD_CONST is used to cast a constant to the appropriate type
66*e4b17023SJohn Marino    for use with a HARD_REG_SET.  */
67*e4b17023SJohn Marino 
68*e4b17023SJohn Marino #define HARD_CONST(X) ((HARD_REG_ELT_TYPE) (X))
69*e4b17023SJohn Marino 
70*e4b17023SJohn Marino /* Define macros SET_HARD_REG_BIT, CLEAR_HARD_REG_BIT and TEST_HARD_REG_BIT
71*e4b17023SJohn Marino    to set, clear or test one bit in a hard reg set of type HARD_REG_SET.
72*e4b17023SJohn Marino    All three take two arguments: the set and the register number.
73*e4b17023SJohn Marino 
74*e4b17023SJohn Marino    In the case where sets are arrays of longs, the first argument
75*e4b17023SJohn Marino    is actually a pointer to a long.
76*e4b17023SJohn Marino 
77*e4b17023SJohn Marino    Define two macros for initializing a set:
78*e4b17023SJohn Marino    CLEAR_HARD_REG_SET and SET_HARD_REG_SET.
79*e4b17023SJohn Marino    These take just one argument.
80*e4b17023SJohn Marino 
81*e4b17023SJohn Marino    Also define macros for copying hard reg sets:
82*e4b17023SJohn Marino    COPY_HARD_REG_SET and COMPL_HARD_REG_SET.
83*e4b17023SJohn Marino    These take two arguments TO and FROM; they read from FROM
84*e4b17023SJohn Marino    and store into TO.  COMPL_HARD_REG_SET complements each bit.
85*e4b17023SJohn Marino 
86*e4b17023SJohn Marino    Also define macros for combining hard reg sets:
87*e4b17023SJohn Marino    IOR_HARD_REG_SET and AND_HARD_REG_SET.
88*e4b17023SJohn Marino    These take two arguments TO and FROM; they read from FROM
89*e4b17023SJohn Marino    and combine bitwise into TO.  Define also two variants
90*e4b17023SJohn Marino    IOR_COMPL_HARD_REG_SET and AND_COMPL_HARD_REG_SET
91*e4b17023SJohn Marino    which use the complement of the set FROM.
92*e4b17023SJohn Marino 
93*e4b17023SJohn Marino    Also define:
94*e4b17023SJohn Marino 
95*e4b17023SJohn Marino    hard_reg_set_subset_p (X, Y), which returns true if X is a subset of Y.
96*e4b17023SJohn Marino    hard_reg_set_equal_p (X, Y), which returns true if X and Y are equal.
97*e4b17023SJohn Marino    hard_reg_set_intersect_p (X, Y), which returns true if X and Y intersect.
98*e4b17023SJohn Marino    hard_reg_set_empty_p (X), which returns true if X is empty.  */
99*e4b17023SJohn Marino 
100*e4b17023SJohn Marino #define UHOST_BITS_PER_WIDE_INT ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT)
101*e4b17023SJohn Marino 
102*e4b17023SJohn Marino #ifdef HARD_REG_SET
103*e4b17023SJohn Marino 
104*e4b17023SJohn Marino #define SET_HARD_REG_BIT(SET, BIT)  \
105*e4b17023SJohn Marino  ((SET) |= HARD_CONST (1) << (BIT))
106*e4b17023SJohn Marino #define CLEAR_HARD_REG_BIT(SET, BIT)  \
107*e4b17023SJohn Marino  ((SET) &= ~(HARD_CONST (1) << (BIT)))
108*e4b17023SJohn Marino #define TEST_HARD_REG_BIT(SET, BIT)  \
109*e4b17023SJohn Marino  (!!((SET) & (HARD_CONST (1) << (BIT))))
110*e4b17023SJohn Marino 
111*e4b17023SJohn Marino #define CLEAR_HARD_REG_SET(TO) ((TO) = HARD_CONST (0))
112*e4b17023SJohn Marino #define SET_HARD_REG_SET(TO) ((TO) = ~ HARD_CONST (0))
113*e4b17023SJohn Marino 
114*e4b17023SJohn Marino #define COPY_HARD_REG_SET(TO, FROM) ((TO) = (FROM))
115*e4b17023SJohn Marino #define COMPL_HARD_REG_SET(TO, FROM) ((TO) = ~(FROM))
116*e4b17023SJohn Marino 
117*e4b17023SJohn Marino #define IOR_HARD_REG_SET(TO, FROM) ((TO) |= (FROM))
118*e4b17023SJohn Marino #define IOR_COMPL_HARD_REG_SET(TO, FROM) ((TO) |= ~ (FROM))
119*e4b17023SJohn Marino #define AND_HARD_REG_SET(TO, FROM) ((TO) &= (FROM))
120*e4b17023SJohn Marino #define AND_COMPL_HARD_REG_SET(TO, FROM) ((TO) &= ~ (FROM))
121*e4b17023SJohn Marino 
122*e4b17023SJohn Marino static inline bool
hard_reg_set_subset_p(const HARD_REG_SET x,const HARD_REG_SET y)123*e4b17023SJohn Marino hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y)
124*e4b17023SJohn Marino {
125*e4b17023SJohn Marino   return (x & ~y) == HARD_CONST (0);
126*e4b17023SJohn Marino }
127*e4b17023SJohn Marino 
128*e4b17023SJohn Marino static inline bool
hard_reg_set_equal_p(const HARD_REG_SET x,const HARD_REG_SET y)129*e4b17023SJohn Marino hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y)
130*e4b17023SJohn Marino {
131*e4b17023SJohn Marino   return x == y;
132*e4b17023SJohn Marino }
133*e4b17023SJohn Marino 
134*e4b17023SJohn Marino static inline bool
hard_reg_set_intersect_p(const HARD_REG_SET x,const HARD_REG_SET y)135*e4b17023SJohn Marino hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y)
136*e4b17023SJohn Marino {
137*e4b17023SJohn Marino   return (x & y) != HARD_CONST (0);
138*e4b17023SJohn Marino }
139*e4b17023SJohn Marino 
140*e4b17023SJohn Marino static inline bool
hard_reg_set_empty_p(const HARD_REG_SET x)141*e4b17023SJohn Marino hard_reg_set_empty_p (const HARD_REG_SET x)
142*e4b17023SJohn Marino {
143*e4b17023SJohn Marino   return x == HARD_CONST (0);
144*e4b17023SJohn Marino }
145*e4b17023SJohn Marino 
146*e4b17023SJohn Marino #else
147*e4b17023SJohn Marino 
148*e4b17023SJohn Marino #define SET_HARD_REG_BIT(SET, BIT)		\
149*e4b17023SJohn Marino   ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT]	\
150*e4b17023SJohn Marino    |= HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))
151*e4b17023SJohn Marino 
152*e4b17023SJohn Marino #define CLEAR_HARD_REG_BIT(SET, BIT)		\
153*e4b17023SJohn Marino   ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT]	\
154*e4b17023SJohn Marino    &= ~(HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)))
155*e4b17023SJohn Marino 
156*e4b17023SJohn Marino #define TEST_HARD_REG_BIT(SET, BIT)		\
157*e4b17023SJohn Marino   (!!((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT]	\
158*e4b17023SJohn Marino       & (HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))))
159*e4b17023SJohn Marino 
160*e4b17023SJohn Marino #if FIRST_PSEUDO_REGISTER <= 2*HOST_BITS_PER_WIDEST_FAST_INT
161*e4b17023SJohn Marino #define CLEAR_HARD_REG_SET(TO)  \
162*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO);			\
163*e4b17023SJohn Marino      scan_tp_[0] = 0;						\
164*e4b17023SJohn Marino      scan_tp_[1] = 0; } while (0)
165*e4b17023SJohn Marino 
166*e4b17023SJohn Marino #define SET_HARD_REG_SET(TO)  \
167*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO);			\
168*e4b17023SJohn Marino      scan_tp_[0] = -1;						\
169*e4b17023SJohn Marino      scan_tp_[1] = -1; } while (0)
170*e4b17023SJohn Marino 
171*e4b17023SJohn Marino #define COPY_HARD_REG_SET(TO, FROM)  \
172*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM);	\
173*e4b17023SJohn Marino      scan_tp_[0] = scan_fp_[0];					\
174*e4b17023SJohn Marino      scan_tp_[1] = scan_fp_[1]; } while (0)
175*e4b17023SJohn Marino 
176*e4b17023SJohn Marino #define COMPL_HARD_REG_SET(TO, FROM)  \
177*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
178*e4b17023SJohn Marino      scan_tp_[0] = ~ scan_fp_[0];				\
179*e4b17023SJohn Marino      scan_tp_[1] = ~ scan_fp_[1]; } while (0)
180*e4b17023SJohn Marino 
181*e4b17023SJohn Marino #define AND_HARD_REG_SET(TO, FROM)  \
182*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
183*e4b17023SJohn Marino      scan_tp_[0] &= scan_fp_[0];				\
184*e4b17023SJohn Marino      scan_tp_[1] &= scan_fp_[1]; } while (0)
185*e4b17023SJohn Marino 
186*e4b17023SJohn Marino #define AND_COMPL_HARD_REG_SET(TO, FROM)  \
187*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
188*e4b17023SJohn Marino      scan_tp_[0] &= ~ scan_fp_[0];				\
189*e4b17023SJohn Marino      scan_tp_[1] &= ~ scan_fp_[1]; } while (0)
190*e4b17023SJohn Marino 
191*e4b17023SJohn Marino #define IOR_HARD_REG_SET(TO, FROM)  \
192*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
193*e4b17023SJohn Marino      scan_tp_[0] |= scan_fp_[0];				\
194*e4b17023SJohn Marino      scan_tp_[1] |= scan_fp_[1]; } while (0)
195*e4b17023SJohn Marino 
196*e4b17023SJohn Marino #define IOR_COMPL_HARD_REG_SET(TO, FROM)  \
197*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
198*e4b17023SJohn Marino      scan_tp_[0] |= ~ scan_fp_[0];				\
199*e4b17023SJohn Marino      scan_tp_[1] |= ~ scan_fp_[1]; } while (0)
200*e4b17023SJohn Marino 
201*e4b17023SJohn Marino static inline bool
hard_reg_set_subset_p(const HARD_REG_SET x,const HARD_REG_SET y)202*e4b17023SJohn Marino hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y)
203*e4b17023SJohn Marino {
204*e4b17023SJohn Marino   return (x[0] & ~y[0]) == 0 && (x[1] & ~y[1]) == 0;
205*e4b17023SJohn Marino }
206*e4b17023SJohn Marino 
207*e4b17023SJohn Marino static inline bool
hard_reg_set_equal_p(const HARD_REG_SET x,const HARD_REG_SET y)208*e4b17023SJohn Marino hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y)
209*e4b17023SJohn Marino {
210*e4b17023SJohn Marino   return x[0] == y[0] && x[1] == y[1];
211*e4b17023SJohn Marino }
212*e4b17023SJohn Marino 
213*e4b17023SJohn Marino static inline bool
hard_reg_set_intersect_p(const HARD_REG_SET x,const HARD_REG_SET y)214*e4b17023SJohn Marino hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y)
215*e4b17023SJohn Marino {
216*e4b17023SJohn Marino   return (x[0] & y[0]) != 0 || (x[1] & y[1]) != 0;
217*e4b17023SJohn Marino }
218*e4b17023SJohn Marino 
219*e4b17023SJohn Marino static inline bool
hard_reg_set_empty_p(const HARD_REG_SET x)220*e4b17023SJohn Marino hard_reg_set_empty_p (const HARD_REG_SET x)
221*e4b17023SJohn Marino {
222*e4b17023SJohn Marino   return x[0] == 0 && x[1] == 0;
223*e4b17023SJohn Marino }
224*e4b17023SJohn Marino 
225*e4b17023SJohn Marino #else
226*e4b17023SJohn Marino #if FIRST_PSEUDO_REGISTER <= 3*HOST_BITS_PER_WIDEST_FAST_INT
227*e4b17023SJohn Marino #define CLEAR_HARD_REG_SET(TO)  \
228*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO);			\
229*e4b17023SJohn Marino      scan_tp_[0] = 0;						\
230*e4b17023SJohn Marino      scan_tp_[1] = 0;						\
231*e4b17023SJohn Marino      scan_tp_[2] = 0; } while (0)
232*e4b17023SJohn Marino 
233*e4b17023SJohn Marino #define SET_HARD_REG_SET(TO)  \
234*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO);			\
235*e4b17023SJohn Marino      scan_tp_[0] = -1;						\
236*e4b17023SJohn Marino      scan_tp_[1] = -1;						\
237*e4b17023SJohn Marino      scan_tp_[2] = -1; } while (0)
238*e4b17023SJohn Marino 
239*e4b17023SJohn Marino #define COPY_HARD_REG_SET(TO, FROM)  \
240*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM);	\
241*e4b17023SJohn Marino      scan_tp_[0] = scan_fp_[0];					\
242*e4b17023SJohn Marino      scan_tp_[1] = scan_fp_[1];					\
243*e4b17023SJohn Marino      scan_tp_[2] = scan_fp_[2]; } while (0)
244*e4b17023SJohn Marino 
245*e4b17023SJohn Marino #define COMPL_HARD_REG_SET(TO, FROM)  \
246*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
247*e4b17023SJohn Marino      scan_tp_[0] = ~ scan_fp_[0];				\
248*e4b17023SJohn Marino      scan_tp_[1] = ~ scan_fp_[1];				\
249*e4b17023SJohn Marino      scan_tp_[2] = ~ scan_fp_[2]; } while (0)
250*e4b17023SJohn Marino 
251*e4b17023SJohn Marino #define AND_HARD_REG_SET(TO, FROM)  \
252*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
253*e4b17023SJohn Marino      scan_tp_[0] &= scan_fp_[0];				\
254*e4b17023SJohn Marino      scan_tp_[1] &= scan_fp_[1];				\
255*e4b17023SJohn Marino      scan_tp_[2] &= scan_fp_[2]; } while (0)
256*e4b17023SJohn Marino 
257*e4b17023SJohn Marino #define AND_COMPL_HARD_REG_SET(TO, FROM)  \
258*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
259*e4b17023SJohn Marino      scan_tp_[0] &= ~ scan_fp_[0];				\
260*e4b17023SJohn Marino      scan_tp_[1] &= ~ scan_fp_[1];				\
261*e4b17023SJohn Marino      scan_tp_[2] &= ~ scan_fp_[2]; } while (0)
262*e4b17023SJohn Marino 
263*e4b17023SJohn Marino #define IOR_HARD_REG_SET(TO, FROM)  \
264*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
265*e4b17023SJohn Marino      scan_tp_[0] |= scan_fp_[0];				\
266*e4b17023SJohn Marino      scan_tp_[1] |= scan_fp_[1];				\
267*e4b17023SJohn Marino      scan_tp_[2] |= scan_fp_[2]; } while (0)
268*e4b17023SJohn Marino 
269*e4b17023SJohn Marino #define IOR_COMPL_HARD_REG_SET(TO, FROM)  \
270*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
271*e4b17023SJohn Marino      scan_tp_[0] |= ~ scan_fp_[0];				\
272*e4b17023SJohn Marino      scan_tp_[1] |= ~ scan_fp_[1];				\
273*e4b17023SJohn Marino      scan_tp_[2] |= ~ scan_fp_[2]; } while (0)
274*e4b17023SJohn Marino 
275*e4b17023SJohn Marino static inline bool
hard_reg_set_subset_p(const HARD_REG_SET x,const HARD_REG_SET y)276*e4b17023SJohn Marino hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y)
277*e4b17023SJohn Marino {
278*e4b17023SJohn Marino   return ((x[0] & ~y[0]) == 0
279*e4b17023SJohn Marino 	  && (x[1] & ~y[1]) == 0
280*e4b17023SJohn Marino 	  && (x[2] & ~y[2]) == 0);
281*e4b17023SJohn Marino }
282*e4b17023SJohn Marino 
283*e4b17023SJohn Marino static inline bool
hard_reg_set_equal_p(const HARD_REG_SET x,const HARD_REG_SET y)284*e4b17023SJohn Marino hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y)
285*e4b17023SJohn Marino {
286*e4b17023SJohn Marino   return x[0] == y[0] && x[1] == y[1] && x[2] == y[2];
287*e4b17023SJohn Marino }
288*e4b17023SJohn Marino 
289*e4b17023SJohn Marino static inline bool
hard_reg_set_intersect_p(const HARD_REG_SET x,const HARD_REG_SET y)290*e4b17023SJohn Marino hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y)
291*e4b17023SJohn Marino {
292*e4b17023SJohn Marino   return ((x[0] & y[0]) != 0
293*e4b17023SJohn Marino 	  || (x[1] & y[1]) != 0
294*e4b17023SJohn Marino 	  || (x[2] & y[2]) != 0);
295*e4b17023SJohn Marino }
296*e4b17023SJohn Marino 
297*e4b17023SJohn Marino static inline bool
hard_reg_set_empty_p(const HARD_REG_SET x)298*e4b17023SJohn Marino hard_reg_set_empty_p (const HARD_REG_SET x)
299*e4b17023SJohn Marino {
300*e4b17023SJohn Marino   return x[0] == 0 && x[1] == 0 && x[2] == 0;
301*e4b17023SJohn Marino }
302*e4b17023SJohn Marino 
303*e4b17023SJohn Marino #else
304*e4b17023SJohn Marino #if FIRST_PSEUDO_REGISTER <= 4*HOST_BITS_PER_WIDEST_FAST_INT
305*e4b17023SJohn Marino #define CLEAR_HARD_REG_SET(TO)  \
306*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO);			\
307*e4b17023SJohn Marino      scan_tp_[0] = 0;						\
308*e4b17023SJohn Marino      scan_tp_[1] = 0;						\
309*e4b17023SJohn Marino      scan_tp_[2] = 0;						\
310*e4b17023SJohn Marino      scan_tp_[3] = 0; } while (0)
311*e4b17023SJohn Marino 
312*e4b17023SJohn Marino #define SET_HARD_REG_SET(TO)  \
313*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO);			\
314*e4b17023SJohn Marino      scan_tp_[0] = -1;						\
315*e4b17023SJohn Marino      scan_tp_[1] = -1;						\
316*e4b17023SJohn Marino      scan_tp_[2] = -1;						\
317*e4b17023SJohn Marino      scan_tp_[3] = -1; } while (0)
318*e4b17023SJohn Marino 
319*e4b17023SJohn Marino #define COPY_HARD_REG_SET(TO, FROM)  \
320*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM);	\
321*e4b17023SJohn Marino      scan_tp_[0] = scan_fp_[0];					\
322*e4b17023SJohn Marino      scan_tp_[1] = scan_fp_[1];					\
323*e4b17023SJohn Marino      scan_tp_[2] = scan_fp_[2];					\
324*e4b17023SJohn Marino      scan_tp_[3] = scan_fp_[3]; } while (0)
325*e4b17023SJohn Marino 
326*e4b17023SJohn Marino #define COMPL_HARD_REG_SET(TO, FROM)  \
327*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
328*e4b17023SJohn Marino      scan_tp_[0] = ~ scan_fp_[0];				\
329*e4b17023SJohn Marino      scan_tp_[1] = ~ scan_fp_[1];				\
330*e4b17023SJohn Marino      scan_tp_[2] = ~ scan_fp_[2];				\
331*e4b17023SJohn Marino      scan_tp_[3] = ~ scan_fp_[3]; } while (0)
332*e4b17023SJohn Marino 
333*e4b17023SJohn Marino #define AND_HARD_REG_SET(TO, FROM)  \
334*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
335*e4b17023SJohn Marino      scan_tp_[0] &= scan_fp_[0];				\
336*e4b17023SJohn Marino      scan_tp_[1] &= scan_fp_[1];				\
337*e4b17023SJohn Marino      scan_tp_[2] &= scan_fp_[2];				\
338*e4b17023SJohn Marino      scan_tp_[3] &= scan_fp_[3]; } while (0)
339*e4b17023SJohn Marino 
340*e4b17023SJohn Marino #define AND_COMPL_HARD_REG_SET(TO, FROM)  \
341*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
342*e4b17023SJohn Marino      scan_tp_[0] &= ~ scan_fp_[0];				\
343*e4b17023SJohn Marino      scan_tp_[1] &= ~ scan_fp_[1];				\
344*e4b17023SJohn Marino      scan_tp_[2] &= ~ scan_fp_[2];				\
345*e4b17023SJohn Marino      scan_tp_[3] &= ~ scan_fp_[3]; } while (0)
346*e4b17023SJohn Marino 
347*e4b17023SJohn Marino #define IOR_HARD_REG_SET(TO, FROM)  \
348*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
349*e4b17023SJohn Marino      scan_tp_[0] |= scan_fp_[0];				\
350*e4b17023SJohn Marino      scan_tp_[1] |= scan_fp_[1];				\
351*e4b17023SJohn Marino      scan_tp_[2] |= scan_fp_[2];				\
352*e4b17023SJohn Marino      scan_tp_[3] |= scan_fp_[3]; } while (0)
353*e4b17023SJohn Marino 
354*e4b17023SJohn Marino #define IOR_COMPL_HARD_REG_SET(TO, FROM)  \
355*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
356*e4b17023SJohn Marino      scan_tp_[0] |= ~ scan_fp_[0];				\
357*e4b17023SJohn Marino      scan_tp_[1] |= ~ scan_fp_[1];				\
358*e4b17023SJohn Marino      scan_tp_[2] |= ~ scan_fp_[2];				\
359*e4b17023SJohn Marino      scan_tp_[3] |= ~ scan_fp_[3]; } while (0)
360*e4b17023SJohn Marino 
361*e4b17023SJohn Marino static inline bool
hard_reg_set_subset_p(const HARD_REG_SET x,const HARD_REG_SET y)362*e4b17023SJohn Marino hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y)
363*e4b17023SJohn Marino {
364*e4b17023SJohn Marino   return ((x[0] & ~y[0]) == 0
365*e4b17023SJohn Marino 	  && (x[1] & ~y[1]) == 0
366*e4b17023SJohn Marino 	  && (x[2] & ~y[2]) == 0
367*e4b17023SJohn Marino 	  && (x[3] & ~y[3]) == 0);
368*e4b17023SJohn Marino }
369*e4b17023SJohn Marino 
370*e4b17023SJohn Marino static inline bool
hard_reg_set_equal_p(const HARD_REG_SET x,const HARD_REG_SET y)371*e4b17023SJohn Marino hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y)
372*e4b17023SJohn Marino {
373*e4b17023SJohn Marino   return x[0] == y[0] && x[1] == y[1] && x[2] == y[2] && x[3] == y[3];
374*e4b17023SJohn Marino }
375*e4b17023SJohn Marino 
376*e4b17023SJohn Marino static inline bool
hard_reg_set_intersect_p(const HARD_REG_SET x,const HARD_REG_SET y)377*e4b17023SJohn Marino hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y)
378*e4b17023SJohn Marino {
379*e4b17023SJohn Marino   return ((x[0] & y[0]) != 0
380*e4b17023SJohn Marino 	  || (x[1] & y[1]) != 0
381*e4b17023SJohn Marino 	  || (x[2] & y[2]) != 0
382*e4b17023SJohn Marino 	  || (x[3] & y[3]) != 0);
383*e4b17023SJohn Marino }
384*e4b17023SJohn Marino 
385*e4b17023SJohn Marino static inline bool
hard_reg_set_empty_p(const HARD_REG_SET x)386*e4b17023SJohn Marino hard_reg_set_empty_p (const HARD_REG_SET x)
387*e4b17023SJohn Marino {
388*e4b17023SJohn Marino   return x[0] == 0 && x[1] == 0 && x[2] == 0 && x[3] == 0;
389*e4b17023SJohn Marino }
390*e4b17023SJohn Marino 
391*e4b17023SJohn Marino #else /* FIRST_PSEUDO_REGISTER > 4*HOST_BITS_PER_WIDEST_FAST_INT */
392*e4b17023SJohn Marino 
393*e4b17023SJohn Marino #define CLEAR_HARD_REG_SET(TO)  \
394*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO);			\
395*e4b17023SJohn Marino      int i;							\
396*e4b17023SJohn Marino      for (i = 0; i < HARD_REG_SET_LONGS; i++)			\
397*e4b17023SJohn Marino        *scan_tp_++ = 0; } while (0)
398*e4b17023SJohn Marino 
399*e4b17023SJohn Marino #define SET_HARD_REG_SET(TO)  \
400*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO);			\
401*e4b17023SJohn Marino      int i;							\
402*e4b17023SJohn Marino      for (i = 0; i < HARD_REG_SET_LONGS; i++)			\
403*e4b17023SJohn Marino        *scan_tp_++ = -1; } while (0)
404*e4b17023SJohn Marino 
405*e4b17023SJohn Marino #define COPY_HARD_REG_SET(TO, FROM)  \
406*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
407*e4b17023SJohn Marino      int i;							\
408*e4b17023SJohn Marino      for (i = 0; i < HARD_REG_SET_LONGS; i++)			\
409*e4b17023SJohn Marino        *scan_tp_++ = *scan_fp_++; } while (0)
410*e4b17023SJohn Marino 
411*e4b17023SJohn Marino #define COMPL_HARD_REG_SET(TO, FROM)  \
412*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
413*e4b17023SJohn Marino      int i;							\
414*e4b17023SJohn Marino      for (i = 0; i < HARD_REG_SET_LONGS; i++)			\
415*e4b17023SJohn Marino        *scan_tp_++ = ~ *scan_fp_++; } while (0)
416*e4b17023SJohn Marino 
417*e4b17023SJohn Marino #define AND_HARD_REG_SET(TO, FROM)  \
418*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
419*e4b17023SJohn Marino      int i;							\
420*e4b17023SJohn Marino      for (i = 0; i < HARD_REG_SET_LONGS; i++)			\
421*e4b17023SJohn Marino        *scan_tp_++ &= *scan_fp_++; } while (0)
422*e4b17023SJohn Marino 
423*e4b17023SJohn Marino #define AND_COMPL_HARD_REG_SET(TO, FROM)  \
424*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
425*e4b17023SJohn Marino      int i;							\
426*e4b17023SJohn Marino      for (i = 0; i < HARD_REG_SET_LONGS; i++)			\
427*e4b17023SJohn Marino        *scan_tp_++ &= ~ *scan_fp_++; } while (0)
428*e4b17023SJohn Marino 
429*e4b17023SJohn Marino #define IOR_HARD_REG_SET(TO, FROM)  \
430*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
431*e4b17023SJohn Marino      int i;							\
432*e4b17023SJohn Marino      for (i = 0; i < HARD_REG_SET_LONGS; i++)			\
433*e4b17023SJohn Marino        *scan_tp_++ |= *scan_fp_++; } while (0)
434*e4b17023SJohn Marino 
435*e4b17023SJohn Marino #define IOR_COMPL_HARD_REG_SET(TO, FROM)  \
436*e4b17023SJohn Marino do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); 	\
437*e4b17023SJohn Marino      int i;							\
438*e4b17023SJohn Marino      for (i = 0; i < HARD_REG_SET_LONGS; i++)			\
439*e4b17023SJohn Marino        *scan_tp_++ |= ~ *scan_fp_++; } while (0)
440*e4b17023SJohn Marino 
441*e4b17023SJohn Marino static inline bool
hard_reg_set_subset_p(const HARD_REG_SET x,const HARD_REG_SET y)442*e4b17023SJohn Marino hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y)
443*e4b17023SJohn Marino {
444*e4b17023SJohn Marino   int i;
445*e4b17023SJohn Marino 
446*e4b17023SJohn Marino   for (i = 0; i < HARD_REG_SET_LONGS; i++)
447*e4b17023SJohn Marino     if ((x[i] & ~y[i]) != 0)
448*e4b17023SJohn Marino       return false;
449*e4b17023SJohn Marino   return true;
450*e4b17023SJohn Marino }
451*e4b17023SJohn Marino 
452*e4b17023SJohn Marino static inline bool
hard_reg_set_equal_p(const HARD_REG_SET x,const HARD_REG_SET y)453*e4b17023SJohn Marino hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y)
454*e4b17023SJohn Marino {
455*e4b17023SJohn Marino   int i;
456*e4b17023SJohn Marino 
457*e4b17023SJohn Marino   for (i = 0; i < HARD_REG_SET_LONGS; i++)
458*e4b17023SJohn Marino     if (x[i] != y[i])
459*e4b17023SJohn Marino       return false;
460*e4b17023SJohn Marino   return true;
461*e4b17023SJohn Marino }
462*e4b17023SJohn Marino 
463*e4b17023SJohn Marino static inline bool
hard_reg_set_intersect_p(const HARD_REG_SET x,const HARD_REG_SET y)464*e4b17023SJohn Marino hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y)
465*e4b17023SJohn Marino {
466*e4b17023SJohn Marino   int i;
467*e4b17023SJohn Marino 
468*e4b17023SJohn Marino   for (i = 0; i < HARD_REG_SET_LONGS; i++)
469*e4b17023SJohn Marino     if ((x[i] & y[i]) != 0)
470*e4b17023SJohn Marino       return true;
471*e4b17023SJohn Marino   return false;
472*e4b17023SJohn Marino }
473*e4b17023SJohn Marino 
474*e4b17023SJohn Marino static inline bool
hard_reg_set_empty_p(const HARD_REG_SET x)475*e4b17023SJohn Marino hard_reg_set_empty_p (const HARD_REG_SET x)
476*e4b17023SJohn Marino {
477*e4b17023SJohn Marino   int i;
478*e4b17023SJohn Marino 
479*e4b17023SJohn Marino   for (i = 0; i < HARD_REG_SET_LONGS; i++)
480*e4b17023SJohn Marino     if (x[i] != 0)
481*e4b17023SJohn Marino       return false;
482*e4b17023SJohn Marino   return true;
483*e4b17023SJohn Marino }
484*e4b17023SJohn Marino 
485*e4b17023SJohn Marino #endif
486*e4b17023SJohn Marino #endif
487*e4b17023SJohn Marino #endif
488*e4b17023SJohn Marino #endif
489*e4b17023SJohn Marino 
490*e4b17023SJohn Marino /* Iterator for hard register sets.  */
491*e4b17023SJohn Marino 
492*e4b17023SJohn Marino typedef struct
493*e4b17023SJohn Marino {
494*e4b17023SJohn Marino   /* Pointer to the current element.  */
495*e4b17023SJohn Marino   HARD_REG_ELT_TYPE *pelt;
496*e4b17023SJohn Marino 
497*e4b17023SJohn Marino   /* The length of the set.  */
498*e4b17023SJohn Marino   unsigned short length;
499*e4b17023SJohn Marino 
500*e4b17023SJohn Marino   /* Word within the current element.  */
501*e4b17023SJohn Marino   unsigned short word_no;
502*e4b17023SJohn Marino 
503*e4b17023SJohn Marino   /* Contents of the actually processed word.  When finding next bit
504*e4b17023SJohn Marino      it is shifted right, so that the actual bit is always the least
505*e4b17023SJohn Marino      significant bit of ACTUAL.  */
506*e4b17023SJohn Marino   HARD_REG_ELT_TYPE bits;
507*e4b17023SJohn Marino } hard_reg_set_iterator;
508*e4b17023SJohn Marino 
509*e4b17023SJohn Marino #define HARD_REG_ELT_BITS UHOST_BITS_PER_WIDE_INT
510*e4b17023SJohn Marino 
511*e4b17023SJohn Marino /* The implementation of the iterator functions is fully analogous to
512*e4b17023SJohn Marino    the bitmap iterators.  */
513*e4b17023SJohn Marino static inline void
hard_reg_set_iter_init(hard_reg_set_iterator * iter,HARD_REG_SET set,unsigned min,unsigned * regno)514*e4b17023SJohn Marino hard_reg_set_iter_init (hard_reg_set_iterator *iter, HARD_REG_SET set,
515*e4b17023SJohn Marino                         unsigned min, unsigned *regno)
516*e4b17023SJohn Marino {
517*e4b17023SJohn Marino #ifdef HARD_REG_SET_LONGS
518*e4b17023SJohn Marino   iter->pelt = set;
519*e4b17023SJohn Marino   iter->length = HARD_REG_SET_LONGS;
520*e4b17023SJohn Marino #else
521*e4b17023SJohn Marino   iter->pelt = &set;
522*e4b17023SJohn Marino   iter->length = 1;
523*e4b17023SJohn Marino #endif
524*e4b17023SJohn Marino   iter->word_no = min / HARD_REG_ELT_BITS;
525*e4b17023SJohn Marino   if (iter->word_no < iter->length)
526*e4b17023SJohn Marino     {
527*e4b17023SJohn Marino       iter->bits = iter->pelt[iter->word_no];
528*e4b17023SJohn Marino       iter->bits >>= min % HARD_REG_ELT_BITS;
529*e4b17023SJohn Marino 
530*e4b17023SJohn Marino       /* This is required for correct search of the next bit.  */
531*e4b17023SJohn Marino       min += !iter->bits;
532*e4b17023SJohn Marino     }
533*e4b17023SJohn Marino   *regno = min;
534*e4b17023SJohn Marino }
535*e4b17023SJohn Marino 
536*e4b17023SJohn Marino static inline bool
hard_reg_set_iter_set(hard_reg_set_iterator * iter,unsigned * regno)537*e4b17023SJohn Marino hard_reg_set_iter_set (hard_reg_set_iterator *iter, unsigned *regno)
538*e4b17023SJohn Marino {
539*e4b17023SJohn Marino   while (1)
540*e4b17023SJohn Marino     {
541*e4b17023SJohn Marino       /* Return false when we're advanced past the end of the set.  */
542*e4b17023SJohn Marino       if (iter->word_no >= iter->length)
543*e4b17023SJohn Marino         return false;
544*e4b17023SJohn Marino 
545*e4b17023SJohn Marino       if (iter->bits)
546*e4b17023SJohn Marino         {
547*e4b17023SJohn Marino           /* Find the correct bit and return it.  */
548*e4b17023SJohn Marino           while (!(iter->bits & 1))
549*e4b17023SJohn Marino             {
550*e4b17023SJohn Marino               iter->bits >>= 1;
551*e4b17023SJohn Marino               *regno += 1;
552*e4b17023SJohn Marino             }
553*e4b17023SJohn Marino           return (*regno < FIRST_PSEUDO_REGISTER);
554*e4b17023SJohn Marino         }
555*e4b17023SJohn Marino 
556*e4b17023SJohn Marino       /* Round to the beginning of the next word.  */
557*e4b17023SJohn Marino       *regno = (*regno + HARD_REG_ELT_BITS - 1);
558*e4b17023SJohn Marino       *regno -= *regno % HARD_REG_ELT_BITS;
559*e4b17023SJohn Marino 
560*e4b17023SJohn Marino       /* Find the next non-zero word.  */
561*e4b17023SJohn Marino       while (++iter->word_no < iter->length)
562*e4b17023SJohn Marino         {
563*e4b17023SJohn Marino           iter->bits = iter->pelt[iter->word_no];
564*e4b17023SJohn Marino           if (iter->bits)
565*e4b17023SJohn Marino             break;
566*e4b17023SJohn Marino           *regno += HARD_REG_ELT_BITS;
567*e4b17023SJohn Marino         }
568*e4b17023SJohn Marino     }
569*e4b17023SJohn Marino }
570*e4b17023SJohn Marino 
571*e4b17023SJohn Marino static inline void
hard_reg_set_iter_next(hard_reg_set_iterator * iter,unsigned * regno)572*e4b17023SJohn Marino hard_reg_set_iter_next (hard_reg_set_iterator *iter, unsigned *regno)
573*e4b17023SJohn Marino {
574*e4b17023SJohn Marino   iter->bits >>= 1;
575*e4b17023SJohn Marino   *regno += 1;
576*e4b17023SJohn Marino }
577*e4b17023SJohn Marino 
578*e4b17023SJohn Marino #define EXECUTE_IF_SET_IN_HARD_REG_SET(SET, MIN, REGNUM, ITER)          \
579*e4b17023SJohn Marino   for (hard_reg_set_iter_init (&(ITER), (SET), (MIN), &(REGNUM));       \
580*e4b17023SJohn Marino        hard_reg_set_iter_set (&(ITER), &(REGNUM));                      \
581*e4b17023SJohn Marino        hard_reg_set_iter_next (&(ITER), &(REGNUM)))
582*e4b17023SJohn Marino 
583*e4b17023SJohn Marino 
584*e4b17023SJohn Marino /* Define some standard sets of registers.  */
585*e4b17023SJohn Marino 
586*e4b17023SJohn Marino /* Indexed by hard register number, contains 1 for registers
587*e4b17023SJohn Marino    that are being used for global register decls.
588*e4b17023SJohn Marino    These must be exempt from ordinary flow analysis
589*e4b17023SJohn Marino    and are also considered fixed.  */
590*e4b17023SJohn Marino 
591*e4b17023SJohn Marino extern char global_regs[FIRST_PSEUDO_REGISTER];
592*e4b17023SJohn Marino 
593*e4b17023SJohn Marino struct target_hard_regs {
594*e4b17023SJohn Marino   /* The set of registers that actually exist on the current target.  */
595*e4b17023SJohn Marino   HARD_REG_SET x_accessible_reg_set;
596*e4b17023SJohn Marino 
597*e4b17023SJohn Marino   /* The set of registers that should be considered to be register
598*e4b17023SJohn Marino      operands.  It is a subset of x_accessible_reg_set.  */
599*e4b17023SJohn Marino   HARD_REG_SET x_operand_reg_set;
600*e4b17023SJohn Marino 
601*e4b17023SJohn Marino   /* Indexed by hard register number, contains 1 for registers
602*e4b17023SJohn Marino      that are fixed use (stack pointer, pc, frame pointer, etc.;.
603*e4b17023SJohn Marino      These are the registers that cannot be used to allocate
604*e4b17023SJohn Marino      a pseudo reg whose life does not cross calls.  */
605*e4b17023SJohn Marino   char x_fixed_regs[FIRST_PSEUDO_REGISTER];
606*e4b17023SJohn Marino 
607*e4b17023SJohn Marino   /* The same info as a HARD_REG_SET.  */
608*e4b17023SJohn Marino   HARD_REG_SET x_fixed_reg_set;
609*e4b17023SJohn Marino 
610*e4b17023SJohn Marino   /* Indexed by hard register number, contains 1 for registers
611*e4b17023SJohn Marino      that are fixed use or are clobbered by function calls.
612*e4b17023SJohn Marino      These are the registers that cannot be used to allocate
613*e4b17023SJohn Marino      a pseudo reg whose life crosses calls.  */
614*e4b17023SJohn Marino   char x_call_used_regs[FIRST_PSEUDO_REGISTER];
615*e4b17023SJohn Marino 
616*e4b17023SJohn Marino   char x_call_really_used_regs[FIRST_PSEUDO_REGISTER];
617*e4b17023SJohn Marino 
618*e4b17023SJohn Marino   /* The same info as a HARD_REG_SET.  */
619*e4b17023SJohn Marino   HARD_REG_SET x_call_used_reg_set;
620*e4b17023SJohn Marino 
621*e4b17023SJohn Marino   /* Contains registers that are fixed use -- i.e. in fixed_reg_set -- or
622*e4b17023SJohn Marino      a function value return register or TARGET_STRUCT_VALUE_RTX or
623*e4b17023SJohn Marino      STATIC_CHAIN_REGNUM.  These are the registers that cannot hold quantities
624*e4b17023SJohn Marino      across calls even if we are willing to save and restore them.  */
625*e4b17023SJohn Marino   HARD_REG_SET x_call_fixed_reg_set;
626*e4b17023SJohn Marino 
627*e4b17023SJohn Marino   /* Contains 1 for registers that are set or clobbered by calls.  */
628*e4b17023SJohn Marino   /* ??? Ideally, this would be just call_used_regs plus global_regs, but
629*e4b17023SJohn Marino      for someone's bright idea to have call_used_regs strictly include
630*e4b17023SJohn Marino      fixed_regs.  Which leaves us guessing as to the set of fixed_regs
631*e4b17023SJohn Marino      that are actually preserved.  We know for sure that those associated
632*e4b17023SJohn Marino      with the local stack frame are safe, but scant others.  */
633*e4b17023SJohn Marino   HARD_REG_SET x_regs_invalidated_by_call;
634*e4b17023SJohn Marino 
635*e4b17023SJohn Marino   /* Call used hard registers which can not be saved because there is no
636*e4b17023SJohn Marino      insn for this.  */
637*e4b17023SJohn Marino   HARD_REG_SET x_no_caller_save_reg_set;
638*e4b17023SJohn Marino 
639*e4b17023SJohn Marino   /* Table of register numbers in the order in which to try to use them.  */
640*e4b17023SJohn Marino   int x_reg_alloc_order[FIRST_PSEUDO_REGISTER];
641*e4b17023SJohn Marino 
642*e4b17023SJohn Marino   /* The inverse of reg_alloc_order.  */
643*e4b17023SJohn Marino   int x_inv_reg_alloc_order[FIRST_PSEUDO_REGISTER];
644*e4b17023SJohn Marino 
645*e4b17023SJohn Marino   /* For each reg class, a HARD_REG_SET saying which registers are in it.  */
646*e4b17023SJohn Marino   HARD_REG_SET x_reg_class_contents[N_REG_CLASSES];
647*e4b17023SJohn Marino 
648*e4b17023SJohn Marino   /* For each reg class, a boolean saying whether the class contains only
649*e4b17023SJohn Marino      fixed registers.  */
650*e4b17023SJohn Marino   bool x_class_only_fixed_regs[N_REG_CLASSES];
651*e4b17023SJohn Marino 
652*e4b17023SJohn Marino   /* For each reg class, number of regs it contains.  */
653*e4b17023SJohn Marino   unsigned int x_reg_class_size[N_REG_CLASSES];
654*e4b17023SJohn Marino 
655*e4b17023SJohn Marino   /* For each reg class, table listing all the classes contained in it.  */
656*e4b17023SJohn Marino   enum reg_class x_reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
657*e4b17023SJohn Marino 
658*e4b17023SJohn Marino   /* For each pair of reg classes,
659*e4b17023SJohn Marino      a largest reg class contained in their union.  */
660*e4b17023SJohn Marino   enum reg_class x_reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES];
661*e4b17023SJohn Marino 
662*e4b17023SJohn Marino   /* For each pair of reg classes,
663*e4b17023SJohn Marino      the smallest reg class that contains their union.  */
664*e4b17023SJohn Marino   enum reg_class x_reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES];
665*e4b17023SJohn Marino 
666*e4b17023SJohn Marino   /* Vector indexed by hardware reg giving its name.  */
667*e4b17023SJohn Marino   const char *x_reg_names[FIRST_PSEUDO_REGISTER];
668*e4b17023SJohn Marino };
669*e4b17023SJohn Marino 
670*e4b17023SJohn Marino extern struct target_hard_regs default_target_hard_regs;
671*e4b17023SJohn Marino #if SWITCHABLE_TARGET
672*e4b17023SJohn Marino extern struct target_hard_regs *this_target_hard_regs;
673*e4b17023SJohn Marino #else
674*e4b17023SJohn Marino #define this_target_hard_regs (&default_target_hard_regs)
675*e4b17023SJohn Marino #endif
676*e4b17023SJohn Marino 
677*e4b17023SJohn Marino #define accessible_reg_set \
678*e4b17023SJohn Marino   (this_target_hard_regs->x_accessible_reg_set)
679*e4b17023SJohn Marino #define operand_reg_set \
680*e4b17023SJohn Marino   (this_target_hard_regs->x_operand_reg_set)
681*e4b17023SJohn Marino #define fixed_regs \
682*e4b17023SJohn Marino   (this_target_hard_regs->x_fixed_regs)
683*e4b17023SJohn Marino #define fixed_reg_set \
684*e4b17023SJohn Marino   (this_target_hard_regs->x_fixed_reg_set)
685*e4b17023SJohn Marino #define call_used_regs \
686*e4b17023SJohn Marino   (this_target_hard_regs->x_call_used_regs)
687*e4b17023SJohn Marino #define call_really_used_regs \
688*e4b17023SJohn Marino   (this_target_hard_regs->x_call_really_used_regs)
689*e4b17023SJohn Marino #define call_used_reg_set \
690*e4b17023SJohn Marino   (this_target_hard_regs->x_call_used_reg_set)
691*e4b17023SJohn Marino #define call_fixed_reg_set \
692*e4b17023SJohn Marino   (this_target_hard_regs->x_call_fixed_reg_set)
693*e4b17023SJohn Marino #define regs_invalidated_by_call \
694*e4b17023SJohn Marino   (this_target_hard_regs->x_regs_invalidated_by_call)
695*e4b17023SJohn Marino #define no_caller_save_reg_set \
696*e4b17023SJohn Marino   (this_target_hard_regs->x_no_caller_save_reg_set)
697*e4b17023SJohn Marino #define reg_alloc_order \
698*e4b17023SJohn Marino   (this_target_hard_regs->x_reg_alloc_order)
699*e4b17023SJohn Marino #define inv_reg_alloc_order \
700*e4b17023SJohn Marino   (this_target_hard_regs->x_inv_reg_alloc_order)
701*e4b17023SJohn Marino #define reg_class_contents \
702*e4b17023SJohn Marino   (this_target_hard_regs->x_reg_class_contents)
703*e4b17023SJohn Marino #define class_only_fixed_regs \
704*e4b17023SJohn Marino   (this_target_hard_regs->x_class_only_fixed_regs)
705*e4b17023SJohn Marino #define reg_class_size \
706*e4b17023SJohn Marino   (this_target_hard_regs->x_reg_class_size)
707*e4b17023SJohn Marino #define reg_class_subclasses \
708*e4b17023SJohn Marino   (this_target_hard_regs->x_reg_class_subclasses)
709*e4b17023SJohn Marino #define reg_class_subunion \
710*e4b17023SJohn Marino   (this_target_hard_regs->x_reg_class_subunion)
711*e4b17023SJohn Marino #define reg_class_superunion \
712*e4b17023SJohn Marino   (this_target_hard_regs->x_reg_class_superunion)
713*e4b17023SJohn Marino #define reg_names \
714*e4b17023SJohn Marino   (this_target_hard_regs->x_reg_names)
715*e4b17023SJohn Marino 
716*e4b17023SJohn Marino /* Vector indexed by reg class giving its name.  */
717*e4b17023SJohn Marino 
718*e4b17023SJohn Marino extern const char * reg_class_names[];
719*e4b17023SJohn Marino 
720*e4b17023SJohn Marino /* Given a hard REGN a FROM mode and a TO mode, return nonzero if
721*e4b17023SJohn Marino    REGN cannot change modes between the specified modes.  */
722*e4b17023SJohn Marino #define REG_CANNOT_CHANGE_MODE_P(REGN, FROM, TO)                          \
723*e4b17023SJohn Marino          CANNOT_CHANGE_MODE_CLASS (FROM, TO, REGNO_REG_CLASS (REGN))
724*e4b17023SJohn Marino 
725*e4b17023SJohn Marino #endif /* ! GCC_HARD_REG_SET_H */
726