annotate gcc/ada/get_targ.ads @ 115:4cb7a319550d

fix c-parser.c
author mir3636
date Tue, 28 Nov 2017 19:31:15 +0900
parents 04ced10e8804
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- G E T _ T A R G --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- This package provides an Import to the C functions which provide
kono
parents:
diff changeset
27 -- values related to types on the target system. It is only needed for
kono
parents:
diff changeset
28 -- exp_dbug and the elaboration of ttypes, via the Set_Targs package.
kono
parents:
diff changeset
29 -- It also contains the routine for registering floating-point types.
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 -- NOTE: Any changes in this package must be reflected in aa_getta.adb
kono
parents:
diff changeset
32 -- and any other version in the various back ends.
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 -- Note that all these values return sizes of C types with corresponding
kono
parents:
diff changeset
35 -- names. This allows GNAT to define the corresponding Ada types to have
kono
parents:
diff changeset
36 -- the same representation. There is one exception to this general rule:
kono
parents:
diff changeset
37 -- the Wide_Character_Type uses twice the size of a C char, instead of the
kono
parents:
diff changeset
38 -- size of wchar_t.
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 with Einfo; use Einfo;
kono
parents:
diff changeset
41 with Types; use Types;
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 package Get_Targ is
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 -- Functions returning individual runtime values
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 function Get_Bits_Per_Unit return Pos;
kono
parents:
diff changeset
48 -- System.Storage_Unit
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 function Get_Bits_Per_Word return Pos;
kono
parents:
diff changeset
51 -- System.Word_Size
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 function Get_Char_Size return Pos;
kono
parents:
diff changeset
54 -- Size of Standard.Character
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 function Get_Wchar_T_Size return Pos;
kono
parents:
diff changeset
57 -- Size of Interfaces.C.wchar_t
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 function Get_Short_Size return Pos;
kono
parents:
diff changeset
60 -- Size of Standard.Short_Integer
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 function Get_Int_Size return Pos;
kono
parents:
diff changeset
63 -- Size of Standard.Integer
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 function Get_Long_Size return Pos;
kono
parents:
diff changeset
66 -- Size of Standard.Long_Integer
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 function Get_Long_Long_Size return Pos;
kono
parents:
diff changeset
69 -- Size of Standard.Long_Long_Integer
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 function Get_Pointer_Size return Pos;
kono
parents:
diff changeset
72 -- Size of System.Address
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 function Get_Maximum_Alignment return Pos;
kono
parents:
diff changeset
75 -- Maximum supported alignment
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 function Get_Float_Words_BE return Nat;
kono
parents:
diff changeset
78 -- Non-zero iff float words big endian
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 function Get_Words_BE return Nat;
kono
parents:
diff changeset
81 -- Non-zero iff integer words big endian
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 function Get_Bytes_BE return Nat;
kono
parents:
diff changeset
84 -- Non-zero iff bytes big-endian
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 function Get_Bits_BE return Nat;
kono
parents:
diff changeset
87 -- Non-zero iff bit order big endian
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 function Get_Strict_Alignment return Nat;
kono
parents:
diff changeset
90 -- Non-zero if target requires strict alignent
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 function Get_System_Allocator_Alignment return Nat;
kono
parents:
diff changeset
93 -- Alignment guaranteed by malloc falls
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 function Get_Double_Float_Alignment return Nat;
kono
parents:
diff changeset
96 -- Alignment required for Long_Float or 0 if no special requirement
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 function Get_Double_Scalar_Alignment return Nat;
kono
parents:
diff changeset
99 -- Alignment required for Long_Long_Integer or larger integer types
kono
parents:
diff changeset
100 -- or 0 if no special requirement.
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 function Get_Short_Enums return Int;
kono
parents:
diff changeset
103 -- Returns non-zero if we are in short enums mode, where foreign convention
kono
parents:
diff changeset
104 -- (in particular C and C++) enumeration types will be sized as in Ada,
kono
parents:
diff changeset
105 -- using the shortest possibility from 8,16,32 bits, signed or unsigned.
kono
parents:
diff changeset
106 -- A zero value means Short_Enums are not in use, and in this case all
kono
parents:
diff changeset
107 -- foreign convention enumeration types are given the same size as c int.
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 -- Other subprograms
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 function Get_Max_Unaligned_Field return Pos;
kono
parents:
diff changeset
112 -- Returns the maximum supported size in bits for a field that is
kono
parents:
diff changeset
113 -- not aligned on a storage unit boundary.
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 function Width_From_Size (Size : Pos) return Pos;
kono
parents:
diff changeset
116 function Digits_From_Size (Size : Pos) return Pos;
kono
parents:
diff changeset
117 -- Calculate values for 'Width or 'Digits from 'Size
kono
parents:
diff changeset
118
kono
parents:
diff changeset
119 type C_String is array (0 .. 255) of aliased Character;
kono
parents:
diff changeset
120 pragma Convention (C, C_String);
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 type Register_Type_Proc is access procedure
kono
parents:
diff changeset
123 (C_Name : C_String; -- Nul-terminated string with name of type
kono
parents:
diff changeset
124 Digs : Natural; -- Digits for floating point, 0 otherwise
kono
parents:
diff changeset
125 Complex : Boolean; -- True iff type has real and imaginary parts
kono
parents:
diff changeset
126 Count : Natural; -- Number of elements in vector, 0 otherwise
kono
parents:
diff changeset
127 Float_Rep : Float_Rep_Kind; -- Representation used for fpt type
kono
parents:
diff changeset
128 Precision : Positive; -- Precision of representation in bits
kono
parents:
diff changeset
129 Size : Positive; -- Size of representation in bits
kono
parents:
diff changeset
130 Alignment : Natural); -- Required alignment in bits
kono
parents:
diff changeset
131 pragma Convention (C, Register_Type_Proc);
kono
parents:
diff changeset
132 -- Call back procedure for Register_Back_End_Types. This is to be used by
kono
parents:
diff changeset
133 -- Create_Standard to create predefined types for all types supported by
kono
parents:
diff changeset
134 -- the back end.
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136 procedure Register_Back_End_Types (Call_Back : Register_Type_Proc);
kono
parents:
diff changeset
137 -- Calls the Call_Back function with information for each supported type
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 function Get_Back_End_Config_File return String_Ptr;
kono
parents:
diff changeset
140 -- Return the back end configuration file, or null if none. If non-null,
kono
parents:
diff changeset
141 -- this file should be used instead of calling the various Get_xxx
kono
parents:
diff changeset
142 -- functions in this package.
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 end Get_Targ;