1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2013, 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 package body Get_Targ
is
28 -- Functions returning individual runtime. For the standard (GCC) back
29 -- end these come from C interface functions (one for each value).
31 -----------------------
32 -- Get_Bits_Per_Unit --
33 -----------------------
35 function Get_Bits_Per_Unit
return Pos
is
36 function C_Get_Bits_Per_Unit
return Pos
;
37 pragma Import
(C
, C_Get_Bits_Per_Unit
,
38 "get_target_bits_per_unit");
40 return C_Get_Bits_Per_Unit
;
41 end Get_Bits_Per_Unit
;
43 -----------------------
44 -- Get_Bits_Per_Word --
45 -----------------------
47 function Get_Bits_Per_Word
return Pos
is
48 function C_Get_Bits_Per_Word
return Pos
;
49 pragma Import
(C
, C_Get_Bits_Per_Word
,
50 "get_target_bits_per_word");
52 return C_Get_Bits_Per_Word
;
53 end Get_Bits_Per_Word
;
59 function Get_Char_Size
return Pos
is
60 function C_Get_Char_Size
return Pos
;
61 pragma Import
(C
, C_Get_Char_Size
,
62 "get_target_char_size");
64 return C_Get_Char_Size
;
67 ----------------------
68 -- Get_Wchar_T_Size --
69 ----------------------
71 function Get_Wchar_T_Size
return Pos
is
72 function C_Get_Wchar_T_Size
return Pos
;
73 pragma Import
(C
, C_Get_Wchar_T_Size
,
74 "get_target_wchar_t_size");
76 return C_Get_Wchar_T_Size
;
83 function Get_Short_Size
return Pos
is
84 function C_Get_Short_Size
return Pos
;
85 pragma Import
(C
, C_Get_Short_Size
,
86 "get_target_short_size");
88 return C_Get_Short_Size
;
95 function Get_Int_Size
return Pos
is
96 function C_Get_Int_Size
return Pos
;
97 pragma Import
(C
, C_Get_Int_Size
,
98 "get_target_int_size");
100 return C_Get_Int_Size
;
107 function Get_Long_Size
return Pos
is
108 function C_Get_Long_Size
return Pos
;
109 pragma Import
(C
, C_Get_Long_Size
,
110 "get_target_long_size");
112 return C_Get_Long_Size
;
115 ------------------------
116 -- Get_Long_Long_Size --
117 ------------------------
119 function Get_Long_Long_Size
return Pos
is
120 function C_Get_Long_Long_Size
return Pos
;
121 pragma Import
(C
, C_Get_Long_Long_Size
,
122 "get_target_long_long_size");
124 return C_Get_Long_Long_Size
;
125 end Get_Long_Long_Size
;
131 function Get_Float_Size
return Pos
is
132 function C_Get_Float_Size
return Pos
;
133 pragma Import
(C
, C_Get_Float_Size
,
134 "get_target_float_size");
136 return C_Get_Float_Size
;
139 ---------------------
140 -- Get_Double_Size --
141 ---------------------
143 function Get_Double_Size
return Pos
is
144 function C_Get_Double_Size
return Pos
;
145 pragma Import
(C
, C_Get_Double_Size
,
146 "get_target_double_size");
148 return C_Get_Double_Size
;
151 --------------------------
152 -- Get_Long_Double_Size --
153 --------------------------
155 function Get_Long_Double_Size
return Pos
is
156 function C_Get_Long_Double_Size
return Pos
;
157 pragma Import
(C
, C_Get_Long_Double_Size
,
158 "get_target_long_double_size");
160 return C_Get_Long_Double_Size
;
161 end Get_Long_Double_Size
;
163 ----------------------
164 -- Get_Pointer_Size --
165 ----------------------
167 function Get_Pointer_Size
return Pos
is
168 function C_Get_Pointer_Size
return Pos
;
169 pragma Import
(C
, C_Get_Pointer_Size
,
170 "get_target_pointer_size");
172 return C_Get_Pointer_Size
;
173 end Get_Pointer_Size
;
175 ---------------------------
176 -- Get_Maximum_Alignment --
177 ---------------------------
179 function Get_Maximum_Alignment
return Pos
is
180 function C_Get_Maximum_Alignment
return Pos
;
181 pragma Import
(C
, C_Get_Maximum_Alignment
,
182 "get_target_maximum_alignment");
184 return C_Get_Maximum_Alignment
;
185 end Get_Maximum_Alignment
;
187 ------------------------
188 -- Get_Float_Words_BE --
189 ------------------------
191 function Get_Float_Words_BE
return Nat
is
192 function C_Get_Float_Words_BE
return Nat
;
193 pragma Import
(C
, C_Get_Float_Words_BE
,
194 "get_float_words_be");
196 return C_Get_Float_Words_BE
;
197 end Get_Float_Words_BE
;
203 function Get_Words_BE
return Nat
is
204 function C_Get_Words_BE
return Nat
;
205 pragma Import
(C
, C_Get_Words_BE
,
208 return C_Get_Words_BE
;
215 function Get_Bytes_BE
return Nat
is
216 function C_Get_Bytes_BE
return Nat
;
217 pragma Import
(C
, C_Get_Bytes_BE
,
220 return C_Get_Bytes_BE
;
227 function Get_Bits_BE
return Nat
is
228 function C_Get_Bits_BE
return Nat
;
229 pragma Import
(C
, C_Get_Bits_BE
,
232 return C_Get_Bits_BE
;
235 --------------------------
236 -- Get_Strict_Alignment --
237 --------------------------
239 function Get_Strict_Alignment
return Nat
is
240 function C_Get_Strict_Alignment
return Nat
;
241 pragma Import
(C
, C_Get_Strict_Alignment
,
242 "get_target_strict_alignment");
244 return C_Get_Strict_Alignment
;
245 end Get_Strict_Alignment
;
247 ------------------------------------
248 -- Get_System_Allocator_Alignment --
249 ------------------------------------
251 function Get_System_Allocator_Alignment
return Nat
is
252 function C_Get_System_Allocator_Alignment
return Nat
;
253 pragma Import
(C
, C_Get_System_Allocator_Alignment
,
254 "get_target_system_allocator_alignment");
256 return C_Get_System_Allocator_Alignment
;
257 end Get_System_Allocator_Alignment
;
259 --------------------------------
260 -- Get_Double_Float_Alignment --
261 --------------------------------
263 function Get_Double_Float_Alignment
return Nat
is
264 function C_Get_Double_Float_Alignment
return Nat
;
265 pragma Import
(C
, C_Get_Double_Float_Alignment
,
266 "get_target_double_float_alignment");
268 return C_Get_Double_Float_Alignment
;
269 end Get_Double_Float_Alignment
;
271 ---------------------------------
272 -- Get_Double_Scalar_Alignment --
273 ---------------------------------
275 function Get_Double_Scalar_Alignment
return Nat
is
276 function C_Get_Double_Scalar_Alignment
return Nat
;
277 pragma Import
(C
, C_Get_Double_Scalar_Alignment
,
278 "get_target_double_scalar_alignment");
280 return C_Get_Double_Scalar_Alignment
;
281 end Get_Double_Scalar_Alignment
;
283 ----------------------
284 -- Digits_From_Size --
285 ----------------------
287 function Digits_From_Size
(Size
: Pos
) return Pos
is
297 elsif Size
= 128 then
302 end Digits_From_Size
;
304 -----------------------------
305 -- Get_Max_Unaligned_Field --
306 -----------------------------
308 function Get_Max_Unaligned_Field
return Pos
is
310 return 64; -- Can be different on some targets (e.g., AAMP)
311 end Get_Max_Unaligned_Field
;
313 -----------------------------
314 -- Register_Back_End_Types --
315 -----------------------------
317 procedure Register_Back_End_Types
(Call_Back
: Register_Type_Proc
) is
318 procedure Enumerate_Modes
(Call_Back
: Register_Type_Proc
);
319 pragma Import
(C
, Enumerate_Modes
, "enumerate_modes");
321 Enumerate_Modes
(Call_Back
);
322 end Register_Back_End_Types
;
324 ---------------------
325 -- Width_From_Size --
326 ---------------------
328 function Width_From_Size
(Size
: Pos
) return Pos
is