| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT COMPILER COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- G E T _ T A R G -- |
| 6 |
-- -- |
| 7 |
-- B o d y -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 1992-2025, Free Software Foundation, Inc. -- |
| 10 |
-- -- |
| 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. -- |
| 20 |
-- -- |
| 21 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 22 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 23 |
-- -- |
| 24 |
------------------------------------------------------------------------------ |
| 25 |
|
| 26 |
-- Version for use with GCC |
| 27 |
|
| 28 |
package body Get_Targ is |
| 29 |
|
| 30 |
-- Functions returning individual run-time values. For the standard (GCC) |
| 31 |
-- back end, these come from C interface functions (one for each value). |
| 32 |
|
| 33 |
----------------------- |
| 34 |
-- Get_Bits_Per_Unit -- |
| 35 |
----------------------- |
| 36 |
|
| 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"); |
| 41 |
begin |
| 42 |
return C_Get_Bits_Per_Unit; |
| 43 |
end Get_Bits_Per_Unit; |
| 44 |
|
| 45 |
----------------------- |
| 46 |
-- Get_Bits_Per_Word -- |
| 47 |
----------------------- |
| 48 |
|
| 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"); |
| 53 |
begin |
| 54 |
return C_Get_Bits_Per_Word; |
| 55 |
end Get_Bits_Per_Word; |
| 56 |
|
| 57 |
------------------- |
| 58 |
-- Get_Char_Size -- |
| 59 |
------------------- |
| 60 |
|
| 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"); |
| 65 |
begin |
| 66 |
return C_Get_Char_Size; |
| 67 |
end Get_Char_Size; |
| 68 |
|
| 69 |
---------------------- |
| 70 |
-- Get_Wchar_T_Size -- |
| 71 |
---------------------- |
| 72 |
|
| 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"); |
| 77 |
begin |
| 78 |
return C_Get_Wchar_T_Size; |
| 79 |
end Get_Wchar_T_Size; |
| 80 |
|
| 81 |
-------------------- |
| 82 |
-- Get_Short_Size -- |
| 83 |
-------------------- |
| 84 |
|
| 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"); |
| 89 |
begin |
| 90 |
return C_Get_Short_Size; |
| 91 |
end Get_Short_Size; |
| 92 |
|
| 93 |
------------------ |
| 94 |
-- Get_Int_Size -- |
| 95 |
------------------ |
| 96 |
|
| 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"); |
| 101 |
begin |
| 102 |
return C_Get_Int_Size; |
| 103 |
end Get_Int_Size; |
| 104 |
|
| 105 |
------------------- |
| 106 |
-- Get_Long_Size -- |
| 107 |
------------------- |
| 108 |
|
| 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"); |
| 113 |
begin |
| 114 |
return C_Get_Long_Size; |
| 115 |
end Get_Long_Size; |
| 116 |
|
| 117 |
------------------------ |
| 118 |
-- Get_Long_Long_Size -- |
| 119 |
------------------------ |
| 120 |
|
| 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"); |
| 125 |
begin |
| 126 |
return C_Get_Long_Long_Size; |
| 127 |
end Get_Long_Long_Size; |
| 128 |
|
| 129 |
----------------------------- |
| 130 |
-- Get_Long_Long_Long_Size -- |
| 131 |
----------------------------- |
| 132 |
|
| 133 |
function Get_Long_Long_Long_Size return Pos is |
| 134 |
function C_Get_Long_Long_Long_Size return Pos; |
| 135 |
pragma Import (C, C_Get_Long_Long_Long_Size, |
| 136 |
"get_target_long_long_long_size"); |
| 137 |
begin |
| 138 |
return C_Get_Long_Long_Long_Size; |
| 139 |
end Get_Long_Long_Long_Size; |
| 140 |
|
| 141 |
---------------------- |
| 142 |
-- Get_Pointer_Size -- |
| 143 |
---------------------- |
| 144 |
|
| 145 |
function Get_Pointer_Size return Pos is |
| 146 |
function C_Get_Pointer_Size return Pos; |
| 147 |
pragma Import (C, C_Get_Pointer_Size, |
| 148 |
"get_target_pointer_size"); |
| 149 |
begin |
| 150 |
return C_Get_Pointer_Size; |
| 151 |
end Get_Pointer_Size; |
| 152 |
|
| 153 |
--------------------------- |
| 154 |
-- Get_Maximum_Alignment -- |
| 155 |
--------------------------- |
| 156 |
|
| 157 |
function Get_Maximum_Alignment return Pos is |
| 158 |
function C_Get_Maximum_Alignment return Pos; |
| 159 |
pragma Import (C, C_Get_Maximum_Alignment, |
| 160 |
"get_target_maximum_alignment"); |
| 161 |
begin |
| 162 |
return C_Get_Maximum_Alignment; |
| 163 |
end Get_Maximum_Alignment; |
| 164 |
|
| 165 |
------------------------ |
| 166 |
-- Get_Float_Words_BE -- |
| 167 |
------------------------ |
| 168 |
|
| 169 |
function Get_Float_Words_BE return Nat is |
| 170 |
function C_Get_Float_Words_BE return Nat; |
| 171 |
pragma Import (C, C_Get_Float_Words_BE, |
| 172 |
"get_target_float_words_be"); |
| 173 |
begin |
| 174 |
return C_Get_Float_Words_BE; |
| 175 |
end Get_Float_Words_BE; |
| 176 |
|
| 177 |
------------------ |
| 178 |
-- Get_Words_BE -- |
| 179 |
------------------ |
| 180 |
|
| 181 |
function Get_Words_BE return Nat is |
| 182 |
function C_Get_Words_BE return Nat; |
| 183 |
pragma Import (C, C_Get_Words_BE, |
| 184 |
"get_target_words_be"); |
| 185 |
begin |
| 186 |
return C_Get_Words_BE; |
| 187 |
end Get_Words_BE; |
| 188 |
|
| 189 |
------------------ |
| 190 |
-- Get_Bytes_BE -- |
| 191 |
------------------ |
| 192 |
|
| 193 |
function Get_Bytes_BE return Nat is |
| 194 |
function C_Get_Bytes_BE return Nat; |
| 195 |
pragma Import (C, C_Get_Bytes_BE, |
| 196 |
"get_target_bytes_be"); |
| 197 |
begin |
| 198 |
return C_Get_Bytes_BE; |
| 199 |
end Get_Bytes_BE; |
| 200 |
|
| 201 |
----------------- |
| 202 |
-- Get_Bits_BE -- |
| 203 |
----------------- |
| 204 |
|
| 205 |
function Get_Bits_BE return Nat is |
| 206 |
function C_Get_Bits_BE return Nat; |
| 207 |
pragma Import (C, C_Get_Bits_BE, |
| 208 |
"get_target_bits_be"); |
| 209 |
begin |
| 210 |
return C_Get_Bits_BE; |
| 211 |
end Get_Bits_BE; |
| 212 |
|
| 213 |
--------------------- |
| 214 |
-- Get_Short_Enums -- |
| 215 |
--------------------- |
| 216 |
|
| 217 |
function Get_Short_Enums return Int is |
| 218 |
flag_short_enums : Int; |
| 219 |
pragma Import (C, flag_short_enums); |
| 220 |
begin |
| 221 |
return flag_short_enums; |
| 222 |
end Get_Short_Enums; |
| 223 |
|
| 224 |
-------------------------- |
| 225 |
-- Get_Strict_Alignment -- |
| 226 |
-------------------------- |
| 227 |
|
| 228 |
function Get_Strict_Alignment return Nat is |
| 229 |
function C_Get_Strict_Alignment return Nat; |
| 230 |
pragma Import (C, C_Get_Strict_Alignment, |
| 231 |
"get_target_strict_alignment"); |
| 232 |
begin |
| 233 |
return C_Get_Strict_Alignment; |
| 234 |
end Get_Strict_Alignment; |
| 235 |
|
| 236 |
------------------------------------ |
| 237 |
-- Get_System_Allocator_Alignment -- |
| 238 |
------------------------------------ |
| 239 |
|
| 240 |
function Get_System_Allocator_Alignment return Nat is |
| 241 |
function C_Get_System_Allocator_Alignment return Nat; |
| 242 |
pragma Import (C, C_Get_System_Allocator_Alignment, |
| 243 |
"get_target_system_allocator_alignment"); |
| 244 |
begin |
| 245 |
return C_Get_System_Allocator_Alignment; |
| 246 |
end Get_System_Allocator_Alignment; |
| 247 |
|
| 248 |
-------------------------------- |
| 249 |
-- Get_Double_Float_Alignment -- |
| 250 |
-------------------------------- |
| 251 |
|
| 252 |
function Get_Double_Float_Alignment return Nat is |
| 253 |
function C_Get_Double_Float_Alignment return Nat; |
| 254 |
pragma Import (C, C_Get_Double_Float_Alignment, |
| 255 |
"get_target_double_float_alignment"); |
| 256 |
begin |
| 257 |
return C_Get_Double_Float_Alignment; |
| 258 |
end Get_Double_Float_Alignment; |
| 259 |
|
| 260 |
--------------------------------- |
| 261 |
-- Get_Double_Scalar_Alignment -- |
| 262 |
--------------------------------- |
| 263 |
|
| 264 |
function Get_Double_Scalar_Alignment return Nat is |
| 265 |
function C_Get_Double_Scalar_Alignment return Nat; |
| 266 |
pragma Import (C, C_Get_Double_Scalar_Alignment, |
| 267 |
"get_target_double_scalar_alignment"); |
| 268 |
begin |
| 269 |
return C_Get_Double_Scalar_Alignment; |
| 270 |
end Get_Double_Scalar_Alignment; |
| 271 |
|
| 272 |
------------------------------ |
| 273 |
-- Get_Back_End_Config_File -- |
| 274 |
------------------------------ |
| 275 |
|
| 276 |
function Get_Back_End_Config_File return String_Ptr is |
| 277 |
begin |
| 278 |
return null; |
| 279 |
end Get_Back_End_Config_File; |
| 280 |
|
| 281 |
----------------------------- |
| 282 |
-- Register_Back_End_Types -- |
| 283 |
----------------------------- |
| 284 |
|
| 285 |
procedure Register_Back_End_Types (Call_Back : Register_Type_Proc) is |
| 286 |
procedure Enumerate_Modes (Call_Back : Register_Type_Proc); |
| 287 |
pragma Import (C, Enumerate_Modes, "enumerate_modes"); |
| 288 |
begin |
| 289 |
Enumerate_Modes (Call_Back); |
| 290 |
end Register_Back_End_Types; |
| 291 |
|
| 292 |
end Get_Targ; |