1 /****************************************************************************
3 * GNAT COMPILER COMPONENTS *
11 * Copyright (C) 1992-2001 Free Software Foundation, Inc. *
13 * GNAT is free software; you can redistribute it and/or modify it under *
14 * terms of the GNU General Public License as published by the Free Soft- *
15 * ware Foundation; either version 2, or (at your option) any later ver- *
16 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
17 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
19 * for more details. You should have received a copy of the GNU General *
20 * Public License distributed with GNAT; see file COPYING. If not, write *
21 * to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, *
22 * MA 02111-1307, USA. *
24 * As a special exception, if you link this file with other files to *
25 * produce an executable, this file does not by itself cause the resulting *
26 * executable to be covered by the GNU General Public License. This except- *
27 * ion does not however invalidate any other reasons why the executable *
28 * file might be covered by the GNU Public License. *
30 * GNAT was originally developed by the GNAT team at New York University. *
31 * It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). *
33 ****************************************************************************/
35 /* Functions for retrieving target types. See Ada package Get_Targ */
58 #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
60 /* Standard data type sizes. Most of these are not used. */
62 #ifndef CHAR_TYPE_SIZE
63 #define CHAR_TYPE_SIZE BITS_PER_UNIT
66 #ifndef SHORT_TYPE_SIZE
67 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
71 #define INT_TYPE_SIZE BITS_PER_WORD
74 #ifdef OPEN_VMS /* A target macro defined in vms.h */
75 #define LONG_TYPE_SIZE 64
77 #ifndef LONG_TYPE_SIZE
78 #define LONG_TYPE_SIZE BITS_PER_WORD
82 #ifndef LONG_LONG_TYPE_SIZE
83 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
86 #ifndef FLOAT_TYPE_SIZE
87 #define FLOAT_TYPE_SIZE BITS_PER_WORD
90 #ifndef DOUBLE_TYPE_SIZE
91 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
94 #ifndef LONG_DOUBLE_TYPE_SIZE
95 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
98 #ifndef WIDEST_HARDWARE_FP_SIZE
99 #define WIDEST_HARDWARE_FP_SIZE LONG_DOUBLE_TYPE_SIZE
102 /* The following provide a functional interface for the front end Ada code
103 to determine the sizes that are used for various C types. */
106 get_target_bits_per_unit ()
108 return BITS_PER_UNIT;
112 get_target_bits_per_word ()
114 return BITS_PER_WORD;
118 get_target_char_size ()
120 return CHAR_TYPE_SIZE;
124 get_target_wchar_t_size ()
126 /* We never want wide chacters less than "short" in Ada. */
127 return MAX (SHORT_TYPE_SIZE, WCHAR_TYPE_SIZE);
131 get_target_short_size ()
133 return SHORT_TYPE_SIZE;
137 get_target_int_size ()
139 return INT_TYPE_SIZE;
143 get_target_long_size ()
145 return LONG_TYPE_SIZE;
149 get_target_long_long_size ()
151 return LONG_LONG_TYPE_SIZE;
155 get_target_float_size ()
157 return FLOAT_TYPE_SIZE;
161 get_target_double_size ()
163 return DOUBLE_TYPE_SIZE;
167 get_target_long_double_size ()
169 return WIDEST_HARDWARE_FP_SIZE;
173 get_target_pointer_size ()
179 get_target_maximum_alignment ()
181 return BIGGEST_ALIGNMENT / BITS_PER_UNIT;
185 get_target_no_dollar_in_label ()
187 #ifdef NO_DOLLAR_IN_LABEL
194 #ifndef FLOAT_WORDS_BIG_ENDIAN
195 #define FLOAT_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
199 get_float_words_be ()
201 return FLOAT_WORDS_BIG_ENDIAN;
207 return WORDS_BIG_ENDIAN;
213 return BYTES_BIG_ENDIAN;
219 return BITS_BIG_ENDIAN;
223 get_strict_alignment ()
225 return STRICT_ALIGNMENT;