cfgloopmanip.c (copy_loop_info): New function.
[official-gcc.git] / gcc / ada / ttypes.ads
blobef57187c6b2c090ebd3a2a79771acceb0aaf1734
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- T T Y P E S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2011, 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 ------------------------------------------------------------------------------
26 -- This package contains constants describing target properties
28 with Types; use Types;
29 with Get_Targ; use Get_Targ;
31 package Ttypes is
33 ------------------------------
34 -- Host/Target Dependencies --
35 ------------------------------
37 -- It is vital to maintain a clear distinction between properties of
38 -- types on the host and types on the target, since in the general
39 -- case of a cross-compiler these will be different.
41 -- This package and its companion Ttypef provide definitions of values
42 -- that describe the properties of the target types. All instances of
43 -- target dependencies, including the definitions of such packages as
44 -- Standard and System depend directly or indirectly on the definitions
45 -- in the Ttypes and Ttypef packages.
47 -- In the source of the compiler, references to attributes such as
48 -- Integer'Size will give information regarding the host types (i.e.
49 -- the types within the compiler itself). Such references are therefore
50 -- almost always suspicious (it is hard for example to see that the
51 -- code in the compiler should even be using type Integer very much,
52 -- and certainly this code should not depend on the size of Integer).
54 -- On the other hand, it is perfectly reasonable for the compiler to
55 -- require access to the size of type Integer for the target machine,
56 -- e.g. in constructing the internal representation of package Standard.
57 -- For this purpose, instead of referencing the attribute Integer'Size,
58 -- a reference to Ttypes.Standard_Integer_Size will provide the needed
59 -- value for the target type.
61 -- Two approaches are used for handling target dependent values in the
62 -- standard library packages. Package Standard is handled specially,
63 -- being constructed internally (by package Stand). Target dependent
64 -- values needed in Stand are obtained by direct reference to Ttypes
65 -- and Ttypef.
67 -- For package System, the required constant values are obtained by
68 -- referencing appropriate attributes. Ada 95 already defines most of
69 -- the required attributes, and GNAT specific attributes have been
70 -- defined to cover the remaining cases (such as Storage_Unit). The
71 -- evaluation of these attributes obtains the required target dependent
72 -- values from Ttypes and Ttypef. The additional attributes that have
73 -- been added to GNAT (Address_Size, Storage_Unit, Word_Size, Max_Priority,
74 -- and Max_Interrupt_Priority) are for almost all purposes redundant with
75 -- respect to the corresponding references to System constants. For example
76 -- in a program, System.Address_Size and Standard'Address_Size yield the
77 -- same value. The critical use of the attribute is in writing the System
78 -- declaration of Address_Size which of course cannot refer to itself. By
79 -- this means we achieve complete target independence in the source code
80 -- of package System, i.e. there is only one copy of the source of System
81 -- for all targets.
83 -- Note that during compilation there are two versions of package System
84 -- around. The version that is directly with'ed by compiler packages
85 -- contains host-dependent definitions, which is what is needed in that
86 -- case (for example, System.Storage_Unit referenced in the source of the
87 -- compiler refers to the storage unit of the host, not the target). This
88 -- means that, like attribute references, any references to constants in
89 -- package System in the compiler code are suspicious, since it is strange
90 -- for the compiler to have such host dependencies. If the compiler needs
91 -- to access the target dependent values of such quantities as Storage_Unit
92 -- then it should reference the constants in this package (Ttypes), rather
93 -- than referencing System.Storage_Unit, or Standard'Storage_Unit, both of
94 -- which would yield the host value.
96 ---------------------------------------------------
97 -- Target-Dependent Values for Types in Standard --
98 ---------------------------------------------------
100 -- Note: GNAT always supplies all the following integer and float types,
101 -- but depending on the machine, some of the types may be identical. For
102 -- example, on some machines, Short_Float may be the same as Float, and
103 -- Long_Long_Float may be the same as Long_Float.
105 Standard_Short_Short_Integer_Size : constant Pos := Get_Char_Size;
106 Standard_Short_Short_Integer_Width : constant Pos :=
107 Width_From_Size
108 (Standard_Short_Short_Integer_Size);
110 Standard_Short_Integer_Size : constant Pos := Get_Short_Size;
111 Standard_Short_Integer_Width : constant Pos :=
112 Width_From_Size
113 (Standard_Short_Integer_Size);
115 Standard_Integer_Size : constant Pos := Get_Int_Size;
116 Standard_Integer_Width : constant Pos :=
117 Width_From_Size
118 (Standard_Integer_Size);
120 Standard_Long_Integer_Size : constant Pos := Get_Long_Size;
121 Standard_Long_Integer_Width : constant Pos :=
122 Width_From_Size
123 (Standard_Long_Integer_Size);
125 Standard_Long_Long_Integer_Size : constant Pos := Get_Long_Long_Size;
126 Standard_Long_Long_Integer_Width : constant Pos :=
127 Width_From_Size
128 (Standard_Long_Long_Integer_Size);
130 Standard_Short_Float_Size : constant Pos := Get_Float_Size;
131 Standard_Short_Float_Digits : constant Pos :=
132 Digits_From_Size
133 (Standard_Short_Float_Size);
135 Standard_Float_Size : constant Pos := Get_Float_Size;
136 Standard_Float_Digits : constant Pos :=
137 Digits_From_Size
138 (Standard_Float_Size);
140 Standard_Long_Float_Size : constant Pos := Get_Double_Size;
141 Standard_Long_Float_Digits : constant Pos :=
142 Digits_From_Size
143 (Standard_Long_Float_Size);
145 Standard_Long_Long_Float_Size : constant Pos := Get_Long_Double_Size;
146 Standard_Long_Long_Float_Digits : constant Pos :=
147 Digits_From_Size
148 (Standard_Long_Long_Float_Size);
150 Standard_Character_Size : constant Pos := Get_Char_Size;
152 Standard_Wide_Character_Size : constant Pos := 16;
153 Standard_Wide_Wide_Character_Size : constant Pos := 32;
154 -- Standard wide character sizes
156 -- Note: there is no specific control over the representation of
157 -- enumeration types. The convention used is that if an enumeration
158 -- type has fewer than 2**(Character'Size) elements, then the size
159 -- used is Character'Size, otherwise Integer'Size is used.
161 -- Similarly, the size of fixed-point types depends on the size of the
162 -- corresponding integer type, which is the smallest predefined integer
163 -- type capable of representing the required range of values.
165 -------------------------------------------------
166 -- Target-Dependent Values for Types in System --
167 -------------------------------------------------
169 System_Address_Size : constant Pos := Get_Pointer_Size;
170 -- System.Address'Size (also size of all thin pointers)
172 System_Max_Binary_Modulus_Power : constant Pos :=
173 Standard_Long_Long_Integer_Size;
175 System_Max_Nonbinary_Modulus_Power : constant Pos := Standard_Integer_Size;
177 System_Storage_Unit : constant Pos := Get_Bits_Per_Unit;
178 System_Word_Size : constant Pos := Get_Bits_Per_Word;
180 System_Tick_Nanoseconds : constant Pos := 1_000_000_000;
181 -- Value of System.Tick in nanoseconds. At the moment, this is a fixed
182 -- constant (with value of 1.0 seconds), but later we should add this
183 -- value to the GCC configuration file so that its value can be made
184 -- configuration dependent.
186 -----------------------------------------------------
187 -- Target-Dependent Values for Types in Interfaces --
188 -----------------------------------------------------
190 Interfaces_Wchar_T_Size : constant Pos := Get_Wchar_T_Size;
192 ----------------------------------------
193 -- Other Target-Dependent Definitions --
194 ----------------------------------------
196 Maximum_Alignment : constant Pos := Get_Maximum_Alignment;
197 -- The maximum alignment, in storage units, that an object or type may
198 -- require on the target machine.
200 System_Allocator_Alignment : constant Pos :=
201 Get_System_Allocator_Alignment;
202 -- The alignment in storage units of addresses returned by malloc
204 Max_Unaligned_Field : constant Pos := Get_Max_Unaligned_Field;
205 -- The maximum supported size in bits for a field that is not aligned
206 -- on a storage unit boundary.
208 Bytes_Big_Endian : Boolean := Get_Bytes_BE /= 0;
209 -- Important note: for Ada purposes, the important setting is the bytes
210 -- endianness (Bytes_Big_Endian), not the bits value (Bits_Big_Endian).
211 -- This is because Ada bit addressing must be compatible with the byte
212 -- ordering (otherwise we would end up with non-contiguous fields). It
213 -- is rare for the two to be different, but if they are, Bits_Big_Endian
214 -- is relevant only for the generation of instructions with bit numbers,
215 -- and thus relevant only to the back end. Note that this is a variable
216 -- rather than a constant, since it can be modified (flipped) by -gnatd8.
218 Target_Strict_Alignment : Boolean := Get_Strict_Alignment /= 0;
219 -- True if instructions will fail if data is misaligned
221 Target_Double_Float_Alignment : Nat := Get_Double_Float_Alignment;
222 -- The default alignment of "double" floating-point types, i.e. floating
223 -- point types whose size is equal to 64 bits, or 0 if this alignment is
224 -- not specifically capped.
226 Target_Double_Scalar_Alignment : Nat := Get_Double_Scalar_Alignment;
227 -- The default alignment of "double" or larger scalar types, i.e. scalar
228 -- types whose size is greater or equal to 64 bits, or 0 if this alignment
229 -- is not specifically capped.
231 end Ttypes;