| 1 |
38 |
julius |
/* Machine mode definitions for GCC; included by rtl.h and tree.h.
|
| 2 |
|
|
Copyright (C) 1991, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2003,
|
| 3 |
|
|
2007 Free Software Foundation, Inc.
|
| 4 |
|
|
|
| 5 |
|
|
This file is part of GCC.
|
| 6 |
|
|
|
| 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
|
| 10 |
|
|
version.
|
| 11 |
|
|
|
| 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
|
| 15 |
|
|
for more details.
|
| 16 |
|
|
|
| 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/>. */
|
| 20 |
|
|
|
| 21 |
|
|
#ifndef HAVE_MACHINE_MODES
|
| 22 |
|
|
#define HAVE_MACHINE_MODES
|
| 23 |
|
|
|
| 24 |
|
|
/* Make an enum class that gives all the machine modes. */
|
| 25 |
|
|
#include "insn-modes.h"
|
| 26 |
|
|
|
| 27 |
|
|
/* Get the name of mode MODE as a string. */
|
| 28 |
|
|
|
| 29 |
|
|
extern const char * const mode_name[NUM_MACHINE_MODES];
|
| 30 |
|
|
#define GET_MODE_NAME(MODE) mode_name[MODE]
|
| 31 |
|
|
|
| 32 |
|
|
/* Mode classes. */
|
| 33 |
|
|
|
| 34 |
|
|
#include "mode-classes.def"
|
| 35 |
|
|
#define DEF_MODE_CLASS(M) M
|
| 36 |
|
|
enum mode_class { MODE_CLASSES, MAX_MODE_CLASS };
|
| 37 |
|
|
#undef DEF_MODE_CLASS
|
| 38 |
|
|
#undef MODE_CLASSES
|
| 39 |
|
|
|
| 40 |
|
|
/* Get the general kind of object that mode MODE represents
|
| 41 |
|
|
(integer, floating, complex, etc.) */
|
| 42 |
|
|
|
| 43 |
|
|
extern const unsigned char mode_class[NUM_MACHINE_MODES];
|
| 44 |
|
|
#define GET_MODE_CLASS(MODE) mode_class[MODE]
|
| 45 |
|
|
|
| 46 |
|
|
/* Nonzero if MODE is an integral mode. */
|
| 47 |
|
|
#define INTEGRAL_MODE_P(MODE) \
|
| 48 |
|
|
(GET_MODE_CLASS (MODE) == MODE_INT \
|
| 49 |
|
|
|| GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT \
|
| 50 |
|
|
|| GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \
|
| 51 |
|
|
|| GET_MODE_CLASS (MODE) == MODE_VECTOR_INT)
|
| 52 |
|
|
|
| 53 |
|
|
/* Nonzero if MODE is a floating-point mode. */
|
| 54 |
|
|
#define FLOAT_MODE_P(MODE) \
|
| 55 |
|
|
(GET_MODE_CLASS (MODE) == MODE_FLOAT \
|
| 56 |
|
|
|| GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT \
|
| 57 |
|
|
|| GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \
|
| 58 |
|
|
|| GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT)
|
| 59 |
|
|
|
| 60 |
|
|
/* Nonzero if MODE is a complex mode. */
|
| 61 |
|
|
#define COMPLEX_MODE_P(MODE) \
|
| 62 |
|
|
(GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \
|
| 63 |
|
|
|| GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
|
| 64 |
|
|
|
| 65 |
|
|
/* Nonzero if MODE is a vector mode. */
|
| 66 |
|
|
#define VECTOR_MODE_P(MODE) \
|
| 67 |
|
|
(GET_MODE_CLASS (MODE) == MODE_VECTOR_INT \
|
| 68 |
|
|
|| GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT)
|
| 69 |
|
|
|
| 70 |
|
|
/* Nonzero if MODE is a scalar integral mode. */
|
| 71 |
|
|
#define SCALAR_INT_MODE_P(MODE) \
|
| 72 |
|
|
(GET_MODE_CLASS (MODE) == MODE_INT \
|
| 73 |
|
|
|| GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT)
|
| 74 |
|
|
|
| 75 |
|
|
/* Nonzero if MODE is a scalar floating point mode. */
|
| 76 |
|
|
#define SCALAR_FLOAT_MODE_P(MODE) \
|
| 77 |
|
|
(GET_MODE_CLASS (MODE) == MODE_FLOAT \
|
| 78 |
|
|
|| GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT)
|
| 79 |
|
|
|
| 80 |
|
|
/* Nonzero if MODE is a decimal floating point mode. */
|
| 81 |
|
|
#define DECIMAL_FLOAT_MODE_P(MODE) \
|
| 82 |
|
|
(GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT)
|
| 83 |
|
|
|
| 84 |
|
|
/* Nonzero if CLASS modes can be widened. */
|
| 85 |
|
|
#define CLASS_HAS_WIDER_MODES_P(CLASS) \
|
| 86 |
|
|
(CLASS == MODE_INT \
|
| 87 |
|
|
|| CLASS == MODE_FLOAT \
|
| 88 |
|
|
|| CLASS == MODE_DECIMAL_FLOAT \
|
| 89 |
|
|
|| CLASS == MODE_COMPLEX_FLOAT)
|
| 90 |
|
|
|
| 91 |
|
|
/* Get the size in bytes and bits of an object of mode MODE. */
|
| 92 |
|
|
|
| 93 |
|
|
extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
|
| 94 |
|
|
#define GET_MODE_SIZE(MODE) ((unsigned short) mode_size[MODE])
|
| 95 |
|
|
#define GET_MODE_BITSIZE(MODE) ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
|
| 96 |
|
|
|
| 97 |
|
|
/* Get the number of value bits of an object of mode MODE. */
|
| 98 |
|
|
extern const unsigned short mode_precision[NUM_MACHINE_MODES];
|
| 99 |
|
|
#define GET_MODE_PRECISION(MODE) mode_precision[MODE]
|
| 100 |
|
|
|
| 101 |
|
|
/* Get a bitmask containing 1 for all bits in a word
|
| 102 |
|
|
that fit within mode MODE. */
|
| 103 |
|
|
|
| 104 |
|
|
extern const unsigned HOST_WIDE_INT mode_mask_array[NUM_MACHINE_MODES];
|
| 105 |
|
|
|
| 106 |
|
|
#define GET_MODE_MASK(MODE) mode_mask_array[MODE]
|
| 107 |
|
|
|
| 108 |
|
|
/* Return the mode of the inner elements in a vector. */
|
| 109 |
|
|
|
| 110 |
|
|
extern const unsigned char mode_inner[NUM_MACHINE_MODES];
|
| 111 |
|
|
#define GET_MODE_INNER(MODE) mode_inner[MODE]
|
| 112 |
|
|
|
| 113 |
|
|
/* Get the size in bytes of the basic parts of an object of mode MODE. */
|
| 114 |
|
|
|
| 115 |
|
|
#define GET_MODE_UNIT_SIZE(MODE) \
|
| 116 |
|
|
(GET_MODE_INNER (MODE) == VOIDmode \
|
| 117 |
|
|
? GET_MODE_SIZE (MODE) \
|
| 118 |
|
|
: GET_MODE_SIZE (GET_MODE_INNER (MODE)))
|
| 119 |
|
|
|
| 120 |
|
|
/* Get the number of units in the object. */
|
| 121 |
|
|
|
| 122 |
|
|
extern const unsigned char mode_nunits[NUM_MACHINE_MODES];
|
| 123 |
|
|
#define GET_MODE_NUNITS(MODE) mode_nunits[MODE]
|
| 124 |
|
|
|
| 125 |
|
|
/* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */
|
| 126 |
|
|
|
| 127 |
|
|
extern const unsigned char mode_wider[NUM_MACHINE_MODES];
|
| 128 |
|
|
#define GET_MODE_WIDER_MODE(MODE) mode_wider[MODE]
|
| 129 |
|
|
|
| 130 |
|
|
extern const unsigned char mode_2xwider[NUM_MACHINE_MODES];
|
| 131 |
|
|
#define GET_MODE_2XWIDER_MODE(MODE) mode_2xwider[MODE]
|
| 132 |
|
|
|
| 133 |
|
|
/* Return the mode for data of a given size SIZE and mode class CLASS.
|
| 134 |
|
|
If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE.
|
| 135 |
|
|
The value is BLKmode if no other mode is found. */
|
| 136 |
|
|
|
| 137 |
|
|
extern enum machine_mode mode_for_size (unsigned int, enum mode_class, int);
|
| 138 |
|
|
|
| 139 |
|
|
/* Similar, but find the smallest mode for a given width. */
|
| 140 |
|
|
|
| 141 |
|
|
extern enum machine_mode smallest_mode_for_size (unsigned int,
|
| 142 |
|
|
enum mode_class);
|
| 143 |
|
|
|
| 144 |
|
|
|
| 145 |
|
|
/* Return an integer mode of the exact same size as the input mode,
|
| 146 |
|
|
or BLKmode on failure. */
|
| 147 |
|
|
|
| 148 |
|
|
extern enum machine_mode int_mode_for_mode (enum machine_mode);
|
| 149 |
|
|
|
| 150 |
|
|
/* Find the best mode to use to access a bit field. */
|
| 151 |
|
|
|
| 152 |
|
|
extern enum machine_mode get_best_mode (int, int, unsigned int,
|
| 153 |
|
|
enum machine_mode, int);
|
| 154 |
|
|
|
| 155 |
|
|
/* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT. */
|
| 156 |
|
|
|
| 157 |
|
|
extern CONST_MODE_BASE_ALIGN unsigned char mode_base_align[NUM_MACHINE_MODES];
|
| 158 |
|
|
|
| 159 |
|
|
extern unsigned get_mode_alignment (enum machine_mode);
|
| 160 |
|
|
|
| 161 |
|
|
#define GET_MODE_ALIGNMENT(MODE) get_mode_alignment (MODE)
|
| 162 |
|
|
|
| 163 |
|
|
/* For each class, get the narrowest mode in that class. */
|
| 164 |
|
|
|
| 165 |
|
|
extern const unsigned char class_narrowest_mode[MAX_MODE_CLASS];
|
| 166 |
|
|
#define GET_CLASS_NARROWEST_MODE(CLASS) class_narrowest_mode[CLASS]
|
| 167 |
|
|
|
| 168 |
|
|
/* Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD
|
| 169 |
|
|
and the mode whose class is Pmode and whose size is POINTER_SIZE. */
|
| 170 |
|
|
|
| 171 |
|
|
extern enum machine_mode byte_mode;
|
| 172 |
|
|
extern enum machine_mode word_mode;
|
| 173 |
|
|
extern enum machine_mode ptr_mode;
|
| 174 |
|
|
|
| 175 |
|
|
/* Target-dependent machine mode initialization - in insn-modes.c. */
|
| 176 |
|
|
extern void init_adjust_machine_modes (void);
|
| 177 |
|
|
|
| 178 |
|
|
#endif /* not HAVE_MACHINE_MODES */
|