sem_res.adb (Resolve_Selected_Component): do not generate a discriminant check if...
[platform/upstream/gcc.git] / gcc / ada / targtyps.c
1 /****************************************************************************
2  *                                                                          *
3  *                         GNAT COMPILER COMPONENTS                         *
4  *                                                                          *
5  *                            T A R G T Y P S                               *
6  *                                                                          *
7  *                                  Body                                    *
8  *                                                                          *
9  *                             $Revision: 1.1 $
10  *                                                                          *
11  *          Copyright (C) 1992-2001 Free Software Foundation, Inc.          *
12  *                                                                          *
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.                                                      *
23  *                                                                          *
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.                        *
29  *                                                                          *
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). *
32  *                                                                          *
33  ****************************************************************************/
34
35 /* Functions for retrieving target types. See Ada package Get_Targ */
36
37 #include "config.h"
38 #include "system.h"
39 #include "tree.h"
40 #include "real.h"
41 #include "rtl.h"
42 #include "ada.h"
43 #include "types.h"
44 #include "atree.h"
45 #include "elists.h"
46 #include "namet.h"
47 #include "nlists.h"
48 #include "snames.h"
49 #include "stringt.h"
50 #include "uintp.h"
51 #include "urealp.h"
52 #include "fe.h"
53 #include "sinfo.h"
54 #include "einfo.h"
55 #include "ada-tree.h"
56 #include "gigi.h"
57
58 #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
59
60 /* Standard data type sizes.  Most of these are not used.  */
61
62 #ifndef CHAR_TYPE_SIZE
63 #define CHAR_TYPE_SIZE BITS_PER_UNIT
64 #endif
65
66 #ifndef SHORT_TYPE_SIZE
67 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
68 #endif
69
70 #ifndef INT_TYPE_SIZE
71 #define INT_TYPE_SIZE BITS_PER_WORD
72 #endif
73
74 #ifdef OPEN_VMS /* A target macro defined in vms.h */
75 #define LONG_TYPE_SIZE 64
76 #else
77 #ifndef LONG_TYPE_SIZE
78 #define LONG_TYPE_SIZE BITS_PER_WORD
79 #endif
80 #endif
81
82 #ifndef LONG_LONG_TYPE_SIZE
83 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
84 #endif
85
86 #ifndef FLOAT_TYPE_SIZE
87 #define FLOAT_TYPE_SIZE BITS_PER_WORD
88 #endif
89
90 #ifndef DOUBLE_TYPE_SIZE
91 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
92 #endif
93
94 #ifndef LONG_DOUBLE_TYPE_SIZE
95 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
96 #endif
97
98 #ifndef WIDEST_HARDWARE_FP_SIZE
99 #define WIDEST_HARDWARE_FP_SIZE LONG_DOUBLE_TYPE_SIZE
100 #endif
101
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. */
104
105 Pos
106 get_target_bits_per_unit ()
107 {
108   return BITS_PER_UNIT;
109 }
110
111 Pos
112 get_target_bits_per_word ()
113 {
114   return BITS_PER_WORD;
115 }
116
117 Pos
118 get_target_char_size ()
119 {
120   return CHAR_TYPE_SIZE;
121 }
122
123 Pos
124 get_target_wchar_t_size ()
125 {
126   /* We never want wide chacters less than "short" in Ada.  */
127   return MAX (SHORT_TYPE_SIZE, WCHAR_TYPE_SIZE);
128 }
129
130 Pos
131 get_target_short_size ()
132 {
133   return SHORT_TYPE_SIZE;
134 }
135
136 Pos
137 get_target_int_size ()
138 {
139   return INT_TYPE_SIZE;
140 }
141
142 Pos
143 get_target_long_size ()
144 {
145   return LONG_TYPE_SIZE;
146 }
147
148 Pos
149 get_target_long_long_size ()
150 {
151   return LONG_LONG_TYPE_SIZE;
152 }
153
154 Pos
155 get_target_float_size ()
156 {
157   return FLOAT_TYPE_SIZE;
158 }
159
160 Pos
161 get_target_double_size ()
162 {
163   return DOUBLE_TYPE_SIZE;
164 }
165
166 Pos
167 get_target_long_double_size ()
168 {
169   return WIDEST_HARDWARE_FP_SIZE;
170 }
171
172 Pos
173 get_target_pointer_size ()
174 {
175   return POINTER_SIZE;
176 }
177
178 Pos
179 get_target_maximum_alignment ()
180 {
181   return BIGGEST_ALIGNMENT / BITS_PER_UNIT;
182 }
183
184 Boolean
185 get_target_no_dollar_in_label ()
186 {
187 #ifdef NO_DOLLAR_IN_LABEL
188   return 1;
189 #else
190   return 0;
191 #endif
192 }
193
194 #ifndef FLOAT_WORDS_BIG_ENDIAN
195 #define FLOAT_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
196 #endif
197
198 Nat
199 get_float_words_be ()
200 {
201   return FLOAT_WORDS_BIG_ENDIAN;
202 }
203
204 Nat
205 get_words_be ()
206 {
207   return WORDS_BIG_ENDIAN;
208 }
209
210 Nat
211 get_bytes_be ()
212 {
213   return BYTES_BIG_ENDIAN;
214 }
215
216 Nat
217 get_bits_be ()
218 {
219   return BITS_BIG_ENDIAN;
220 }
221
222 Nat
223 get_strict_alignment ()
224 {
225   return STRICT_ALIGNMENT;
226 }