sem_prag.adb (Analyze_Pragma): Add appropriate calls to Resolve_Suppressible in the...
[platform/upstream/gcc.git] / gcc / ada / s-unstyp.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                          GNAT RUN-TIME COMPONENTS                        --
4 --                                                                          --
5 --                S Y S T E M . U N S I G N E D _ T Y P E S                 --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2016, 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.                                     --
17 --                                                                          --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception,   --
20 -- version 3.1, as published by the Free Software Foundation.               --
21 --                                                                          --
22 -- You should have received a copy of the GNU General Public License and    --
23 -- a copy of the GCC Runtime Library Exception along with this program;     --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25 -- <http://www.gnu.org/licenses/>.                                          --
26 --                                                                          --
27 -- GNAT was originally developed  by the GNAT team at  New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
29 --                                                                          --
30 ------------------------------------------------------------------------------
31
32 --  This package contains definitions of standard unsigned types that
33 --  correspond in size to the standard signed types declared in Standard,
34 --  and (unlike the types in Interfaces) have corresponding names. It
35 --  also contains some related definitions for other specialized types
36 --  used by the compiler in connection with packed array types.
37
38 pragma Compiler_Unit_Warning;
39
40 package System.Unsigned_Types is
41    pragma Pure;
42    pragma No_Elaboration_Code_All;
43
44    type Short_Short_Unsigned is mod 2 ** Short_Short_Integer'Size;
45    type Short_Unsigned       is mod 2 ** Short_Integer'Size;
46    type Unsigned             is mod 2 ** Integer'Size;
47    type Long_Unsigned        is mod 2 ** Long_Integer'Size;
48    type Long_Long_Unsigned   is mod 2 ** Long_Long_Integer'Size;
49
50    type Float_Unsigned       is mod 2 ** Float'Size;
51    --  Used in the implementation of Is_Negative intrinsic (see Exp_Intr)
52
53    type Packed_Byte is mod 2 ** 8;
54    pragma Universal_Aliasing (Packed_Byte);
55    for Packed_Byte'Size use 8;
56    --  Component type for Packed_Bytes1, Packed_Bytes2 and Packed_Byte4 arrays.
57    --  As this type is used by the compiler to implement operations on user
58    --  packed array, it needs to be able to alias any type.
59
60    type Packed_Bytes1 is array (Natural range <>) of aliased Packed_Byte;
61    for Packed_Bytes1'Alignment use 1;
62    for Packed_Bytes1'Component_Size use Packed_Byte'Size;
63    pragma Suppress_Initialization (Packed_Bytes1);
64    --  This is the type used to implement packed arrays where no alignment
65    --  is required. This includes the cases of 1,2,4 (where we use direct
66    --  masking operations), and all odd component sizes (where the clusters
67    --  are not aligned anyway, see, e.g. System.Pack_07 in file s-pack07
68    --  for details.
69
70    type Packed_Bytes2 is new Packed_Bytes1;
71    for Packed_Bytes2'Alignment use Integer'Min (2, Standard'Maximum_Alignment);
72    pragma Suppress_Initialization (Packed_Bytes2);
73    --  This is the type used to implement packed arrays where an alignment
74    --  of 2 (is possible) is helpful for maximum efficiency of the get and
75    --  set routines in the corresponding library unit. This is true of all
76    --  component sizes that are even but not divisible by 4 (other than 2 for
77    --  which we use direct masking operations). In such cases, the clusters
78    --  can be assumed to be 2-byte aligned if the array is aligned. See for
79    --  example System.Pack_10 in file s-pack10).
80
81    type Packed_Bytes4 is new Packed_Bytes1;
82    for Packed_Bytes4'Alignment use Integer'Min (4, Standard'Maximum_Alignment);
83    pragma Suppress_Initialization (Packed_Bytes4);
84    --  This is the type used to implement packed arrays where an alignment
85    --  of 4 (if possible) is helpful for maximum efficiency of the get and
86    --  set routines in the corresponding library unit. This is true of all
87    --  component sizes that are divisible by 4 (other than powers of 2, which
88    --  are either handled by direct masking or not packed at all). In such
89    --  cases the clusters can be assumed to be 4-byte aligned if the array
90    --  is aligned (see System.Pack_12 in file s-pack12 as an example).
91
92    type Bits_1 is mod 2**1;
93    type Bits_2 is mod 2**2;
94    type Bits_4 is mod 2**4;
95    --  Types used for packed array conversions
96
97    subtype Bytes_F is Packed_Bytes4 (1 .. Float'Size / 8);
98    --  Type used in implementation of Is_Negative intrinsic (see Exp_Intr)
99
100    function Shift_Left
101      (Value  : Short_Short_Unsigned;
102       Amount : Natural) return Short_Short_Unsigned;
103
104    function Shift_Right
105      (Value  : Short_Short_Unsigned;
106       Amount : Natural) return Short_Short_Unsigned;
107
108    function Shift_Right_Arithmetic
109      (Value  : Short_Short_Unsigned;
110       Amount : Natural) return Short_Short_Unsigned;
111
112    function Rotate_Left
113      (Value  : Short_Short_Unsigned;
114       Amount : Natural) return Short_Short_Unsigned;
115
116    function Rotate_Right
117      (Value  : Short_Short_Unsigned;
118       Amount : Natural) return Short_Short_Unsigned;
119
120    function Shift_Left
121      (Value  : Short_Unsigned;
122       Amount : Natural) return Short_Unsigned;
123
124    function Shift_Right
125      (Value  : Short_Unsigned;
126       Amount : Natural) return Short_Unsigned;
127
128    function Shift_Right_Arithmetic
129      (Value  : Short_Unsigned;
130       Amount : Natural) return Short_Unsigned;
131
132    function Rotate_Left
133      (Value  : Short_Unsigned;
134       Amount : Natural) return Short_Unsigned;
135
136    function Rotate_Right
137      (Value  : Short_Unsigned;
138       Amount : Natural) return Short_Unsigned;
139
140    function Shift_Left
141      (Value  : Unsigned;
142       Amount : Natural) return Unsigned;
143
144    function Shift_Right
145      (Value  : Unsigned;
146       Amount : Natural) return Unsigned;
147
148    function Shift_Right_Arithmetic
149      (Value  : Unsigned;
150       Amount : Natural) return Unsigned;
151
152    function Rotate_Left
153      (Value  : Unsigned;
154       Amount : Natural) return Unsigned;
155
156    function Rotate_Right
157      (Value  : Unsigned;
158       Amount : Natural) return Unsigned;
159
160    function Shift_Left
161      (Value  : Long_Unsigned;
162       Amount : Natural) return Long_Unsigned;
163
164    function Shift_Right
165      (Value  : Long_Unsigned;
166       Amount : Natural) return Long_Unsigned;
167
168    function Shift_Right_Arithmetic
169      (Value  : Long_Unsigned;
170       Amount : Natural) return Long_Unsigned;
171
172    function Rotate_Left
173      (Value  : Long_Unsigned;
174       Amount : Natural) return Long_Unsigned;
175
176    function Rotate_Right
177      (Value  : Long_Unsigned;
178       Amount : Natural) return Long_Unsigned;
179
180    function Shift_Left
181      (Value  : Long_Long_Unsigned;
182       Amount : Natural) return Long_Long_Unsigned;
183
184    function Shift_Right
185      (Value  : Long_Long_Unsigned;
186       Amount : Natural) return Long_Long_Unsigned;
187
188    function Shift_Right_Arithmetic
189      (Value  : Long_Long_Unsigned;
190       Amount : Natural) return Long_Long_Unsigned;
191
192    function Rotate_Left
193      (Value  : Long_Long_Unsigned;
194       Amount : Natural) return Long_Long_Unsigned;
195
196    function Rotate_Right
197      (Value  : Long_Long_Unsigned;
198       Amount : Natural) return Long_Long_Unsigned;
199
200    pragma Import (Intrinsic, Shift_Left);
201    pragma Import (Intrinsic, Shift_Right);
202    pragma Import (Intrinsic, Shift_Right_Arithmetic);
203    pragma Import (Intrinsic, Rotate_Left);
204    pragma Import (Intrinsic, Rotate_Right);
205
206    --  The following definitions are obsolescent. They were needed by the
207    --  previous version of the compiler and runtime, but are not needed
208    --  by the current version. We retain them to help with bootstrap path
209    --  problems. Also they seem harmless, and if any user programs have
210    --  been using these types, why discombobulate them?
211
212    subtype Packed_Bytes           is Packed_Bytes4;
213    subtype Packed_Bytes_Unaligned is Packed_Bytes1;
214
215 end System.Unsigned_Types;