OSDN Git Service

* 1aexcept.adb, 1aexcept.ads, 1ic.ads, 1ssecsta.adb,
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-stoele.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --               S Y S T E M . S T O R A G E _ E L E M E N T S              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 -- This specification is adapted from the Ada Reference Manual for use with --
10 -- GNAT.  In accordance with the copyright of that document, you can freely --
11 -- copy and modify this specification,  provided that if you redistribute a --
12 -- modified version,  any changes that you have made are clearly indicated. --
13 --                                                                          --
14 ------------------------------------------------------------------------------
15
16 --  Warning: declarations in this package are ambiguous with respect to the
17 --  extra declarations that can be introduced into System using Extend_System.
18 --  It is a good idea to avoid use clauses for this package!
19
20 pragma Warnings (Off);
21 --  This is to stop bootstrap problems with the use of Inline_Always
22 --  To be removed (along with redundant Inline pragmas) in 3.13.
23
24 package System.Storage_Elements is
25 pragma Pure (Storage_Elements);
26 --  Note that we take advantage of the implementation permission to make
27 --  this unit Pure instead of Preelaborable; see RM 13.7.1(15).
28
29    type Storage_Offset is range
30      -(2 ** (Standard."-" (Standard'Address_Size, 1))) ..
31      +(2 ** (Standard."-" (Standard'Address_Size, 1))) - 1;
32    --  Note: the reason for the qualification of "-" here by Standard is
33    --  that we have a current bug in GNAT that otherwise causes a bogus
34    --  ambiguity when this unit is analyzed in an Rtsfind context.
35
36    subtype Storage_Count is Storage_Offset range 0 .. Storage_Offset'Last;
37
38    type Storage_Element is mod 2 ** Storage_Unit;
39    for Storage_Element'Size use Storage_Unit;
40
41    type Storage_Array is
42      array (Storage_Offset range <>) of aliased Storage_Element;
43    for Storage_Array'Component_Size use Storage_Unit;
44
45    --  Address arithmetic
46
47    function "+" (Left : Address; Right : Storage_Offset) return Address;
48    pragma Convention (Intrinsic, "+");
49    pragma Inline ("+");
50    pragma Inline_Always ("+");
51
52    function "+" (Left : Storage_Offset; Right : Address) return Address;
53    pragma Convention (Intrinsic, "+");
54    pragma Inline ("+");
55    pragma Inline_Always ("+");
56
57    function "-" (Left : Address; Right : Storage_Offset) return Address;
58    pragma Convention (Intrinsic, "-");
59    pragma Inline ("-");
60    pragma Inline_Always ("-");
61
62    function "-" (Left, Right : Address) return Storage_Offset;
63    pragma Convention (Intrinsic, "-");
64    pragma Inline ("-");
65    pragma Inline_Always ("-");
66
67    function "mod"
68      (Left  : Address;
69       Right : Storage_Offset)
70       return  Storage_Offset;
71    pragma Convention (Intrinsic, "mod");
72    pragma Inline ("mod");
73    pragma Inline_Always ("mod");
74
75    --  Conversion to/from integers
76
77    type Integer_Address is mod Memory_Size;
78
79    function To_Address (Value : Integer_Address) return Address;
80    pragma Convention (Intrinsic, To_Address);
81    pragma Inline (To_Address);
82    pragma Inline_Always (To_Address);
83
84    function To_Integer (Value : Address) return Integer_Address;
85    pragma Convention (Intrinsic, To_Integer);
86    pragma Inline (To_Integer);
87    pragma Inline_Always (To_Integer);
88
89 end System.Storage_Elements;