]> gcc.gnu.org Git - gcc.git/blame - gcc/machmode.def
decl.c: Do not undefine IN_GCC_FRONTEND and do not include expr.h.
[gcc.git] / gcc / machmode.def
CommitLineData
95e304f7 1/* This file contains the definitions and documentation for the
38e01259 2 machine modes used in the GNU compiler.
9dcd6f09
NC
3 Copyright (C) 1987, 1992, 1994, 1997, 1998, 2000, 2003, 2004, 2005,
4 2007 Free Software Foundation, Inc.
95e304f7 5
1322177d 6This file is part of GCC.
95e304f7 7
1322177d
LB
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
9dcd6f09 10Software Foundation; either version 3, or (at your option) any later
1322177d 11version.
95e304f7 12
1322177d
LB
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
95e304f7
CH
17
18You should have received a copy of the GNU General Public License
9dcd6f09
NC
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
95e304f7
CH
21
22
1322177d 23/* This file defines all the MACHINE MODES used by GCC.
95e304f7
CH
24
25 A machine mode specifies a size and format of data
26 at the machine level.
27
28 Each RTL expression has a machine mode.
29
30 At the syntax tree level, each ..._TYPE and each ..._DECL node
31 has a machine mode which describes data of that type or the
32 data of the variable declared. */
33
0974c7d7
ZW
34/* This file is included by the genmodes program. Its text is the
35 body of a function. Do not rely on this, it will change in the
36 future.
37
38 The following statements can be used in this file -- all have
39 the form of a C macro call. In their arguments:
40
41 A CLASS argument must be one of the constants defined in
42 mode-classes.def, less the leading MODE_ prefix; some statements
aabcd309 43 that take CLASS arguments have restrictions on which classes are
0974c7d7
ZW
44 acceptable. For instance, INT.
45
46 A MODE argument must be the printable name of a machine mode,
47 without quotation marks or trailing "mode". For instance, SI.
48
37783865 49 A PRECISION, BYTESIZE, or COUNT argument must be a positive integer
0974c7d7
ZW
50 constant.
51
94134f42 52 A FORMAT argument must be one of the real_mode_format structures
b8eaca23
ZW
53 declared in real.h, or else a literal 0. Do not put a leading &
54 on the argument.
55
56 An EXPR argument must be a syntactically valid C expression.
57 If an EXPR contains commas, you may need to write an extra pair of
58 parentheses around it, so it appears to be a single argument to the
59 statement.
94134f42
ZW
60
61 This file defines only those modes which are of use on almost all
62 machines. Other modes can be defined in the target-specific
63 mode definition file, config/ARCH/ARCH-modes.def.
64
0974c7d7
ZW
65 Order matters in this file in so far as statements which refer to
66 other modes must appear after the modes they refer to. However,
67 statements which do not refer to other modes may appear in any
68 order.
69
70 RANDOM_MODE (MODE);
71 declares MODE to be of class RANDOM.
72
73 CC_MODE (MODE);
74 declares MODE to be of class CC.
75
76 INT_MODE (MODE, BYTESIZE);
77 declares MODE to be of class INT and BYTESIZE bytes wide.
78 All of the bits of its representation are significant.
79
37783865 80 FRACTIONAL_INT_MODE (MODE, PRECISION, BYTESIZE);
0974c7d7 81 declares MODE to be of class INT, BYTESIZE bytes wide in
37783865 82 storage, but with only PRECISION significant bits.
0974c7d7 83
94134f42
ZW
84 FLOAT_MODE (MODE, BYTESIZE, FORMAT);
85 declares MODE to be of class FLOAT and BYTESIZE bytes wide,
86 using floating point format FORMAT.
0974c7d7
ZW
87 All of the bits of its representation are significant.
88
909e2256
JG
89 DECIMAL FLOAT_MODE (MODE, BYTESIZE);
90 declares MODE to be of class DECIMAL_FLOAT and BYTESIZE bytes
91 wide. All of the bits of its representation are significant.
92
37783865 93 FRACTIONAL_FLOAT_MODE (MODE, PRECISION, BYTESIZE, FORMAT);
0974c7d7 94 declares MODE to be of class FLOAT, BYTESIZE bytes wide in
37783865 95 storage, but with only PRECISION significant bits, using
94134f42
ZW
96 floating point format FORMAT.
97
1699ec0b
CF
98 FRACT_MODE (MODE, BYTESIZE, FBIT);
99 declares MODE to be of class FRACT and BYTESIZE bytes wide
100 with FBIT fractional bits. There may be padding bits.
101
102 UFRACT_MODE (MODE, BYTESIZE, FBIT);
103 declares MODE to be of class UFRACT and BYTESIZE bytes wide
104 with FBIT fractional bits. There may be padding bits.
105
106 ACCUM_MODE (MODE, BYTESIZE, IBIT, FBIT);
107 declares MODE to be of class ACCUM and BYTESIZE bytes wide
108 with IBIT integral bits and FBIT fractional bits.
109 There may be padding bits.
110
111 UACCUM_MODE (MODE, BYTESIZE, FBIT);
112 declares MODE to be of class UACCUM and BYTESIZE bytes wide
113 with IBIT integral bits and FBIT fractional bits.
114 There may be padding bits.
115
94134f42
ZW
116 RESET_FLOAT_FORMAT (MODE, FORMAT);
117 changes the format of MODE, which must be class FLOAT,
118 to FORMAT. Use in an ARCH-modes.def to reset the format
119 of one of the float modes defined in this file.
0974c7d7
ZW
120
121 PARTIAL_INT_MODE (MODE);
122 declares a mode of class PARTIAL_INT with the same size as
123 MODE (which must be an INT mode). The name of the new mode
124 is made by prefixing a P to the name MODE. This statement
37783865 125 may grow a PRECISION argument in the future.
0974c7d7
ZW
126
127 VECTOR_MODE (CLASS, MODE, COUNT);
128 Declare a vector mode whose component mode is MODE (of class
129 CLASS) with COUNT components. CLASS must be INT or FLOAT.
130 The name of the vector mode takes the form VnX where n is
131 COUNT in decimal and X is MODE.
132
133 VECTOR_MODES (CLASS, WIDTH);
134 For all modes presently declared in class CLASS, construct
135 corresponding vector modes having width WIDTH. Modes whose
136 byte sizes do not evenly divide WIDTH are ignored, as are
137 modes that would produce vector modes with only one component,
138 and modes smaller than one byte (if CLASS is INT) or smaller
139 than two bytes (if CLASS is FLOAT). CLASS must be INT or
140 FLOAT. The names follow the same rule as VECTOR_MODE uses.
141
142 COMPLEX_MODES (CLASS);
143 For all modes presently declared in class CLASS, construct
144 corresponding complex modes. Modes smaller than one byte
145 are ignored. For FLOAT modes, the names are derived by
146 replacing the 'F' in the mode name with a 'C'. (It is an
147 error if there is no 'F'. For INT modes, the names are
148 derived by prefixing a C to the name.
149
b8eaca23
ZW
150 ADJUST_BYTESIZE (MODE, EXPR);
151 ADJUST_ALIGNMENT (MODE, EXPR);
152 ADJUST_FLOAT_FORMAT (MODE, EXPR);
1699ec0b
CF
153 ADJUST_IBIT (MODE, EXPR);
154 ADJUST_FBIT (MODE, EXPR);
155 Arrange for the byte size, alignment, floating point format, ibit,
156 or fbit of MODE to be adjustable at run time. EXPR will be executed
b8eaca23 157 once after processing all command line options, and should
1699ec0b 158 evaluate to the desired byte size, alignment, format, ibit or fbit.
b8eaca23
ZW
159
160 Unlike a FORMAT argument, if you are adjusting a float format
161 you must put an & in front of the name of each format structure.
162
0974c7d7
ZW
163 Note: If a mode is ever made which is more than 255 bytes wide,
164 machmode.h and genmodes.c will have to be changed to allocate
165 more space for the mode_size and mode_alignment arrays. */
95e304f7
CH
166
167/* VOIDmode is used when no mode needs to be specified,
168 as for example on CONST_INT RTL expressions. */
0974c7d7
ZW
169RANDOM_MODE (VOID);
170
171/* BLKmode is used for structures, arrays, etc.
172 that fit no more specific mode. */
173RANDOM_MODE (BLK);
174
175/* Single bit mode used for booleans. */
176FRACTIONAL_INT_MODE (BI, 1, 1);
a191f0ee 177
94134f42
ZW
178/* Basic integer modes. We go up to TI in generic code (128 bits).
179 The name OI is reserved for a 256-bit type (needed by some back ends).
180 FIXME TI shouldn't be generically available either. */
0974c7d7
ZW
181INT_MODE (QI, 1);
182INT_MODE (HI, 2);
183INT_MODE (SI, 4);
184INT_MODE (DI, 8);
185INT_MODE (TI, 16);
94134f42
ZW
186
187/* No partial integer modes are defined by default. */
188
189/* Basic floating point modes. SF and DF are the only modes provided
190 by default. The names QF, HF, XF, and TF are reserved for targets
191 that need 1-word, 2-word, 80-bit, or 128-bit float types respectively.
192
193 These are the IEEE mappings. They can be overridden with
194 RESET_FLOAT_FORMAT or at runtime (in OVERRIDE_OPTIONS). */
195
196FLOAT_MODE (SF, 4, ieee_single_format);
197FLOAT_MODE (DF, 8, ieee_double_format);
198
199/* Basic CC modes.
200 FIXME define this only for targets that need it. */
0974c7d7
ZW
201CC_MODE (CC);
202
1699ec0b
CF
203/* Fixed-point modes. */
204FRACT_MODE (QQ, 1, 7); /* s.7 */
205FRACT_MODE (HQ, 2, 15); /* s.15 */
206FRACT_MODE (SQ, 4, 31); /* s.31 */
207FRACT_MODE (DQ, 8, 63); /* s.63 */
208FRACT_MODE (TQ, 16, 127); /* s.127 */
209
210UFRACT_MODE (UQQ, 1, 8); /* .8 */
211UFRACT_MODE (UHQ, 2, 16); /* .16 */
212UFRACT_MODE (USQ, 4, 32); /* .32 */
213UFRACT_MODE (UDQ, 8, 64); /* .64 */
214UFRACT_MODE (UTQ, 16, 128); /* .128 */
215
216ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
217ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
218ACCUM_MODE (DA, 8, 32, 31); /* s32.31 */
219ACCUM_MODE (TA, 16, 64, 63); /* s64.63 */
220
221UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
222UACCUM_MODE (USA, 4, 16, 16); /* 16.16 */
223UACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */
224UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
225
0974c7d7
ZW
226/* Allow the target to specify additional modes of various kinds. */
227#if HAVE_EXTRA_MODES
0974c7d7 228# include EXTRA_MODES_FILE
0974c7d7 229#endif
95e304f7 230
c100b4ef 231/* Complex modes. */
0974c7d7
ZW
232COMPLEX_MODES (INT);
233COMPLEX_MODES (FLOAT);
c100b4ef 234
909e2256
JG
235/* Decimal floating point modes. */
236DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
237DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
238DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
239
95e304f7 240/* The symbol Pmode stands for one of the above machine modes (usually SImode).
0974c7d7 241 The tm.h file specifies which one. It is not a distinct mode. */
95e304f7
CH
242
243/*
244Local variables:
245mode:c
246version-control: t
247End:
248*/
This page took 3.884439 seconds and 5 git commands to generate.