1 /****************************************************************************
3 * GNAT COMPILER COMPONENTS *
9 * Copyright (C) 1992-2004 Free Software Foundation, Inc. *
11 * GNAT is free software; you can redistribute it and/or modify it under *
12 * terms of the GNU General Public License as published by the Free Soft- *
13 * ware Foundation; either version 2, or (at your option) any later ver- *
14 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
15 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
17 * for more details. You should have received a copy of the GNU General *
18 * Public License distributed with GNAT; see file COPYING. If not, write *
19 * to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, *
20 * MA 02111-1307, USA. *
22 * As a special exception, if you link this file with other files to *
23 * produce an executable, this file does not by itself cause the resulting *
24 * executable to be covered by the GNU General Public License. This except- *
25 * ion does not however invalidate any other reasons why the executable *
26 * file might be covered by the GNU Public License. *
28 * GNAT was originally developed by the GNAT team at New York University. *
29 * Extensive contributions were provided by Ada Core Technologies Inc. *
31 ****************************************************************************/
33 /* Functions for retrieving target types. See Ada package Get_Targ */
37 #include "coretypes.h"
58 /* If we don't have a specific size for Ada's equivalent of `long', use that
60 #ifndef ADA_LONG_TYPE_SIZE
61 #define ADA_LONG_TYPE_SIZE LONG_TYPE_SIZE
64 #ifndef WIDEST_HARDWARE_FP_SIZE
65 #define WIDEST_HARDWARE_FP_SIZE LONG_DOUBLE_TYPE_SIZE
68 /* The following provide a functional interface for the front end Ada code
69 to determine the sizes that are used for various C types. */
72 get_target_bits_per_unit (void)
78 get_target_bits_per_word (void)
84 get_target_char_size (void)
86 return CHAR_TYPE_SIZE
;
90 get_target_wchar_t_size (void)
92 /* We never want wide chacters less than "short" in Ada. */
93 return MAX (SHORT_TYPE_SIZE
, WCHAR_TYPE_SIZE
);
97 get_target_short_size (void)
99 return SHORT_TYPE_SIZE
;
103 get_target_int_size (void)
105 return INT_TYPE_SIZE
;
109 get_target_long_size (void)
111 return ADA_LONG_TYPE_SIZE
;
115 get_target_long_long_size (void)
117 return LONG_LONG_TYPE_SIZE
;
121 get_target_float_size (void)
123 return fp_prec_to_size (FLOAT_TYPE_SIZE
);
127 get_target_double_size (void)
129 return fp_prec_to_size (DOUBLE_TYPE_SIZE
);
133 get_target_long_double_size (void)
135 return fp_prec_to_size (WIDEST_HARDWARE_FP_SIZE
);
140 get_target_pointer_size (void)
146 get_target_maximum_alignment (void)
148 return BIGGEST_ALIGNMENT
/ BITS_PER_UNIT
;
151 #ifndef FLOAT_WORDS_BIG_ENDIAN
152 #define FLOAT_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
156 get_float_words_be (void)
158 return FLOAT_WORDS_BIG_ENDIAN
;
164 return WORDS_BIG_ENDIAN
;
170 return BYTES_BIG_ENDIAN
;
176 return BITS_BIG_ENDIAN
;
180 get_strict_alignment (void)
182 return STRICT_ALIGNMENT
;