20 #ifndef GCC_HARD_REG_SET_H
21 #define GCC_HARD_REG_SET_H
43 #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDEST_FAST_INT
45 #define HARD_REG_SET HARD_REG_ELT_TYPE
49 #define HARD_REG_SET_LONGS \
50 ((FIRST_PSEUDO_REGISTER + HOST_BITS_PER_WIDEST_FAST_INT - 1) \
51 / HOST_BITS_PER_WIDEST_FAST_INT)
67 #define HARD_CONST(X) ((HARD_REG_ELT_TYPE) (X))
99 #define UHOST_BITS_PER_WIDE_INT ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT)
103 #define SET_HARD_REG_BIT(SET, BIT) \
104 ((SET) |= HARD_CONST (1) << (BIT))
105 #define CLEAR_HARD_REG_BIT(SET, BIT) \
106 ((SET) &= ~(HARD_CONST (1) << (BIT)))
107 #define TEST_HARD_REG_BIT(SET, BIT) \
108 (!!((SET) & (HARD_CONST (1) << (BIT))))
110 #define CLEAR_HARD_REG_SET(TO) ((TO) = HARD_CONST (0))
111 #define SET_HARD_REG_SET(TO) ((TO) = ~ HARD_CONST (0))
113 #define COPY_HARD_REG_SET(TO, FROM) ((TO) = (FROM))
114 #define COMPL_HARD_REG_SET(TO, FROM) ((TO) = ~(FROM))
116 #define IOR_HARD_REG_SET(TO, FROM) ((TO) |= (FROM))
117 #define IOR_COMPL_HARD_REG_SET(TO, FROM) ((TO) |= ~ (FROM))
118 #define AND_HARD_REG_SET(TO, FROM) ((TO) &= (FROM))
119 #define AND_COMPL_HARD_REG_SET(TO, FROM) ((TO) &= ~ (FROM))
124 return (x & ~y) == HARD_CONST (0);
136 return (x & y) != HARD_CONST (0);
142 return x == HARD_CONST (0);
147 #define SET_HARD_REG_BIT(SET, BIT) \
148 ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
149 |= HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))
151 #define CLEAR_HARD_REG_BIT(SET, BIT) \
152 ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
153 &= ~(HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)))
155 #define TEST_HARD_REG_BIT(SET, BIT) \
156 (!!((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
157 & (HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))))
159 #if FIRST_PSEUDO_REGISTER <= 2*HOST_BITS_PER_WIDEST_FAST_INT
160 #define CLEAR_HARD_REG_SET(TO) \
161 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
163 scan_tp_[1] = 0; } while (0)
165 #define SET_HARD_REG_SET(TO) \
166 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
168 scan_tp_[1] = -1; } while (0)
170 #define COPY_HARD_REG_SET(TO, FROM) \
171 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
172 scan_tp_[0] = scan_fp_[0]; \
173 scan_tp_[1] = scan_fp_[1]; } while (0)
175 #define COMPL_HARD_REG_SET(TO, FROM) \
176 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
177 scan_tp_[0] = ~ scan_fp_[0]; \
178 scan_tp_[1] = ~ scan_fp_[1]; } while (0)
180 #define AND_HARD_REG_SET(TO, FROM) \
181 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
182 scan_tp_[0] &= scan_fp_[0]; \
183 scan_tp_[1] &= scan_fp_[1]; } while (0)
185 #define AND_COMPL_HARD_REG_SET(TO, FROM) \
186 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
187 scan_tp_[0] &= ~ scan_fp_[0]; \
188 scan_tp_[1] &= ~ scan_fp_[1]; } while (0)
190 #define IOR_HARD_REG_SET(TO, FROM) \
191 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
192 scan_tp_[0] |= scan_fp_[0]; \
193 scan_tp_[1] |= scan_fp_[1]; } while (0)
195 #define IOR_COMPL_HARD_REG_SET(TO, FROM) \
196 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
197 scan_tp_[0] |= ~ scan_fp_[0]; \
198 scan_tp_[1] |= ~ scan_fp_[1]; } while (0)
203 return (x[0] & ~y[0]) == 0 && (x[1] & ~y[1]) == 0;
209 return x[0] == y[0] && x[1] == y[1];
215 return (x[0] & y[0]) != 0 || (x[1] & y[1]) != 0;
221 return x[0] == 0 && x[1] == 0;
225 #if FIRST_PSEUDO_REGISTER <= 3*HOST_BITS_PER_WIDEST_FAST_INT
226 #define CLEAR_HARD_REG_SET(TO) \
227 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
230 scan_tp_[2] = 0; } while (0)
232 #define SET_HARD_REG_SET(TO) \
233 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
236 scan_tp_[2] = -1; } while (0)
238 #define COPY_HARD_REG_SET(TO, FROM) \
239 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
240 scan_tp_[0] = scan_fp_[0]; \
241 scan_tp_[1] = scan_fp_[1]; \
242 scan_tp_[2] = scan_fp_[2]; } while (0)
244 #define COMPL_HARD_REG_SET(TO, FROM) \
245 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
246 scan_tp_[0] = ~ scan_fp_[0]; \
247 scan_tp_[1] = ~ scan_fp_[1]; \
248 scan_tp_[2] = ~ scan_fp_[2]; } while (0)
250 #define AND_HARD_REG_SET(TO, FROM) \
251 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
252 scan_tp_[0] &= scan_fp_[0]; \
253 scan_tp_[1] &= scan_fp_[1]; \
254 scan_tp_[2] &= scan_fp_[2]; } while (0)
256 #define AND_COMPL_HARD_REG_SET(TO, FROM) \
257 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
258 scan_tp_[0] &= ~ scan_fp_[0]; \
259 scan_tp_[1] &= ~ scan_fp_[1]; \
260 scan_tp_[2] &= ~ scan_fp_[2]; } while (0)
262 #define IOR_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]; } while (0)
268 #define IOR_COMPL_HARD_REG_SET(TO, FROM) \
269 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
270 scan_tp_[0] |= ~ scan_fp_[0]; \
271 scan_tp_[1] |= ~ scan_fp_[1]; \
272 scan_tp_[2] |= ~ scan_fp_[2]; } while (0)
277 return ((x[0] & ~y[0]) == 0
278 && (x[1] & ~y[1]) == 0
279 && (x[2] & ~y[2]) == 0);
285 return x[0] == y[0] && x[1] == y[1] && x[2] == y[2];
291 return ((x[0] & y[0]) != 0
292 || (x[1] & y[1]) != 0
293 || (x[2] & y[2]) != 0);
299 return x[0] == 0 && x[1] == 0 && x[2] == 0;
303 #if FIRST_PSEUDO_REGISTER <= 4*HOST_BITS_PER_WIDEST_FAST_INT
304 #define CLEAR_HARD_REG_SET(TO) \
305 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
309 scan_tp_[3] = 0; } while (0)
311 #define SET_HARD_REG_SET(TO) \
312 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
316 scan_tp_[3] = -1; } while (0)
318 #define COPY_HARD_REG_SET(TO, FROM) \
319 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
320 scan_tp_[0] = scan_fp_[0]; \
321 scan_tp_[1] = scan_fp_[1]; \
322 scan_tp_[2] = scan_fp_[2]; \
323 scan_tp_[3] = scan_fp_[3]; } while (0)
325 #define COMPL_HARD_REG_SET(TO, FROM) \
326 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
327 scan_tp_[0] = ~ scan_fp_[0]; \
328 scan_tp_[1] = ~ scan_fp_[1]; \
329 scan_tp_[2] = ~ scan_fp_[2]; \
330 scan_tp_[3] = ~ scan_fp_[3]; } while (0)
332 #define AND_HARD_REG_SET(TO, FROM) \
333 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
334 scan_tp_[0] &= scan_fp_[0]; \
335 scan_tp_[1] &= scan_fp_[1]; \
336 scan_tp_[2] &= scan_fp_[2]; \
337 scan_tp_[3] &= scan_fp_[3]; } while (0)
339 #define AND_COMPL_HARD_REG_SET(TO, FROM) \
340 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
341 scan_tp_[0] &= ~ scan_fp_[0]; \
342 scan_tp_[1] &= ~ scan_fp_[1]; \
343 scan_tp_[2] &= ~ scan_fp_[2]; \
344 scan_tp_[3] &= ~ scan_fp_[3]; } while (0)
346 #define IOR_HARD_REG_SET(TO, FROM) \
347 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
348 scan_tp_[0] |= scan_fp_[0]; \
349 scan_tp_[1] |= scan_fp_[1]; \
350 scan_tp_[2] |= scan_fp_[2]; \
351 scan_tp_[3] |= scan_fp_[3]; } while (0)
353 #define IOR_COMPL_HARD_REG_SET(TO, FROM) \
354 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
355 scan_tp_[0] |= ~ scan_fp_[0]; \
356 scan_tp_[1] |= ~ scan_fp_[1]; \
357 scan_tp_[2] |= ~ scan_fp_[2]; \
358 scan_tp_[3] |= ~ scan_fp_[3]; } while (0)
363 return ((x[0] & ~y[0]) == 0
364 && (x[1] & ~y[1]) == 0
365 && (x[2] & ~y[2]) == 0
366 && (x[3] & ~y[3]) == 0);
372 return x[0] == y[0] && x[1] == y[1] && x[2] == y[2] && x[3] == y[3];
378 return ((x[0] & y[0]) != 0
379 || (x[1] & y[1]) != 0
380 || (x[2] & y[2]) != 0
381 || (x[3] & y[3]) != 0);
387 return x[0] == 0 && x[1] == 0 && x[2] == 0 && x[3] == 0;
392 #define CLEAR_HARD_REG_SET(TO) \
393 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
395 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
396 *scan_tp_++ = 0; } while (0)
398 #define SET_HARD_REG_SET(TO) \
399 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
401 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
402 *scan_tp_++ = -1; } while (0)
404 #define COPY_HARD_REG_SET(TO, FROM) \
405 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
407 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
408 *scan_tp_++ = *scan_fp_++; } while (0)
410 #define COMPL_HARD_REG_SET(TO, FROM) \
411 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
413 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
414 *scan_tp_++ = ~ *scan_fp_++; } while (0)
416 #define AND_HARD_REG_SET(TO, FROM) \
417 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
419 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
420 *scan_tp_++ &= *scan_fp_++; } while (0)
422 #define AND_COMPL_HARD_REG_SET(TO, FROM) \
423 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
425 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
426 *scan_tp_++ &= ~ *scan_fp_++; } while (0)
428 #define IOR_HARD_REG_SET(TO, FROM) \
429 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
431 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
432 *scan_tp_++ |= *scan_fp_++; } while (0)
434 #define IOR_COMPL_HARD_REG_SET(TO, FROM) \
435 do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
437 for (i = 0; i < HARD_REG_SET_LONGS; i++) \
438 *scan_tp_++ |= ~ *scan_fp_++; } while (0)
445 for (i = 0; i < HARD_REG_SET_LONGS; i++)
446 if ((x[i] & ~y[i]) != 0)
456 for (i = 0; i < HARD_REG_SET_LONGS; i++)
467 for (i = 0; i < HARD_REG_SET_LONGS; i++)
468 if ((x[i] & y[i]) != 0)
478 for (i = 0; i < HARD_REG_SET_LONGS; i++)
508 #define HARD_REG_ELT_BITS UHOST_BITS_PER_WIDE_INT
514 unsigned min,
unsigned *regno)
516 #ifdef HARD_REG_SET_LONGS
518 iter->
length = HARD_REG_SET_LONGS;
523 iter->
word_no = min / HARD_REG_ELT_BITS;
527 iter->
bits >>= min % HARD_REG_ELT_BITS;
547 while (!(iter->
bits & 1))
552 return (*regno < FIRST_PSEUDO_REGISTER);
556 *regno = (*regno + HARD_REG_ELT_BITS - 1);
557 *regno -= *regno % HARD_REG_ELT_BITS;
565 *regno += HARD_REG_ELT_BITS;
577 #define EXECUTE_IF_SET_IN_HARD_REG_SET(SET, MIN, REGNUM, ITER) \
578 for (hard_reg_set_iter_init (&(ITER), (SET), (MIN), &(REGNUM)); \
579 hard_reg_set_iter_set (&(ITER), &(REGNUM)); \
580 hard_reg_set_iter_next (&(ITER), &(REGNUM)))
670 #if SWITCHABLE_TARGET
673 #define this_target_hard_regs (&default_target_hard_regs)
676 #define accessible_reg_set \
677 (this_target_hard_regs->x_accessible_reg_set)
678 #define operand_reg_set \
679 (this_target_hard_regs->x_operand_reg_set)
681 (this_target_hard_regs->x_fixed_regs)
682 #define fixed_reg_set \
683 (this_target_hard_regs->x_fixed_reg_set)
684 #define call_used_regs \
685 (this_target_hard_regs->x_call_used_regs)
686 #define call_really_used_regs \
687 (this_target_hard_regs->x_call_really_used_regs)
688 #define call_used_reg_set \
689 (this_target_hard_regs->x_call_used_reg_set)
690 #define call_fixed_reg_set \
691 (this_target_hard_regs->x_call_fixed_reg_set)
692 #define regs_invalidated_by_call \
693 (this_target_hard_regs->x_regs_invalidated_by_call)
694 #define no_caller_save_reg_set \
695 (this_target_hard_regs->x_no_caller_save_reg_set)
696 #define reg_alloc_order \
697 (this_target_hard_regs->x_reg_alloc_order)
698 #define inv_reg_alloc_order \
699 (this_target_hard_regs->x_inv_reg_alloc_order)
700 #define reg_class_contents \
701 (this_target_hard_regs->x_reg_class_contents)
702 #define class_only_fixed_regs \
703 (this_target_hard_regs->x_class_only_fixed_regs)
704 #define reg_class_size \
705 (this_target_hard_regs->x_reg_class_size)
706 #define reg_class_subclasses \
707 (this_target_hard_regs->x_reg_class_subclasses)
708 #define reg_class_subunion \
709 (this_target_hard_regs->x_reg_class_subunion)
710 #define reg_class_superunion \
711 (this_target_hard_regs->x_reg_class_superunion)
713 (this_target_hard_regs->x_reg_names)
721 #define REG_CANNOT_CHANGE_MODE_P(REGN, FROM, TO) \
722 CANNOT_CHANGE_MODE_CLASS (FROM, TO, REGNO_REG_CLASS (REGN))