OSDN Git Service

Merge basic-improvements-branch to trunk
[pf3gnuchains/gcc-fork.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  *                                                                          *
10  *          Copyright (C) 1992-2001 Free Software Foundation, Inc.          *
11  *                                                                          *
12  * GNAT is free software;  you can  redistribute it  and/or modify it under *
13  * terms of the  GNU General Public License as published  by the Free Soft- *
14  * ware  Foundation;  either version 2,  or (at your option) any later ver- *
15  * sion.  GNAT is distributed in the hope that it will be useful, but WITH- *
16  * OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY *
17  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License *
18  * for  more details.  You should have  received  a copy of the GNU General *
19  * Public License  distributed with GNAT;  see file COPYING.  If not, write *
20  * to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, *
21  * MA 02111-1307, USA.                                                      *
22  *                                                                          *
23  * As a  special  exception,  if you  link  this file  with other  files to *
24  * produce an executable,  this file does not by itself cause the resulting *
25  * executable to be covered by the GNU General Public License. This except- *
26  * ion does not  however invalidate  any other reasons  why the  executable *
27  * file might be covered by the  GNU Public License.                        *
28  *                                                                          *
29  * GNAT was originally developed  by the GNAT team at  New York University. *
30  * Extensive contributions were provided by Ada Core Technologies Inc.      *
31  *                                                                          *
32  ****************************************************************************/
33
34 /* Functions for retrieving target types. See Ada package Get_Targ */
35
36 #include "config.h"
37 #include "system.h"
38 #include "coretypes.h"
39 #include "tm.h"
40 #include "tree.h"
41 #include "real.h"
42 #include "rtl.h"
43 #include "ada.h"
44 #include "types.h"
45 #include "atree.h"
46 #include "elists.h"
47 #include "namet.h"
48 #include "nlists.h"
49 #include "snames.h"
50 #include "stringt.h"
51 #include "uintp.h"
52 #include "urealp.h"
53 #include "fe.h"
54 #include "sinfo.h"
55 #include "einfo.h"
56 #include "ada-tree.h"
57 #include "gigi.h"
58
59 /* If we don't have a specific size for Ada's equivalent of `long', use that
60    of C.  */
61 #ifndef ADA_LONG_TYPE_SIZE
62 #define ADA_LONG_TYPE_SIZE LONG_TYPE_SIZE
63 #endif
64
65 #ifndef WIDEST_HARDWARE_FP_SIZE
66 #define WIDEST_HARDWARE_FP_SIZE LONG_DOUBLE_TYPE_SIZE
67 #endif
68
69 /* The following provide a functional interface for the front end Ada code
70    to determine the sizes that are used for various C types. */
71
72 Pos
73 get_target_bits_per_unit ()
74 {
75   return BITS_PER_UNIT;
76 }
77
78 Pos
79 get_target_bits_per_word ()
80 {
81   return BITS_PER_WORD;
82 }
83
84 Pos
85 get_target_char_size ()
86 {
87   return CHAR_TYPE_SIZE;
88 }
89
90 Pos
91 get_target_wchar_t_size ()
92 {
93   /* We never want wide chacters less than "short" in Ada.  */
94   return MAX (SHORT_TYPE_SIZE, WCHAR_TYPE_SIZE);
95 }
96
97 Pos
98 get_target_short_size ()
99 {
100   return SHORT_TYPE_SIZE;
101 }
102
103 Pos
104 get_target_int_size ()
105 {
106   return INT_TYPE_SIZE;
107 }
108
109 Pos
110 get_target_long_size ()
111 {
112   return ADA_LONG_TYPE_SIZE;
113 }
114
115 Pos
116 get_target_long_long_size ()
117 {
118   return LONG_LONG_TYPE_SIZE;
119 }
120
121 Pos
122 get_target_float_size ()
123 {
124   return FLOAT_TYPE_SIZE;
125 }
126
127 Pos
128 get_target_double_size ()
129 {
130   return DOUBLE_TYPE_SIZE;
131 }
132
133 Pos
134 get_target_long_double_size ()
135 {
136   return WIDEST_HARDWARE_FP_SIZE;
137 }
138
139 Pos
140 get_target_pointer_size ()
141 {
142   return POINTER_SIZE;
143 }
144
145 Pos
146 get_target_maximum_alignment ()
147 {
148   return BIGGEST_ALIGNMENT / BITS_PER_UNIT;
149 }
150
151 Boolean
152 get_target_no_dollar_in_label ()
153 {
154 #ifdef NO_DOLLAR_IN_LABEL
155   return 1;
156 #else
157   return 0;
158 #endif
159 }
160
161 #ifndef FLOAT_WORDS_BIG_ENDIAN
162 #define FLOAT_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
163 #endif
164
165 Nat
166 get_float_words_be ()
167 {
168   return FLOAT_WORDS_BIG_ENDIAN;
169 }
170
171 Nat
172 get_words_be ()
173 {
174   return WORDS_BIG_ENDIAN;
175 }
176
177 Nat
178 get_bytes_be ()
179 {
180   return BYTES_BIG_ENDIAN;
181 }
182
183 Nat
184 get_bits_be ()
185 {
186   return BITS_BIG_ENDIAN;
187 }
188
189 Nat
190 get_strict_alignment ()
191 {
192   return STRICT_ALIGNMENT;
193 }