[6/77] Make GET_MODE_WIDER return an opt_mode
[official-gcc.git] / gcc / machmode.h
blob3b06f6d2c3ccf1d220a59bfe49e7ea15676c42be
1 /* Machine mode definitions for GCC; included by rtl.h and tree.h.
2 Copyright (C) 1991-2017 Free Software Foundation, Inc.
4 This file is part of GCC.
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.
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.
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/>. */
20 #ifndef HAVE_MACHINE_MODES
21 #define HAVE_MACHINE_MODES
23 extern CONST_MODE_SIZE unsigned short mode_size[NUM_MACHINE_MODES];
24 extern const unsigned short mode_precision[NUM_MACHINE_MODES];
25 extern const unsigned char mode_inner[NUM_MACHINE_MODES];
26 extern const unsigned char mode_nunits[NUM_MACHINE_MODES];
27 extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];
28 extern const unsigned short mode_unit_precision[NUM_MACHINE_MODES];
29 extern const unsigned char mode_wider[NUM_MACHINE_MODES];
30 extern const unsigned char mode_2xwider[NUM_MACHINE_MODES];
32 template<typename T>
33 struct mode_traits
35 /* For use by the machmode support code only.
37 There are cases in which the machmode support code needs to forcibly
38 convert a machine_mode to a specific mode class T, and in which the
39 context guarantees that this is valid without the need for an assert.
40 This can be done using:
42 return typename mode_traits<T>::from_int (mode);
44 when returning a T and:
46 res = T (typename mode_traits<T>::from_int (mode));
48 when assigning to a value RES that must be assignment-compatible
49 with (but possibly not the same as) T.
51 Here we use an enum type distinct from machine_mode but with the
52 same range as machine_mode. T should have a constructor that
53 accepts this enum type; it should not have a constructor that
54 accepts machine_mode.
56 We use this somewhat indirect approach to avoid too many constructor
57 calls when the compiler is built with -O0. For example, even in
58 unoptimized code, the return statement above would construct the
59 returned T directly from the numerical value of MODE. */
60 enum from_int { dummy = MAX_MACHINE_MODE };
63 template<>
64 struct mode_traits<machine_mode>
66 /* machine_mode itself needs no conversion. */
67 typedef machine_mode from_int;
70 /* Get the name of mode MODE as a string. */
72 extern const char * const mode_name[NUM_MACHINE_MODES];
73 #define GET_MODE_NAME(MODE) mode_name[MODE]
75 /* Mode classes. */
77 #include "mode-classes.def"
78 #define DEF_MODE_CLASS(M) M
79 enum mode_class { MODE_CLASSES, MAX_MODE_CLASS };
80 #undef DEF_MODE_CLASS
81 #undef MODE_CLASSES
83 /* Get the general kind of object that mode MODE represents
84 (integer, floating, complex, etc.) */
86 extern const unsigned char mode_class[NUM_MACHINE_MODES];
87 #define GET_MODE_CLASS(MODE) ((enum mode_class) mode_class[MODE])
89 /* Nonzero if MODE is an integral mode. */
90 #define INTEGRAL_MODE_P(MODE) \
91 (GET_MODE_CLASS (MODE) == MODE_INT \
92 || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT \
93 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \
94 || GET_MODE_CLASS (MODE) == MODE_VECTOR_INT)
96 /* Nonzero if MODE is a floating-point mode. */
97 #define FLOAT_MODE_P(MODE) \
98 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
99 || GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT \
100 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \
101 || GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT)
103 /* Nonzero if MODE is a complex mode. */
104 #define COMPLEX_MODE_P(MODE) \
105 (GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \
106 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
108 /* Nonzero if MODE is a vector mode. */
109 #define VECTOR_MODE_P(MODE) \
110 (GET_MODE_CLASS (MODE) == MODE_VECTOR_INT \
111 || GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT \
112 || GET_MODE_CLASS (MODE) == MODE_VECTOR_FRACT \
113 || GET_MODE_CLASS (MODE) == MODE_VECTOR_UFRACT \
114 || GET_MODE_CLASS (MODE) == MODE_VECTOR_ACCUM \
115 || GET_MODE_CLASS (MODE) == MODE_VECTOR_UACCUM)
117 /* Nonzero if MODE is a scalar integral mode. */
118 #define SCALAR_INT_MODE_P(MODE) \
119 (GET_MODE_CLASS (MODE) == MODE_INT \
120 || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT)
122 /* Nonzero if MODE is a scalar floating point mode. */
123 #define SCALAR_FLOAT_MODE_P(MODE) \
124 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
125 || GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT)
127 /* Nonzero if MODE is a decimal floating point mode. */
128 #define DECIMAL_FLOAT_MODE_P(MODE) \
129 (GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT)
131 /* Nonzero if MODE is a scalar fract mode. */
132 #define SCALAR_FRACT_MODE_P(MODE) \
133 (GET_MODE_CLASS (MODE) == MODE_FRACT)
135 /* Nonzero if MODE is a scalar ufract mode. */
136 #define SCALAR_UFRACT_MODE_P(MODE) \
137 (GET_MODE_CLASS (MODE) == MODE_UFRACT)
139 /* Nonzero if MODE is a scalar fract or ufract mode. */
140 #define ALL_SCALAR_FRACT_MODE_P(MODE) \
141 (SCALAR_FRACT_MODE_P (MODE) || SCALAR_UFRACT_MODE_P (MODE))
143 /* Nonzero if MODE is a scalar accum mode. */
144 #define SCALAR_ACCUM_MODE_P(MODE) \
145 (GET_MODE_CLASS (MODE) == MODE_ACCUM)
147 /* Nonzero if MODE is a scalar uaccum mode. */
148 #define SCALAR_UACCUM_MODE_P(MODE) \
149 (GET_MODE_CLASS (MODE) == MODE_UACCUM)
151 /* Nonzero if MODE is a scalar accum or uaccum mode. */
152 #define ALL_SCALAR_ACCUM_MODE_P(MODE) \
153 (SCALAR_ACCUM_MODE_P (MODE) || SCALAR_UACCUM_MODE_P (MODE))
155 /* Nonzero if MODE is a scalar fract or accum mode. */
156 #define SIGNED_SCALAR_FIXED_POINT_MODE_P(MODE) \
157 (SCALAR_FRACT_MODE_P (MODE) || SCALAR_ACCUM_MODE_P (MODE))
159 /* Nonzero if MODE is a scalar ufract or uaccum mode. */
160 #define UNSIGNED_SCALAR_FIXED_POINT_MODE_P(MODE) \
161 (SCALAR_UFRACT_MODE_P (MODE) || SCALAR_UACCUM_MODE_P (MODE))
163 /* Nonzero if MODE is a scalar fract, ufract, accum or uaccum mode. */
164 #define ALL_SCALAR_FIXED_POINT_MODE_P(MODE) \
165 (SIGNED_SCALAR_FIXED_POINT_MODE_P (MODE) \
166 || UNSIGNED_SCALAR_FIXED_POINT_MODE_P (MODE))
168 /* Nonzero if MODE is a scalar/vector fract mode. */
169 #define FRACT_MODE_P(MODE) \
170 (GET_MODE_CLASS (MODE) == MODE_FRACT \
171 || GET_MODE_CLASS (MODE) == MODE_VECTOR_FRACT)
173 /* Nonzero if MODE is a scalar/vector ufract mode. */
174 #define UFRACT_MODE_P(MODE) \
175 (GET_MODE_CLASS (MODE) == MODE_UFRACT \
176 || GET_MODE_CLASS (MODE) == MODE_VECTOR_UFRACT)
178 /* Nonzero if MODE is a scalar/vector fract or ufract mode. */
179 #define ALL_FRACT_MODE_P(MODE) \
180 (FRACT_MODE_P (MODE) || UFRACT_MODE_P (MODE))
182 /* Nonzero if MODE is a scalar/vector accum mode. */
183 #define ACCUM_MODE_P(MODE) \
184 (GET_MODE_CLASS (MODE) == MODE_ACCUM \
185 || GET_MODE_CLASS (MODE) == MODE_VECTOR_ACCUM)
187 /* Nonzero if MODE is a scalar/vector uaccum mode. */
188 #define UACCUM_MODE_P(MODE) \
189 (GET_MODE_CLASS (MODE) == MODE_UACCUM \
190 || GET_MODE_CLASS (MODE) == MODE_VECTOR_UACCUM)
192 /* Nonzero if MODE is a scalar/vector accum or uaccum mode. */
193 #define ALL_ACCUM_MODE_P(MODE) \
194 (ACCUM_MODE_P (MODE) || UACCUM_MODE_P (MODE))
196 /* Nonzero if MODE is a scalar/vector fract or accum mode. */
197 #define SIGNED_FIXED_POINT_MODE_P(MODE) \
198 (FRACT_MODE_P (MODE) || ACCUM_MODE_P (MODE))
200 /* Nonzero if MODE is a scalar/vector ufract or uaccum mode. */
201 #define UNSIGNED_FIXED_POINT_MODE_P(MODE) \
202 (UFRACT_MODE_P (MODE) || UACCUM_MODE_P (MODE))
204 /* Nonzero if MODE is a scalar/vector fract, ufract, accum or uaccum mode. */
205 #define ALL_FIXED_POINT_MODE_P(MODE) \
206 (SIGNED_FIXED_POINT_MODE_P (MODE) \
207 || UNSIGNED_FIXED_POINT_MODE_P (MODE))
209 /* Nonzero if CLASS modes can be widened. */
210 #define CLASS_HAS_WIDER_MODES_P(CLASS) \
211 (CLASS == MODE_INT \
212 || CLASS == MODE_PARTIAL_INT \
213 || CLASS == MODE_FLOAT \
214 || CLASS == MODE_DECIMAL_FLOAT \
215 || CLASS == MODE_COMPLEX_FLOAT \
216 || CLASS == MODE_FRACT \
217 || CLASS == MODE_UFRACT \
218 || CLASS == MODE_ACCUM \
219 || CLASS == MODE_UACCUM)
221 #define POINTER_BOUNDS_MODE_P(MODE) \
222 (GET_MODE_CLASS (MODE) == MODE_POINTER_BOUNDS)
224 /* An optional T (i.e. a T or nothing), where T is some form of mode class. */
225 template<typename T>
226 class opt_mode
228 public:
229 enum from_int { dummy = MAX_MACHINE_MODE };
231 ALWAYS_INLINE opt_mode () : m_mode (E_VOIDmode) {}
232 ALWAYS_INLINE opt_mode (const T &m) : m_mode (m) {}
233 ALWAYS_INLINE opt_mode (from_int m) : m_mode (machine_mode (m)) {}
235 machine_mode else_void () const;
236 T require () const;
238 bool exists () const;
239 template<typename U> bool exists (U *) const;
241 private:
242 machine_mode m_mode;
245 /* If the object contains a T, return its enum value, otherwise return
246 E_VOIDmode. */
248 template<typename T>
249 ALWAYS_INLINE machine_mode
250 opt_mode<T>::else_void () const
252 return m_mode;
255 /* Assert that the object contains a T and return it. */
257 template<typename T>
258 inline T
259 opt_mode<T>::require () const
261 gcc_checking_assert (m_mode != E_VOIDmode);
262 return typename mode_traits<T>::from_int (m_mode);
265 /* Return true if the object contains a T rather than nothing. */
267 template<typename T>
268 ALWAYS_INLINE bool
269 opt_mode<T>::exists () const
271 return m_mode != E_VOIDmode;
274 /* Return true if the object contains a T, storing it in *MODE if so. */
276 template<typename T>
277 template<typename U>
278 inline bool
279 opt_mode<T>::exists (U *mode) const
281 if (m_mode != E_VOIDmode)
283 *mode = T (typename mode_traits<T>::from_int (m_mode));
284 return true;
286 return false;
289 /* Return the base GET_MODE_SIZE value for MODE. */
291 ALWAYS_INLINE unsigned short
292 mode_to_bytes (machine_mode mode)
294 #if GCC_VERSION >= 4001
295 return (__builtin_constant_p (mode)
296 ? mode_size_inline (mode) : mode_size[mode]);
297 #else
298 return mode_size[mode];
299 #endif
302 /* Return the base GET_MODE_BITSIZE value for MODE. */
304 ALWAYS_INLINE unsigned short
305 mode_to_bits (machine_mode mode)
307 return mode_to_bytes (mode) * BITS_PER_UNIT;
310 /* Return the base GET_MODE_PRECISION value for MODE. */
312 ALWAYS_INLINE unsigned short
313 mode_to_precision (machine_mode mode)
315 return mode_precision[mode];
318 /* Return the base GET_MODE_INNER value for MODE. */
320 ALWAYS_INLINE machine_mode
321 mode_to_inner (machine_mode mode)
323 #if GCC_VERSION >= 4001
324 return (machine_mode) (__builtin_constant_p (mode)
325 ? mode_inner_inline (mode) : mode_inner[mode]);
326 #else
327 return (machine_mode) mode_inner[mode];
328 #endif
331 /* Return the base GET_MODE_UNIT_SIZE value for MODE. */
333 ALWAYS_INLINE unsigned char
334 mode_to_unit_size (machine_mode mode)
336 #if GCC_VERSION >= 4001
337 return (__builtin_constant_p (mode)
338 ? mode_unit_size_inline (mode) : mode_unit_size[mode]);
339 #else
340 return mode_unit_size[mode];
341 #endif
344 /* Return the base GET_MODE_UNIT_PRECISION value for MODE. */
346 ALWAYS_INLINE unsigned short
347 mode_to_unit_precision (machine_mode mode)
349 #if GCC_VERSION >= 4001
350 return (__builtin_constant_p (mode)
351 ? mode_unit_precision_inline (mode) : mode_unit_precision[mode]);
352 #else
353 return mode_unit_precision[mode];
354 #endif
357 /* Return the base GET_MODE_NUNITS value for MODE. */
359 ALWAYS_INLINE unsigned short
360 mode_to_nunits (machine_mode mode)
362 #if GCC_VERSION >= 4001
363 return (__builtin_constant_p (mode)
364 ? mode_nunits_inline (mode) : mode_nunits[mode]);
365 #else
366 return mode_nunits[mode];
367 #endif
370 /* Get the size in bytes of an object of mode MODE. */
372 #define GET_MODE_SIZE(MODE) (mode_to_bytes (MODE))
374 /* Get the size in bits of an object of mode MODE. */
376 #define GET_MODE_BITSIZE(MODE) (mode_to_bits (MODE))
378 /* Get the number of value bits of an object of mode MODE. */
380 #define GET_MODE_PRECISION(MODE) (mode_to_precision (MODE))
382 /* Get the number of integral bits of an object of mode MODE. */
383 extern CONST_MODE_IBIT unsigned char mode_ibit[NUM_MACHINE_MODES];
384 #define GET_MODE_IBIT(MODE) mode_ibit[MODE]
386 /* Get the number of fractional bits of an object of mode MODE. */
387 extern CONST_MODE_FBIT unsigned char mode_fbit[NUM_MACHINE_MODES];
388 #define GET_MODE_FBIT(MODE) mode_fbit[MODE]
390 /* Get a bitmask containing 1 for all bits in a word
391 that fit within mode MODE. */
393 extern const unsigned HOST_WIDE_INT mode_mask_array[NUM_MACHINE_MODES];
395 #define GET_MODE_MASK(MODE) mode_mask_array[MODE]
397 /* Return the mode of the basic parts of MODE. For vector modes this is the
398 mode of the vector elements. For complex modes it is the mode of the real
399 and imaginary parts. For other modes it is MODE itself. */
401 #define GET_MODE_INNER(MODE) (mode_to_inner (MODE))
403 /* Get the size in bytes or bits of the basic parts of an
404 object of mode MODE. */
406 #define GET_MODE_UNIT_SIZE(MODE) mode_to_unit_size (MODE)
408 #define GET_MODE_UNIT_BITSIZE(MODE) \
409 ((unsigned short) (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT))
411 #define GET_MODE_UNIT_PRECISION(MODE) (mode_to_unit_precision (MODE))
413 /* Get the number of units in an object of mode MODE. This is 2 for
414 complex modes and the number of elements for vector modes. */
416 #define GET_MODE_NUNITS(MODE) (mode_to_nunits (MODE))
418 /* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */
420 template<typename T>
421 ALWAYS_INLINE opt_mode<T>
422 GET_MODE_WIDER_MODE (const T &m)
424 return typename opt_mode<T>::from_int (mode_wider[m]);
427 /* For scalars, this is a mode with twice the precision. For vectors,
428 this is a mode with the same inner mode but with twice the elements. */
430 template<typename T>
431 ALWAYS_INLINE opt_mode<T>
432 GET_MODE_2XWIDER_MODE (const T &m)
434 return typename opt_mode<T>::from_int (mode_2xwider[m]);
437 /* Get the complex mode from the component mode. */
438 extern const unsigned char mode_complex[NUM_MACHINE_MODES];
439 #define GET_MODE_COMPLEX_MODE(MODE) ((machine_mode) mode_complex[MODE])
441 /* Return the mode for data of a given size SIZE and mode class CLASS.
442 If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE.
443 The value is BLKmode if no other mode is found. */
445 extern machine_mode mode_for_size (unsigned int, enum mode_class, int);
447 /* Similar, but find the smallest mode for a given width. */
449 extern machine_mode smallest_mode_for_size (unsigned int,
450 enum mode_class);
453 /* Return an integer mode of the exact same size as the input mode,
454 or BLKmode on failure. */
456 extern machine_mode int_mode_for_mode (machine_mode);
458 extern machine_mode bitwise_mode_for_mode (machine_mode);
460 /* Return a mode that is suitable for representing a vector,
461 or BLKmode on failure. */
463 extern machine_mode mode_for_vector (machine_mode, unsigned);
465 /* A class for iterating through possible bitfield modes. */
466 class bit_field_mode_iterator
468 public:
469 bit_field_mode_iterator (HOST_WIDE_INT, HOST_WIDE_INT,
470 HOST_WIDE_INT, HOST_WIDE_INT,
471 unsigned int, bool);
472 bool next_mode (machine_mode *);
473 bool prefer_smaller_modes ();
475 private:
476 machine_mode m_mode;
477 /* We use signed values here because the bit position can be negative
478 for invalid input such as gcc.dg/pr48335-8.c. */
479 HOST_WIDE_INT m_bitsize;
480 HOST_WIDE_INT m_bitpos;
481 HOST_WIDE_INT m_bitregion_start;
482 HOST_WIDE_INT m_bitregion_end;
483 unsigned int m_align;
484 bool m_volatilep;
485 int m_count;
488 /* Find the best mode to use to access a bit field. */
490 extern machine_mode get_best_mode (int, int,
491 unsigned HOST_WIDE_INT,
492 unsigned HOST_WIDE_INT,
493 unsigned int,
494 machine_mode, bool);
496 /* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT. */
498 extern CONST_MODE_BASE_ALIGN unsigned short mode_base_align[NUM_MACHINE_MODES];
500 extern unsigned get_mode_alignment (machine_mode);
502 #define GET_MODE_ALIGNMENT(MODE) get_mode_alignment (MODE)
504 /* For each class, get the narrowest mode in that class. */
506 extern const unsigned char class_narrowest_mode[MAX_MODE_CLASS];
507 #define GET_CLASS_NARROWEST_MODE(CLASS) \
508 ((machine_mode) class_narrowest_mode[CLASS])
510 /* Return the narrowest mode in T's class. */
512 template<typename T>
513 inline T
514 get_narrowest_mode (T mode)
516 return typename mode_traits<T>::from_int
517 (class_narrowest_mode[GET_MODE_CLASS (mode)]);
520 /* Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD
521 and the mode whose class is Pmode and whose size is POINTER_SIZE. */
523 extern machine_mode byte_mode;
524 extern machine_mode word_mode;
525 extern machine_mode ptr_mode;
527 /* Target-dependent machine mode initialization - in insn-modes.c. */
528 extern void init_adjust_machine_modes (void);
530 #define TRULY_NOOP_TRUNCATION_MODES_P(MODE1, MODE2) \
531 TRULY_NOOP_TRUNCATION (GET_MODE_PRECISION (MODE1), \
532 GET_MODE_PRECISION (MODE2))
534 #define HWI_COMPUTABLE_MODE_P(MODE) \
535 (SCALAR_INT_MODE_P (MODE) \
536 && GET_MODE_PRECISION (MODE) <= HOST_BITS_PER_WIDE_INT)
538 struct int_n_data_t {
539 /* These parts are initailized by genmodes output */
540 unsigned int bitsize;
541 machine_mode m;
542 /* RID_* is RID_INTN_BASE + index into this array */
545 /* This is also in tree.h. genmodes.c guarantees the're sorted from
546 smallest bitsize to largest bitsize. */
547 extern bool int_n_enabled_p[NUM_INT_N_ENTS];
548 extern const int_n_data_t int_n_data[NUM_INT_N_ENTS];
550 namespace mode_iterator
552 /* Start mode iterator *ITER at the first mode in class MCLASS, if any. */
554 inline void
555 start (machine_mode *iter, enum mode_class mclass)
557 *iter = GET_CLASS_NARROWEST_MODE (mclass);
560 /* Return true if mode iterator *ITER has not reached the end. */
562 inline bool
563 iterate_p (machine_mode *iter)
565 return *iter != E_VOIDmode;
568 /* Set mode iterator *ITER to the next widest mode in the same class,
569 if any. */
571 inline void
572 get_wider (machine_mode *iter)
574 *iter = GET_MODE_WIDER_MODE (*iter).else_void ();
577 /* Set mode iterator *ITER to the next widest mode in the same class.
578 Such a mode is known to exist. */
580 template<typename T>
581 inline void
582 get_known_wider (T *iter)
584 *iter = GET_MODE_WIDER_MODE (*iter).require ();
587 /* Set mode iterator *ITER to the mode that is two times wider than the
588 current one, if such a mode exists. */
590 inline void
591 get_2xwider (machine_mode *iter)
593 *iter = GET_MODE_2XWIDER_MODE (*iter).else_void ();
597 /* Make ITERATOR iterate over all the modes in mode class CLASS,
598 from narrowest to widest. */
599 #define FOR_EACH_MODE_IN_CLASS(ITERATOR, CLASS) \
600 for (mode_iterator::start (&(ITERATOR), CLASS); \
601 mode_iterator::iterate_p (&(ITERATOR)); \
602 mode_iterator::get_wider (&(ITERATOR)))
604 /* Make ITERATOR iterate over all the modes in the range [START, END),
605 in order of increasing width. */
606 #define FOR_EACH_MODE(ITERATOR, START, END) \
607 for ((ITERATOR) = (START); \
608 (ITERATOR) != (END); \
609 mode_iterator::get_known_wider (&(ITERATOR)))
611 /* Make ITERATOR iterate over START and all wider modes in the same
612 class, in order of increasing width. */
613 #define FOR_EACH_MODE_FROM(ITERATOR, START) \
614 for ((ITERATOR) = (START); \
615 mode_iterator::iterate_p (&(ITERATOR)); \
616 mode_iterator::get_wider (&(ITERATOR)))
618 /* Make ITERATOR iterate over modes in the range [NARROWEST, END)
619 in order of increasing width, where NARROWEST is the narrowest mode
620 in END's class. */
621 #define FOR_EACH_MODE_UNTIL(ITERATOR, END) \
622 FOR_EACH_MODE (ITERATOR, get_narrowest_mode (END), END)
624 /* Make ITERATOR iterate over modes in the same class as MODE, in order
625 of increasing width. Start at the first mode wider than START,
626 or don't iterate at all if there is no wider mode. */
627 #define FOR_EACH_WIDER_MODE(ITERATOR, START) \
628 for ((ITERATOR) = (START), mode_iterator::get_wider (&(ITERATOR)); \
629 mode_iterator::iterate_p (&(ITERATOR)); \
630 mode_iterator::get_wider (&(ITERATOR)))
632 /* Make ITERATOR iterate over modes in the same class as MODE, in order
633 of increasing width, and with each mode being twice the width of the
634 previous mode. Start at the mode that is two times wider than START,
635 or don't iterate at all if there is no such mode. */
636 #define FOR_EACH_2XWIDER_MODE(ITERATOR, START) \
637 for ((ITERATOR) = (START), mode_iterator::get_2xwider (&(ITERATOR)); \
638 mode_iterator::iterate_p (&(ITERATOR)); \
639 mode_iterator::get_2xwider (&(ITERATOR)))
641 #endif /* not HAVE_MACHINE_MODES */