]> gcc.gnu.org Git - gcc.git/blame - gcc/machmode.h
Add support for v850 special data areas.
[gcc.git] / gcc / machmode.h
CommitLineData
fc152a4b 1/* Machine mode definitions for GNU C-Compiler; included by rtl.h and tree.h.
70c75d9f 2 Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
fc152a4b
RK
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
a35311b0
RK
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
fc152a4b 20
fc152a4b 21#ifndef HAVE_MACHINE_MODES
70c75d9f
DE
22#define HAVE_MACHINE_MODES
23
24#include "gansidecl.h"
fc152a4b
RK
25
26/* Strictly speaking, this isn't the proper place to include these definitions,
27 but this file is included by every GCC file.
28
29 Some systems define these in, e.g., param.h. We undefine these names
30 here to avoid the warnings. We prefer to use our definitions since we
31 know they are correct. */
32
33#undef MIN
34#undef MAX
35
36#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
37#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
38
5f4f0e22
CH
39/* Find the largest host integer type and set its size and type. */
40
41#ifndef HOST_BITS_PER_WIDE_INT
42
43#if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
44#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
45#define HOST_WIDE_INT long
46#else
47#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
48#define HOST_WIDE_INT int
49#endif
50
51#endif
52
5f4f0e22
CH
53/* Provide a default way to print an address in hex via printf. */
54
55#ifndef HOST_PTR_PRINTF
092f7be3
KG
56# ifdef HAVE_PRINTF_PTR
57# define HOST_PTR_PRINTF "%p"
58# else
59# define HOST_PTR_PRINTF \
60 (sizeof (int) == sizeof (char *) ? "%x" \
61 : sizeof (long) == sizeof (char *) ? "%lx" : "%llx")
62# endif
63#endif /* ! HOST_PTR_PRINTF */
29cad4a4
RK
64
65/* Provide defaults for the way to print a HOST_WIDE_INT
66 in various manners. */
67
68#ifndef HOST_WIDE_INT_PRINT_DEC
69#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
70#define HOST_WIDE_INT_PRINT_DEC "%d"
71#else
72#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
73#define HOST_WIDE_INT_PRINT_DEC "%ld"
74#else
75#define HOST_WIDE_INT_PRINT_DEC "%lld"
76#endif
77#endif
78#endif
79
80#ifndef HOST_WIDE_INT_PRINT_UNSIGNED
81#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
82#define HOST_WIDE_INT_PRINT_UNSIGNED "%u"
83#else
84#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
85#define HOST_WIDE_INT_PRINT_UNSIGNED "%lu"
86#else
87#define HOST_WIDE_INT_PRINT_UNSIGNED "%llu"
88#endif
89#endif
90#endif
91
92#ifndef HOST_WIDE_INT_PRINT_HEX
93#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
94#define HOST_WIDE_INT_PRINT_HEX "0x%x"
95#else
96#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
97#define HOST_WIDE_INT_PRINT_HEX "0x%lx"
98#else
99#define HOST_WIDE_INT_PRINT_HEX "0x%llx"
100#endif
101#endif
102#endif
103
104#ifndef HOST_WIDE_INT_PRINT_DOUBLE_HEX
105#if HOST_BITS_PER_WIDE_INT == 64
106#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
107#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%016x"
108#else
109#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
110#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx"
111#else
112#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
113#endif
114#endif
115#else
116#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
117#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x"
118#else
119#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
120#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
121#else
122#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx"
123#endif
124#endif
125#endif
5f4f0e22
CH
126#endif
127
fc152a4b
RK
128/* Make an enum class that gives all the machine modes. */
129
130#define DEF_MACHMODE(SYM, NAME, TYPE, SIZE, UNIT, WIDER) SYM,
131
132enum machine_mode {
133#include "machmode.def"
134
135#ifdef EXTRA_CC_MODES
136 EXTRA_CC_MODES,
137#endif
138MAX_MACHINE_MODE };
139
140#undef DEF_MACHMODE
141
fc152a4b
RK
142#ifndef NUM_MACHINE_MODES
143#define NUM_MACHINE_MODES (int) MAX_MACHINE_MODE
144#endif
145
146/* Get the name of mode MODE as a string. */
147
148extern char *mode_name[];
0f41302f 149#define GET_MODE_NAME(MODE) (mode_name[(int) (MODE)])
fc152a4b
RK
150
151enum mode_class { MODE_RANDOM, MODE_INT, MODE_FLOAT, MODE_PARTIAL_INT, MODE_CC,
4a39a918 152 MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT, MAX_MODE_CLASS};
fc152a4b
RK
153
154/* Get the general kind of object that mode MODE represents
155 (integer, floating, complex, etc.) */
156
157extern enum mode_class mode_class[];
0f41302f 158#define GET_MODE_CLASS(MODE) (mode_class[(int) (MODE)])
fc152a4b 159
ae1ae48c
RK
160/* Nonzero if MODE is an integral mode. */
161#define INTEGRAL_MODE_P(MODE) \
162 (GET_MODE_CLASS (MODE) == MODE_INT \
163 || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT \
164 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT)
165
166/* Nonzero if MODE is a floating-point mode. */
167#define FLOAT_MODE_P(MODE) \
168 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
169 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
170
76080169
RH
171/* Nonzero if MODE is a complex mode. */
172#define COMPLEX_MODE_P(MODE) \
173 (GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \
174 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
175
fc152a4b
RK
176/* Get the size in bytes of an object of mode MODE. */
177
178extern int mode_size[];
0f41302f 179#define GET_MODE_SIZE(MODE) (mode_size[(int) (MODE)])
fc152a4b
RK
180
181/* Get the size in bytes of the basic parts of an object of mode MODE. */
182
183extern int mode_unit_size[];
0f41302f 184#define GET_MODE_UNIT_SIZE(MODE) (mode_unit_size[(int) (MODE)])
fc152a4b
RK
185
186/* Get the number of units in the object. */
187
188#define GET_MODE_NUNITS(MODE) \
fa45b1eb
RS
189 ((GET_MODE_UNIT_SIZE ((MODE)) == 0) ? 0 \
190 : (GET_MODE_SIZE ((MODE)) / GET_MODE_UNIT_SIZE ((MODE))))
fc152a4b
RK
191
192/* Get the size in bits of an object of mode MODE. */
193
0f41302f 194#define GET_MODE_BITSIZE(MODE) (BITS_PER_UNIT * mode_size[(int) (MODE)])
fc152a4b
RK
195
196/* Get a bitmask containing 1 for all bits in a word
197 that fit within mode MODE. */
198
199#define GET_MODE_MASK(MODE) \
5f4f0e22
CH
200 ((GET_MODE_BITSIZE (MODE) >= HOST_BITS_PER_WIDE_INT) \
201 ?(HOST_WIDE_INT) ~0 : (((HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (MODE)) - 1))
fc152a4b
RK
202
203/* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */
204
205extern enum machine_mode mode_wider_mode[];
0f41302f 206#define GET_MODE_WIDER_MODE(MODE) (mode_wider_mode[(int) (MODE)])
fc152a4b 207
c92c981a
RK
208/* Return the mode for data of a given size SIZE and mode class CLASS.
209 If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE.
210 The value is BLKmode if no other mode is found. */
211
521f2d6f 212extern enum machine_mode mode_for_size PROTO((unsigned int, enum mode_class, int));
c92c981a 213
fc152a4b
RK
214/* Find the best mode to use to access a bit field. */
215
521f2d6f 216extern enum machine_mode get_best_mode PROTO((int, int, int, enum machine_mode, int));
fc152a4b
RK
217
218/* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT. */
219
220#define GET_MODE_ALIGNMENT(MODE) \
221 MIN (BIGGEST_ALIGNMENT, \
222 MAX (1, (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT)))
223
4a39a918
RK
224/* For each class, get the narrowest mode in that class. */
225
226extern enum machine_mode class_narrowest_mode[];
0f41302f 227#define GET_CLASS_NARROWEST_MODE(CLASS) class_narrowest_mode[(int) (CLASS)]
4a39a918 228
6c164c81
RK
229/* Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD
230 and the mode whose class is Pmode and whose size is POINTER_SIZE. */
4a39a918
RK
231
232extern enum machine_mode byte_mode;
233extern enum machine_mode word_mode;
6c164c81 234extern enum machine_mode ptr_mode;
4a39a918 235
fc152a4b 236#endif /* not HAVE_MACHINE_MODES */
This page took 0.652462 seconds and 5 git commands to generate.