1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2014, 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 3, 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 -- Version for use with gcc
28 package body Get_Targ
is
30 -- Functions returning individual runtime. For the standard (GCC) back
31 -- end these come from C interface functions (one for each value).
33 -----------------------
34 -- Get_Bits_Per_Unit --
35 -----------------------
37 function Get_Bits_Per_Unit
return Pos
is
38 function C_Get_Bits_Per_Unit
return Pos
;
39 pragma Import
(C
, C_Get_Bits_Per_Unit
,
40 "get_target_bits_per_unit");
42 return C_Get_Bits_Per_Unit
;
43 end Get_Bits_Per_Unit
;
45 -----------------------
46 -- Get_Bits_Per_Word --
47 -----------------------
49 function Get_Bits_Per_Word
return Pos
is
50 function C_Get_Bits_Per_Word
return Pos
;
51 pragma Import
(C
, C_Get_Bits_Per_Word
,
52 "get_target_bits_per_word");
54 return C_Get_Bits_Per_Word
;
55 end Get_Bits_Per_Word
;
61 function Get_Char_Size
return Pos
is
62 function C_Get_Char_Size
return Pos
;
63 pragma Import
(C
, C_Get_Char_Size
,
64 "get_target_char_size");
66 return C_Get_Char_Size
;
69 ----------------------
70 -- Get_Wchar_T_Size --
71 ----------------------
73 function Get_Wchar_T_Size
return Pos
is
74 function C_Get_Wchar_T_Size
return Pos
;
75 pragma Import
(C
, C_Get_Wchar_T_Size
,
76 "get_target_wchar_t_size");
78 return C_Get_Wchar_T_Size
;
85 function Get_Short_Size
return Pos
is
86 function C_Get_Short_Size
return Pos
;
87 pragma Import
(C
, C_Get_Short_Size
,
88 "get_target_short_size");
90 return C_Get_Short_Size
;
97 function Get_Int_Size
return Pos
is
98 function C_Get_Int_Size
return Pos
;
99 pragma Import
(C
, C_Get_Int_Size
,
100 "get_target_int_size");
102 return C_Get_Int_Size
;
109 function Get_Long_Size
return Pos
is
110 function C_Get_Long_Size
return Pos
;
111 pragma Import
(C
, C_Get_Long_Size
,
112 "get_target_long_size");
114 return C_Get_Long_Size
;
117 ------------------------
118 -- Get_Long_Long_Size --
119 ------------------------
121 function Get_Long_Long_Size
return Pos
is
122 function C_Get_Long_Long_Size
return Pos
;
123 pragma Import
(C
, C_Get_Long_Long_Size
,
124 "get_target_long_long_size");
126 return C_Get_Long_Long_Size
;
127 end Get_Long_Long_Size
;
129 ----------------------
130 -- Get_Pointer_Size --
131 ----------------------
133 function Get_Pointer_Size
return Pos
is
134 function C_Get_Pointer_Size
return Pos
;
135 pragma Import
(C
, C_Get_Pointer_Size
,
136 "get_target_pointer_size");
138 return C_Get_Pointer_Size
;
139 end Get_Pointer_Size
;
141 ---------------------------
142 -- Get_Maximum_Alignment --
143 ---------------------------
145 function Get_Maximum_Alignment
return Pos
is
146 function C_Get_Maximum_Alignment
return Pos
;
147 pragma Import
(C
, C_Get_Maximum_Alignment
,
148 "get_target_maximum_alignment");
150 return C_Get_Maximum_Alignment
;
151 end Get_Maximum_Alignment
;
153 ------------------------
154 -- Get_Float_Words_BE --
155 ------------------------
157 function Get_Float_Words_BE
return Nat
is
158 function C_Get_Float_Words_BE
return Nat
;
159 pragma Import
(C
, C_Get_Float_Words_BE
,
160 "get_float_words_be");
162 return C_Get_Float_Words_BE
;
163 end Get_Float_Words_BE
;
169 function Get_Words_BE
return Nat
is
170 function C_Get_Words_BE
return Nat
;
171 pragma Import
(C
, C_Get_Words_BE
,
174 return C_Get_Words_BE
;
181 function Get_Bytes_BE
return Nat
is
182 function C_Get_Bytes_BE
return Nat
;
183 pragma Import
(C
, C_Get_Bytes_BE
,
186 return C_Get_Bytes_BE
;
193 function Get_Bits_BE
return Nat
is
194 function C_Get_Bits_BE
return Nat
;
195 pragma Import
(C
, C_Get_Bits_BE
,
198 return C_Get_Bits_BE
;
201 ---------------------
202 -- Get_Short_Enums --
203 ---------------------
205 function Get_Short_Enums
return Int
is
206 flag_short_enums
: Int
;
207 pragma Import
(C
, flag_short_enums
);
209 return flag_short_enums
;
212 --------------------------
213 -- Get_Strict_Alignment --
214 --------------------------
216 function Get_Strict_Alignment
return Nat
is
217 function C_Get_Strict_Alignment
return Nat
;
218 pragma Import
(C
, C_Get_Strict_Alignment
,
219 "get_target_strict_alignment");
221 return C_Get_Strict_Alignment
;
222 end Get_Strict_Alignment
;
224 ------------------------------------
225 -- Get_System_Allocator_Alignment --
226 ------------------------------------
228 function Get_System_Allocator_Alignment
return Nat
is
229 function C_Get_System_Allocator_Alignment
return Nat
;
230 pragma Import
(C
, C_Get_System_Allocator_Alignment
,
231 "get_target_system_allocator_alignment");
233 return C_Get_System_Allocator_Alignment
;
234 end Get_System_Allocator_Alignment
;
236 --------------------------------
237 -- Get_Double_Float_Alignment --
238 --------------------------------
240 function Get_Double_Float_Alignment
return Nat
is
241 function C_Get_Double_Float_Alignment
return Nat
;
242 pragma Import
(C
, C_Get_Double_Float_Alignment
,
243 "get_target_double_float_alignment");
245 return C_Get_Double_Float_Alignment
;
246 end Get_Double_Float_Alignment
;
248 ---------------------------------
249 -- Get_Double_Scalar_Alignment --
250 ---------------------------------
252 function Get_Double_Scalar_Alignment
return Nat
is
253 function C_Get_Double_Scalar_Alignment
return Nat
;
254 pragma Import
(C
, C_Get_Double_Scalar_Alignment
,
255 "get_target_double_scalar_alignment");
257 return C_Get_Double_Scalar_Alignment
;
258 end Get_Double_Scalar_Alignment
;
260 ------------------------------
261 -- Get_Back_End_Config_File --
262 ------------------------------
264 function Get_Back_End_Config_File
return String_Ptr
is
267 end Get_Back_End_Config_File
;
269 ----------------------
270 -- Digits_From_Size --
271 ----------------------
273 function Digits_From_Size
(Size
: Pos
) return Pos
is
278 when 64 => return 15;
279 when 96 => return 18;
280 when 128 => return 18;
281 when others => raise Program_Error
;
283 end Digits_From_Size
;
285 -----------------------------
286 -- Get_Max_Unaligned_Field --
287 -----------------------------
289 function Get_Max_Unaligned_Field
return Pos
is
291 return 64; -- Can be different on some targets (e.g., AAMP)
292 end Get_Max_Unaligned_Field
;
294 -----------------------------
295 -- Register_Back_End_Types --
296 -----------------------------
298 procedure Register_Back_End_Types
(Call_Back
: Register_Type_Proc
) is
299 procedure Enumerate_Modes
(Call_Back
: Register_Type_Proc
);
300 pragma Import
(C
, Enumerate_Modes
, "enumerate_modes");
302 Enumerate_Modes
(Call_Back
);
303 end Register_Back_End_Types
;
305 ---------------------
306 -- Width_From_Size --
307 ---------------------
309 function Width_From_Size
(Size
: Pos
) return Pos
is
314 when 32 => return 11;
315 when 64 => return 21;
316 when others => raise Program_Error
;