]>
Commit | Line | Data |
---|---|---|
38cbfe40 RK |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3 | -- GNAT COMPILER COMPONENTS -- | |
4 | -- -- | |
5 | -- G E T _ T A R G -- | |
6 | -- -- | |
7 | -- S p e c -- | |
8 | -- -- | |
4b490c1e | 9 | -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- |
38cbfe40 RK |
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- -- | |
b5c84c3c | 13 | -- ware Foundation; either version 3, or (at your option) any later ver- -- |
38cbfe40 RK |
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 -- | |
b5c84c3c RD |
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. -- | |
38cbfe40 RK |
20 | -- -- |
21 | -- GNAT was originally developed by the GNAT team at New York University. -- | |
71ff80dc | 22 | -- Extensive contributions were provided by Ada Core Technologies Inc. -- |
38cbfe40 RK |
23 | -- -- |
24 | ------------------------------------------------------------------------------ | |
25 | ||
26 | -- This package provides an Import to the C functions which provide | |
bcea76b6 | 27 | -- values related to types on the target system. It is only needed for |
289a994b AC |
28 | -- exp_dbug and the elaboration of ttypes, via the Set_Targs package. |
29 | -- It also contains the routine for registering floating-point types. | |
38cbfe40 | 30 | |
00c5acd3 EB |
31 | -- NOTE: Any changes in this package must be reflected in aa_getta.adb |
32 | -- and any other version in the various back ends. | |
38cbfe40 RK |
33 | |
34 | -- Note that all these values return sizes of C types with corresponding | |
35 | -- names. This allows GNAT to define the corresponding Ada types to have | |
289a994b AC |
36 | -- the same representation. There is one exception to this general rule: |
37 | -- the Wide_Character_Type uses twice the size of a C char, instead of the | |
38cbfe40 RK |
38 | -- size of wchar_t. |
39 | ||
289a994b | 40 | with Einfo; use Einfo; |
38cbfe40 RK |
41 | with Types; use Types; |
42 | ||
43 | package Get_Targ is | |
38cbfe40 | 44 | |
289a994b | 45 | -- Functions returning individual runtime values |
38cbfe40 | 46 | |
289a994b AC |
47 | function Get_Bits_Per_Unit return Pos; |
48 | -- System.Storage_Unit | |
38cbfe40 | 49 | |
289a994b AC |
50 | function Get_Bits_Per_Word return Pos; |
51 | -- System.Word_Size | |
38cbfe40 | 52 | |
289a994b AC |
53 | function Get_Char_Size return Pos; |
54 | -- Size of Standard.Character | |
38cbfe40 | 55 | |
289a994b AC |
56 | function Get_Wchar_T_Size return Pos; |
57 | -- Size of Interfaces.C.wchar_t | |
38cbfe40 | 58 | |
289a994b AC |
59 | function Get_Short_Size return Pos; |
60 | -- Size of Standard.Short_Integer | |
38cbfe40 | 61 | |
289a994b AC |
62 | function Get_Int_Size return Pos; |
63 | -- Size of Standard.Integer | |
38cbfe40 | 64 | |
289a994b AC |
65 | function Get_Long_Size return Pos; |
66 | -- Size of Standard.Long_Integer | |
38cbfe40 | 67 | |
289a994b AC |
68 | function Get_Long_Long_Size return Pos; |
69 | -- Size of Standard.Long_Long_Integer | |
38cbfe40 | 70 | |
289a994b AC |
71 | function Get_Pointer_Size return Pos; |
72 | -- Size of System.Address | |
38cbfe40 | 73 | |
289a994b AC |
74 | function Get_Maximum_Alignment return Pos; |
75 | -- Maximum supported alignment | |
38cbfe40 | 76 | |
289a994b AC |
77 | function Get_Float_Words_BE return Nat; |
78 | -- Non-zero iff float words big endian | |
38cbfe40 | 79 | |
289a994b AC |
80 | function Get_Words_BE return Nat; |
81 | -- Non-zero iff integer words big endian | |
38cbfe40 | 82 | |
289a994b AC |
83 | function Get_Bytes_BE return Nat; |
84 | -- Non-zero iff bytes big-endian | |
38cbfe40 | 85 | |
289a994b AC |
86 | function Get_Bits_BE return Nat; |
87 | -- Non-zero iff bit order big endian | |
88 | ||
89 | function Get_Strict_Alignment return Nat; | |
90 | -- Non-zero if target requires strict alignent | |
caa9d12a | 91 | |
c5ecd6b7 | 92 | function Get_System_Allocator_Alignment return Nat; |
289a994b AC |
93 | -- Alignment guaranteed by malloc falls |
94 | ||
95 | function Get_Double_Float_Alignment return Nat; | |
a96157e6 | 96 | -- Alignment required for Long_Float or 0 if no special requirement |
c5ecd6b7 | 97 | |
289a994b | 98 | function Get_Double_Scalar_Alignment return Nat; |
a96157e6 AC |
99 | -- Alignment required for Long_Long_Integer or larger integer types |
100 | -- or 0 if no special requirement. | |
caa9d12a | 101 | |
f27ad2b2 RD |
102 | function Get_Short_Enums return Int; |
103 | -- Returns non-zero if we are in short enums mode, where foreign convention | |
104 | -- (in particular C and C++) enumeration types will be sized as in Ada, | |
105 | -- using the shortest possibility from 8,16,32 bits, signed or unsigned. | |
106 | -- A zero value means Short_Enums are not in use, and in this case all | |
107 | -- foreign convention enumeration types are given the same size as c int. | |
108 | ||
289a994b | 109 | -- Other subprograms |
38cbfe40 | 110 | |
bcea76b6 GB |
111 | function Get_Max_Unaligned_Field return Pos; |
112 | -- Returns the maximum supported size in bits for a field that is | |
113 | -- not aligned on a storage unit boundary. | |
114 | ||
38cbfe40 RK |
115 | function Width_From_Size (Size : Pos) return Pos; |
116 | function Digits_From_Size (Size : Pos) return Pos; | |
117 | -- Calculate values for 'Width or 'Digits from 'Size | |
118 | ||
289a994b AC |
119 | type C_String is array (0 .. 255) of aliased Character; |
120 | pragma Convention (C, C_String); | |
121 | ||
122 | type Register_Type_Proc is access procedure | |
123 | (C_Name : C_String; -- Nul-terminated string with name of type | |
124 | Digs : Natural; -- Digits for floating point, 0 otherwise | |
125 | Complex : Boolean; -- True iff type has real and imaginary parts | |
126 | Count : Natural; -- Number of elements in vector, 0 otherwise | |
127 | Float_Rep : Float_Rep_Kind; -- Representation used for fpt type | |
00c5acd3 | 128 | Precision : Positive; -- Precision of representation in bits |
289a994b AC |
129 | Size : Positive; -- Size of representation in bits |
130 | Alignment : Natural); -- Required alignment in bits | |
131 | pragma Convention (C, Register_Type_Proc); | |
132 | -- Call back procedure for Register_Back_End_Types. This is to be used by | |
133 | -- Create_Standard to create predefined types for all types supported by | |
134 | -- the back end. | |
135 | ||
136 | procedure Register_Back_End_Types (Call_Back : Register_Type_Proc); | |
137 | -- Calls the Call_Back function with information for each supported type | |
138 | ||
1ebc2612 | 139 | function Get_Back_End_Config_File return String_Ptr; |
a18e3d62 AC |
140 | -- Return the back end configuration file, or null if none. If non-null, |
141 | -- this file should be used instead of calling the various Get_xxx | |
142 | -- functions in this package. | |
1ebc2612 | 143 | |
38cbfe40 | 144 | end Get_Targ; |