annotate gcc/ada/libgnat/s-stoele.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
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 -- S Y S T E M . S T O R A G E _ E L E M E N T S --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 2002-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- This specification is derived from the Ada Reference Manual for use with --
kono
parents:
diff changeset
12 -- GNAT. The copyright notice above, and the license provisions that follow --
kono
parents:
diff changeset
13 -- apply solely to the implementation dependent sections of this file. --
kono
parents:
diff changeset
14 -- --
kono
parents:
diff changeset
15 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
16 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
23 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
24 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
25 -- --
kono
parents:
diff changeset
26 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
27 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
29 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
30 -- --
kono
parents:
diff changeset
31 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
33 -- --
kono
parents:
diff changeset
34 ------------------------------------------------------------------------------
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 -- Warning: declarations in this package are ambiguous with respect to the
kono
parents:
diff changeset
37 -- extra declarations that can be introduced into System using Extend_System.
kono
parents:
diff changeset
38 -- It is a good idea to avoid use clauses for this package.
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 pragma Compiler_Unit_Warning;
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 package System.Storage_Elements is
kono
parents:
diff changeset
43 pragma Pure;
kono
parents:
diff changeset
44 -- Note that we take advantage of the implementation permission to make
kono
parents:
diff changeset
45 -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada 2005,
kono
parents:
diff changeset
46 -- this is Pure in any case (AI-362).
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 -- We also add the pragma Pure_Function to the operations in this package,
kono
parents:
diff changeset
49 -- because otherwise functions with parameters derived from Address are
kono
parents:
diff changeset
50 -- treated as non-pure by the back-end (see exp_ch6.adb). This is because
kono
parents:
diff changeset
51 -- in many cases such a parameter is used to hide read/out access to
kono
parents:
diff changeset
52 -- objects, and it would be unsafe to treat such functions as pure.
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 type Storage_Offset is range
kono
parents:
diff changeset
55 -(2 ** (Integer'(Standard'Address_Size) - 1)) ..
kono
parents:
diff changeset
56 +(2 ** (Integer'(Standard'Address_Size) - 1)) - Long_Long_Integer'(1);
kono
parents:
diff changeset
57 -- Note: the reason for the Long_Long_Integer qualification here is to
kono
parents:
diff changeset
58 -- avoid a bogus ambiguity when this unit is analyzed in an rtsfind
kono
parents:
diff changeset
59 -- context. It may be possible to remove this in the future, but it is
kono
parents:
diff changeset
60 -- certainly harmless in any case ???
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 subtype Storage_Count is Storage_Offset range 0 .. Storage_Offset'Last;
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 type Storage_Element is mod 2 ** Storage_Unit;
kono
parents:
diff changeset
65 for Storage_Element'Size use Storage_Unit;
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 pragma Universal_Aliasing (Storage_Element);
kono
parents:
diff changeset
68 -- This type is used by the expander to implement aggregate copy
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 type Storage_Array is
kono
parents:
diff changeset
71 array (Storage_Offset range <>) of aliased Storage_Element;
kono
parents:
diff changeset
72 for Storage_Array'Component_Size use Storage_Unit;
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 -- Address arithmetic
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 function "+" (Left : Address; Right : Storage_Offset) return Address;
kono
parents:
diff changeset
77 pragma Convention (Intrinsic, "+");
kono
parents:
diff changeset
78 pragma Inline_Always ("+");
kono
parents:
diff changeset
79 pragma Pure_Function ("+");
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 function "+" (Left : Storage_Offset; Right : Address) return Address;
kono
parents:
diff changeset
82 pragma Convention (Intrinsic, "+");
kono
parents:
diff changeset
83 pragma Inline_Always ("+");
kono
parents:
diff changeset
84 pragma Pure_Function ("+");
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 function "-" (Left : Address; Right : Storage_Offset) return Address;
kono
parents:
diff changeset
87 pragma Convention (Intrinsic, "-");
kono
parents:
diff changeset
88 pragma Inline_Always ("-");
kono
parents:
diff changeset
89 pragma Pure_Function ("-");
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 function "-" (Left, Right : Address) return Storage_Offset;
kono
parents:
diff changeset
92 pragma Convention (Intrinsic, "-");
kono
parents:
diff changeset
93 pragma Inline_Always ("-");
kono
parents:
diff changeset
94 pragma Pure_Function ("-");
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 function "mod"
kono
parents:
diff changeset
97 (Left : Address;
kono
parents:
diff changeset
98 Right : Storage_Offset) return Storage_Offset;
kono
parents:
diff changeset
99 pragma Convention (Intrinsic, "mod");
kono
parents:
diff changeset
100 pragma Inline_Always ("mod");
kono
parents:
diff changeset
101 pragma Pure_Function ("mod");
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 -- Conversion to/from integers
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 type Integer_Address is mod Memory_Size;
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 function To_Address (Value : Integer_Address) return Address;
kono
parents:
diff changeset
108 pragma Convention (Intrinsic, To_Address);
kono
parents:
diff changeset
109 pragma Inline_Always (To_Address);
kono
parents:
diff changeset
110 pragma Pure_Function (To_Address);
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 function To_Integer (Value : Address) return Integer_Address;
kono
parents:
diff changeset
113 pragma Convention (Intrinsic, To_Integer);
kono
parents:
diff changeset
114 pragma Inline_Always (To_Integer);
kono
parents:
diff changeset
115 pragma Pure_Function (To_Integer);
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 end System.Storage_Elements;