1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . S T O R A G E _ E L E M E N T S --
9 -- Copyright (C) 2002-2024, Free Software Foundation, Inc. --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the implementation dependent sections of this file. --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
23 -- additional permissions described in the GCC Runtime Library Exception, --
24 -- version 3.1, as published by the Free Software Foundation. --
26 -- You should have received a copy of the GNU General Public License and --
27 -- a copy of the GCC Runtime Library Exception along with this program; --
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
29 -- <http://www.gnu.org/licenses/>. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
34 ------------------------------------------------------------------------------
36 -- Warning: declarations in this package are ambiguous with respect to the
37 -- extra declarations that can be introduced into System using Extend_System.
38 -- It is a good idea to avoid use clauses for this package.
40 package System
.Storage_Elements
with
44 -- Note that we take advantage of the implementation permission to make
45 -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada 2005,
46 -- this is Pure in any case (AI-362).
48 pragma No_Elaboration_Code_All
;
49 -- Allow the use of that restriction in units that WITH this unit
51 type Storage_Offset
is range -Memory_Size
/ 2 .. Memory_Size
/ 2 - 1;
53 subtype Storage_Count
is Storage_Offset
range 0 .. Storage_Offset
'Last;
55 type Storage_Element
is mod 2 ** Storage_Unit
;
56 for Storage_Element
'Size use Storage_Unit
;
58 pragma Universal_Aliasing
(Storage_Element
);
59 -- This type is used by the expander to implement aggregate copy
62 array (Storage_Offset
range <>) of aliased Storage_Element
;
63 for Storage_Array
'Component_Size use Storage_Unit
;
67 function "+" (Left
: Address
; Right
: Storage_Offset
) return Address
;
68 function "+" (Left
: Storage_Offset
; Right
: Address
) return Address
;
69 pragma Import
(Intrinsic
, "+");
71 function "-" (Left
: Address
; Right
: Storage_Offset
) return Address
;
72 function "-" (Left
, Right
: Address
) return Storage_Offset
;
73 pragma Import
(Intrinsic
, "-");
77 Right
: Storage_Offset
) return Storage_Offset
;
78 pragma Import
(Intrinsic
, "mod");
80 -- Conversion to/from integers
82 type Integer_Address
is mod Memory_Size
;
84 function To_Address
(Value
: Integer_Address
) return Address
;
85 pragma Import
(Intrinsic
, To_Address
);
87 function To_Integer
(Value
: Address
) return Integer_Address
;
88 pragma Import
(Intrinsic
, To_Integer
);
90 end System
.Storage_Elements
;