]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ada/targtyps.c
76b71cbb679993665c180eea97f2a0fb20f804ef
[thirdparty/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 * *
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 "tree.h"
39 #include "real.h"
40 #include "rtl.h"
41 #include "ada.h"
42 #include "types.h"
43 #include "atree.h"
44 #include "elists.h"
45 #include "namet.h"
46 #include "nlists.h"
47 #include "snames.h"
48 #include "stringt.h"
49 #include "uintp.h"
50 #include "urealp.h"
51 #include "fe.h"
52 #include "sinfo.h"
53 #include "einfo.h"
54 #include "ada-tree.h"
55 #include "gigi.h"
56
57 /* If we don't have a specific size for Ada's equivalent of `long', use that
58 of C. */
59 #ifndef ADA_LONG_TYPE_SIZE
60 #define ADA_LONG_TYPE_SIZE LONG_TYPE_SIZE
61 #endif
62
63 #ifndef WIDEST_HARDWARE_FP_SIZE
64 #define WIDEST_HARDWARE_FP_SIZE LONG_DOUBLE_TYPE_SIZE
65 #endif
66
67 /* The following provide a functional interface for the front end Ada code
68 to determine the sizes that are used for various C types. */
69
70 Pos
71 get_target_bits_per_unit ()
72 {
73 return BITS_PER_UNIT;
74 }
75
76 Pos
77 get_target_bits_per_word ()
78 {
79 return BITS_PER_WORD;
80 }
81
82 Pos
83 get_target_char_size ()
84 {
85 return CHAR_TYPE_SIZE;
86 }
87
88 Pos
89 get_target_wchar_t_size ()
90 {
91 /* We never want wide chacters less than "short" in Ada. */
92 return MAX (SHORT_TYPE_SIZE, WCHAR_TYPE_SIZE);
93 }
94
95 Pos
96 get_target_short_size ()
97 {
98 return SHORT_TYPE_SIZE;
99 }
100
101 Pos
102 get_target_int_size ()
103 {
104 return INT_TYPE_SIZE;
105 }
106
107 Pos
108 get_target_long_size ()
109 {
110 return ADA_LONG_TYPE_SIZE;
111 }
112
113 Pos
114 get_target_long_long_size ()
115 {
116 return LONG_LONG_TYPE_SIZE;
117 }
118
119 Pos
120 get_target_float_size ()
121 {
122 return FLOAT_TYPE_SIZE;
123 }
124
125 Pos
126 get_target_double_size ()
127 {
128 return DOUBLE_TYPE_SIZE;
129 }
130
131 Pos
132 get_target_long_double_size ()
133 {
134 return WIDEST_HARDWARE_FP_SIZE;
135 }
136
137 Pos
138 get_target_pointer_size ()
139 {
140 return POINTER_SIZE;
141 }
142
143 Pos
144 get_target_maximum_alignment ()
145 {
146 return BIGGEST_ALIGNMENT / BITS_PER_UNIT;
147 }
148
149 Boolean
150 get_target_no_dollar_in_label ()
151 {
152 #ifdef NO_DOLLAR_IN_LABEL
153 return 1;
154 #else
155 return 0;
156 #endif
157 }
158
159 #ifndef FLOAT_WORDS_BIG_ENDIAN
160 #define FLOAT_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
161 #endif
162
163 Nat
164 get_float_words_be ()
165 {
166 return FLOAT_WORDS_BIG_ENDIAN;
167 }
168
169 Nat
170 get_words_be ()
171 {
172 return WORDS_BIG_ENDIAN;
173 }
174
175 Nat
176 get_bytes_be ()
177 {
178 return BYTES_BIG_ENDIAN;
179 }
180
181 Nat
182 get_bits_be ()
183 {
184 return BITS_BIG_ENDIAN;
185 }
186
187 Nat
188 get_strict_alignment ()
189 {
190 return STRICT_ALIGNMENT;
191 }