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