annotate gcc/ada/nlists.ads @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
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 -- N L I S T S --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This package provides facilities for manipulating lists of nodes (see
kono
parents:
diff changeset
33 -- package Atree for format and implementation of tree nodes). The Link field
kono
parents:
diff changeset
34 -- of the nodes is used as the forward pointer for these lists. See also
kono
parents:
diff changeset
35 -- package Elists which provides another form of lists that are not threaded
kono
parents:
diff changeset
36 -- through the nodes (and therefore allow nodes to be on multiple lists).
kono
parents:
diff changeset
37
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
38 -- WARNING: There is a C version of this package. Any changes to this
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
39 -- source file must be properly reflected in the C header file nlists.h
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
40
111
kono
parents:
diff changeset
41 with System;
kono
parents:
diff changeset
42 with Types; use Types;
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 package Nlists is
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 -- A node list is a list of nodes in a special format that means that
kono
parents:
diff changeset
47 -- nodes can be on at most one such list. For each node list, a list
kono
parents:
diff changeset
48 -- header is allocated in the lists table, and a List_Id value references
kono
parents:
diff changeset
49 -- this header, which may be used to access the nodes in the list using
kono
parents:
diff changeset
50 -- the set of routines that define this interface.
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 -- Note: node lists can contain either nodes or entities (extended nodes)
kono
parents:
diff changeset
53 -- or a mixture of nodes and extended nodes.
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 function In_Same_List (N1, N2 : Node_Or_Entity_Id) return Boolean;
kono
parents:
diff changeset
56 pragma Inline (In_Same_List);
kono
parents:
diff changeset
57 -- Equivalent to List_Containing (N1) = List_Containing (N2)
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 function Last_List_Id return List_Id;
kono
parents:
diff changeset
60 pragma Inline (Last_List_Id);
kono
parents:
diff changeset
61 -- Returns Id of last allocated list header
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 function Lists_Address return System.Address;
kono
parents:
diff changeset
64 pragma Inline (Lists_Address);
kono
parents:
diff changeset
65 -- Return address of Lists table (used in Back_End for Gigi call)
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 function Num_Lists return Nat;
kono
parents:
diff changeset
68 pragma Inline (Num_Lists);
kono
parents:
diff changeset
69 -- Number of currently allocated lists
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 function New_List return List_Id;
kono
parents:
diff changeset
72 -- Creates a new empty node list. Typically this is used to initialize
kono
parents:
diff changeset
73 -- a field in some other node which points to a node list where the list
kono
parents:
diff changeset
74 -- is then subsequently filled in using Append calls.
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 function Empty_List return List_Id renames New_List;
kono
parents:
diff changeset
77 -- Used in contexts where an empty list (as opposed to an initially empty
kono
parents:
diff changeset
78 -- list to be filled in) is required.
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 function New_List
kono
parents:
diff changeset
81 (Node : Node_Or_Entity_Id) return List_Id;
kono
parents:
diff changeset
82 -- Build a new list initially containing the given node
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 function New_List
kono
parents:
diff changeset
85 (Node1 : Node_Or_Entity_Id;
kono
parents:
diff changeset
86 Node2 : Node_Or_Entity_Id) return List_Id;
kono
parents:
diff changeset
87 -- Build a new list initially containing the two given nodes
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 function New_List
kono
parents:
diff changeset
90 (Node1 : Node_Or_Entity_Id;
kono
parents:
diff changeset
91 Node2 : Node_Or_Entity_Id;
kono
parents:
diff changeset
92 Node3 : Node_Or_Entity_Id) return List_Id;
kono
parents:
diff changeset
93 -- Build a new list initially containing the three given nodes
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 function New_List
kono
parents:
diff changeset
96 (Node1 : Node_Or_Entity_Id;
kono
parents:
diff changeset
97 Node2 : Node_Or_Entity_Id;
kono
parents:
diff changeset
98 Node3 : Node_Or_Entity_Id;
kono
parents:
diff changeset
99 Node4 : Node_Or_Entity_Id) return List_Id;
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 function New_List
kono
parents:
diff changeset
102 (Node1 : Node_Or_Entity_Id;
kono
parents:
diff changeset
103 Node2 : Node_Or_Entity_Id;
kono
parents:
diff changeset
104 Node3 : Node_Or_Entity_Id;
kono
parents:
diff changeset
105 Node4 : Node_Or_Entity_Id;
kono
parents:
diff changeset
106 Node5 : Node_Or_Entity_Id) return List_Id;
kono
parents:
diff changeset
107 -- Build a new list initially containing the five given nodes
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 function New_List
kono
parents:
diff changeset
110 (Node1 : Node_Or_Entity_Id;
kono
parents:
diff changeset
111 Node2 : Node_Or_Entity_Id;
kono
parents:
diff changeset
112 Node3 : Node_Or_Entity_Id;
kono
parents:
diff changeset
113 Node4 : Node_Or_Entity_Id;
kono
parents:
diff changeset
114 Node5 : Node_Or_Entity_Id;
kono
parents:
diff changeset
115 Node6 : Node_Or_Entity_Id) return List_Id;
kono
parents:
diff changeset
116 -- Build a new list initially containing the six given nodes
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 function New_Copy_List (List : List_Id) return List_Id;
kono
parents:
diff changeset
119 -- Creates a new list containing copies (made with Atree.New_Copy) of every
kono
parents:
diff changeset
120 -- node in the original list. If the argument is No_List, then the returned
kono
parents:
diff changeset
121 -- result is No_List. If the argument is an empty list, then the returned
kono
parents:
diff changeset
122 -- result is a new empty list.
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 function New_Copy_List_Original (List : List_Id) return List_Id;
kono
parents:
diff changeset
125 -- Same as New_Copy_List but copies only nodes coming from source
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 function First (List : List_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
128 pragma Inline (First);
kono
parents:
diff changeset
129 -- Obtains the first element of the given node list or, if the node list
kono
parents:
diff changeset
130 -- has no items or is equal to No_List, then Empty is returned.
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 function First_Non_Pragma (List : List_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
133 -- Used when dealing with a list that can contain pragmas to skip past
kono
parents:
diff changeset
134 -- any initial pragmas and return the first element that is not a pragma.
kono
parents:
diff changeset
135 -- If the list is empty, or if it contains only pragmas, then Empty is
kono
parents:
diff changeset
136 -- returned. It is an error to call First_Non_Pragma with a Node_Id value
kono
parents:
diff changeset
137 -- or No_List (No_List is not considered to be the same as an empty list).
kono
parents:
diff changeset
138 -- This function also skips N_Null nodes which can result from rewriting
kono
parents:
diff changeset
139 -- unrecognized or incorrect pragmas.
kono
parents:
diff changeset
140
kono
parents:
diff changeset
141 function Last (List : List_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
142 pragma Inline (Last);
kono
parents:
diff changeset
143 -- Obtains the last element of the given node list or, if the node list
kono
parents:
diff changeset
144 -- has no items, then Empty is returned. It is an error to call Last with
kono
parents:
diff changeset
145 -- a Node_Id or No_List. (No_List is not considered to be the same as an
kono
parents:
diff changeset
146 -- empty node list).
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 function Last_Non_Pragma (List : List_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
149 -- Obtains the last element of a given node list that is not a pragma.
kono
parents:
diff changeset
150 -- If the list is empty, or if it contains only pragmas, then Empty is
kono
parents:
diff changeset
151 -- returned. It is an error to call Last_Non_Pragma with a Node_Id or
kono
parents:
diff changeset
152 -- No_List. (No_List is not considered to be the same as an empty list).
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 function List_Length (List : List_Id) return Nat;
kono
parents:
diff changeset
155 -- Returns number of items in the given list. It is an error to call
kono
parents:
diff changeset
156 -- this function with No_List (No_List is not considered to be the same
kono
parents:
diff changeset
157 -- as an empty list).
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 function Next (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
160 pragma Inline (Next);
kono
parents:
diff changeset
161 -- This function returns the next node on a node list, or Empty if Node is
kono
parents:
diff changeset
162 -- the last element of the node list. The argument must be a member of a
kono
parents:
diff changeset
163 -- node list.
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 procedure Next (Node : in out Node_Or_Entity_Id);
kono
parents:
diff changeset
166 pragma Inline (Next);
kono
parents:
diff changeset
167 -- Equivalent to Node := Next (Node);
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 function Next_Non_Pragma
kono
parents:
diff changeset
170 (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
171 -- This function returns the next node on a node list, skipping past any
kono
parents:
diff changeset
172 -- pragmas, or Empty if there is no non-pragma entry left. The argument
kono
parents:
diff changeset
173 -- must be a member of a node list. This function also skips N_Null nodes
kono
parents:
diff changeset
174 -- which can result from rewriting unrecognized or incorrect pragmas.
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 procedure Next_Non_Pragma (Node : in out Node_Or_Entity_Id);
kono
parents:
diff changeset
177 pragma Inline (Next_Non_Pragma);
kono
parents:
diff changeset
178 -- Equivalent to Node := Next_Non_Pragma (Node);
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 function Prev (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
181 pragma Inline (Prev);
kono
parents:
diff changeset
182 -- This function returns the previous node on a node list, or Empty
kono
parents:
diff changeset
183 -- if Node is the first element of the node list. The argument must be
kono
parents:
diff changeset
184 -- a member of a node list. Note: the implementation does maintain back
kono
parents:
diff changeset
185 -- pointers, so this function executes quickly in constant time.
kono
parents:
diff changeset
186
kono
parents:
diff changeset
187 function Pick (List : List_Id; Index : Pos) return Node_Or_Entity_Id;
kono
parents:
diff changeset
188 -- Given a list, picks out the Index'th entry (1 = first entry). The
kono
parents:
diff changeset
189 -- caller must ensure that Index is in range.
kono
parents:
diff changeset
190
kono
parents:
diff changeset
191 procedure Prev (Node : in out Node_Or_Entity_Id);
kono
parents:
diff changeset
192 pragma Inline (Prev);
kono
parents:
diff changeset
193 -- Equivalent to Node := Prev (Node);
kono
parents:
diff changeset
194
kono
parents:
diff changeset
195 function Prev_Non_Pragma
kono
parents:
diff changeset
196 (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
197 pragma Inline (Prev_Non_Pragma);
kono
parents:
diff changeset
198 -- This function returns the previous node on a node list, skipping any
kono
parents:
diff changeset
199 -- pragmas. If Node is the first element of the list, or if the only
kono
parents:
diff changeset
200 -- elements preceding it are pragmas, then Empty is returned. The
kono
parents:
diff changeset
201 -- argument must be a member of a node list. Note: the implementation
kono
parents:
diff changeset
202 -- does maintain back pointers, so this function executes quickly in
kono
parents:
diff changeset
203 -- constant time.
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 procedure Prev_Non_Pragma (Node : in out Node_Or_Entity_Id);
kono
parents:
diff changeset
206 pragma Inline (Prev_Non_Pragma);
kono
parents:
diff changeset
207 -- Equivalent to Node := Prev_Non_Pragma (Node);
kono
parents:
diff changeset
208
kono
parents:
diff changeset
209 function Is_Empty_List (List : List_Id) return Boolean;
kono
parents:
diff changeset
210 pragma Inline (Is_Empty_List);
kono
parents:
diff changeset
211 -- This function determines if a given list id references a node list that
kono
parents:
diff changeset
212 -- contains no items. No_List as an argument returns True.
kono
parents:
diff changeset
213
kono
parents:
diff changeset
214 function Is_Non_Empty_List (List : List_Id) return Boolean;
kono
parents:
diff changeset
215 pragma Inline (Is_Non_Empty_List);
kono
parents:
diff changeset
216 -- This function determines if a given list id references a node list that
kono
parents:
diff changeset
217 -- contains at least one item. No_List as an argument returns False.
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 function Is_List_Member (Node : Node_Or_Entity_Id) return Boolean;
kono
parents:
diff changeset
220 pragma Inline (Is_List_Member);
kono
parents:
diff changeset
221 -- This function determines if a given node is a member of a node list.
kono
parents:
diff changeset
222 -- It is an error for Node to be Empty, or to be a node list.
kono
parents:
diff changeset
223
kono
parents:
diff changeset
224 function List_Containing (Node : Node_Or_Entity_Id) return List_Id;
kono
parents:
diff changeset
225 pragma Inline (List_Containing);
kono
parents:
diff changeset
226 -- This function provides a pointer to the node list containing Node.
kono
parents:
diff changeset
227 -- Node must be a member of a node list.
kono
parents:
diff changeset
228
kono
parents:
diff changeset
229 procedure Append (Node : Node_Or_Entity_Id; To : List_Id);
kono
parents:
diff changeset
230 -- Appends Node at the end of node list To. Node must be a non-empty node
kono
parents:
diff changeset
231 -- that is not already a member of a node list, and To must be a node list.
kono
parents:
diff changeset
232 -- An attempt to append an error node is ignored without complaint and the
kono
parents:
diff changeset
233 -- list is unchanged.
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 procedure Append_New (Node : Node_Or_Entity_Id; To : in out List_Id);
kono
parents:
diff changeset
236 pragma Inline (Append_New);
kono
parents:
diff changeset
237 -- Appends Node at the end of node list To. If To is non-existent list, a
kono
parents:
diff changeset
238 -- list is created. Node must be a non-empty node that is not already a
kono
parents:
diff changeset
239 -- member of a node list, and To must be a node list.
kono
parents:
diff changeset
240
kono
parents:
diff changeset
241 procedure Append_New_To (To : in out List_Id; Node : Node_Or_Entity_Id);
kono
parents:
diff changeset
242 pragma Inline (Append_New_To);
kono
parents:
diff changeset
243 -- Like Append_New, but the arguments are in reverse order
kono
parents:
diff changeset
244
kono
parents:
diff changeset
245 procedure Append_To (To : List_Id; Node : Node_Or_Entity_Id);
kono
parents:
diff changeset
246 pragma Inline (Append_To);
kono
parents:
diff changeset
247 -- Like Append, but arguments are the other way round
kono
parents:
diff changeset
248
kono
parents:
diff changeset
249 procedure Append_List (List : List_Id; To : List_Id);
kono
parents:
diff changeset
250 -- Appends node list List to the end of node list To. On return,
kono
parents:
diff changeset
251 -- List is reset to be empty.
kono
parents:
diff changeset
252
kono
parents:
diff changeset
253 procedure Append_List_To (To : List_Id; List : List_Id);
kono
parents:
diff changeset
254 pragma Inline (Append_List_To);
kono
parents:
diff changeset
255 -- Like Append_List, but arguments are the other way round
kono
parents:
diff changeset
256
kono
parents:
diff changeset
257 procedure Insert_After
kono
parents:
diff changeset
258 (After : Node_Or_Entity_Id;
kono
parents:
diff changeset
259 Node : Node_Or_Entity_Id);
kono
parents:
diff changeset
260 -- Insert Node, which must be a non-empty node that is not already a
kono
parents:
diff changeset
261 -- member of a node list, immediately past node After, which must be a
kono
parents:
diff changeset
262 -- node that is currently a member of a node list. An attempt to insert
kono
parents:
diff changeset
263 -- an error node is ignored without complaint (and the list is unchanged).
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265 procedure Insert_List_After
kono
parents:
diff changeset
266 (After : Node_Or_Entity_Id;
kono
parents:
diff changeset
267 List : List_Id);
kono
parents:
diff changeset
268 -- Inserts the entire contents of node list List immediately after node
kono
parents:
diff changeset
269 -- After, which must be a member of a node list. On return, the node list
kono
parents:
diff changeset
270 -- List is reset to be the empty node list.
kono
parents:
diff changeset
271
kono
parents:
diff changeset
272 procedure Insert_Before
kono
parents:
diff changeset
273 (Before : Node_Or_Entity_Id;
kono
parents:
diff changeset
274 Node : Node_Or_Entity_Id);
kono
parents:
diff changeset
275 -- Insert Node, which must be a non-empty node that is not already a
kono
parents:
diff changeset
276 -- member of a node list, immediately before Before, which must be a node
kono
parents:
diff changeset
277 -- that is currently a member of a node list. An attempt to insert an
kono
parents:
diff changeset
278 -- error node is ignored without complaint (and the list is unchanged).
kono
parents:
diff changeset
279
kono
parents:
diff changeset
280 procedure Insert_List_Before
kono
parents:
diff changeset
281 (Before : Node_Or_Entity_Id;
kono
parents:
diff changeset
282 List : List_Id);
kono
parents:
diff changeset
283 -- Inserts the entire contents of node list List immediately before node
kono
parents:
diff changeset
284 -- Before, which must be a member of a node list. On return, the node list
kono
parents:
diff changeset
285 -- List is reset to be the empty node list.
kono
parents:
diff changeset
286
kono
parents:
diff changeset
287 procedure Prepend
kono
parents:
diff changeset
288 (Node : Node_Or_Entity_Id;
kono
parents:
diff changeset
289 To : List_Id);
kono
parents:
diff changeset
290 -- Prepends Node at the start of node list To. Node must be a non-empty
kono
parents:
diff changeset
291 -- node that is not already a member of a node list, and To must be a
kono
parents:
diff changeset
292 -- node list. An attempt to prepend an error node is ignored without
kono
parents:
diff changeset
293 -- complaint and the list is unchanged.
kono
parents:
diff changeset
294
kono
parents:
diff changeset
295 procedure Prepend_List
kono
parents:
diff changeset
296 (List : List_Id;
kono
parents:
diff changeset
297 To : List_Id);
kono
parents:
diff changeset
298 -- Prepends node list List to the start of node list To. On return,
kono
parents:
diff changeset
299 -- List is reset to be empty.
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 procedure Prepend_List_To
kono
parents:
diff changeset
302 (To : List_Id;
kono
parents:
diff changeset
303 List : List_Id);
kono
parents:
diff changeset
304 pragma Inline (Prepend_List_To);
kono
parents:
diff changeset
305 -- Like Prepend_List, but arguments are the other way round
kono
parents:
diff changeset
306
kono
parents:
diff changeset
307 procedure Prepend_New (Node : Node_Or_Entity_Id; To : in out List_Id);
kono
parents:
diff changeset
308 pragma Inline (Prepend_New);
kono
parents:
diff changeset
309 -- Prepends Node at the end of node list To. If To is non-existent list, a
kono
parents:
diff changeset
310 -- list is created. Node must be a non-empty node that is not already a
kono
parents:
diff changeset
311 -- member of a node list, and To must be a node list.
kono
parents:
diff changeset
312
kono
parents:
diff changeset
313 procedure Prepend_New_To (To : in out List_Id; Node : Node_Or_Entity_Id);
kono
parents:
diff changeset
314 pragma Inline (Prepend_New_To);
kono
parents:
diff changeset
315 -- Like Prepend_New, but the arguments are in reverse order
kono
parents:
diff changeset
316
kono
parents:
diff changeset
317 procedure Prepend_To
kono
parents:
diff changeset
318 (To : List_Id;
kono
parents:
diff changeset
319 Node : Node_Or_Entity_Id);
kono
parents:
diff changeset
320 pragma Inline (Prepend_To);
kono
parents:
diff changeset
321 -- Like Prepend, but arguments are the other way round
kono
parents:
diff changeset
322
kono
parents:
diff changeset
323 procedure Remove (Node : Node_Or_Entity_Id);
kono
parents:
diff changeset
324 -- Removes Node, which must be a node that is a member of a node list,
kono
parents:
diff changeset
325 -- from this node list. The contents of Node are not otherwise affected.
kono
parents:
diff changeset
326
kono
parents:
diff changeset
327 function Remove_Head (List : List_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
328 -- Removes the head element of a node list, and returns the node (whose
kono
parents:
diff changeset
329 -- contents are not otherwise affected) as the result. If the node list
kono
parents:
diff changeset
330 -- is empty, then Empty is returned.
kono
parents:
diff changeset
331
kono
parents:
diff changeset
332 function Remove_Next (Node : Node_Or_Entity_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
333 -- Removes the item immediately following the given node, and returns it
kono
parents:
diff changeset
334 -- as the result. If Node is the last element of the list, then Empty is
kono
parents:
diff changeset
335 -- returned. Node must be a member of a list. Unlike Remove, Remove_Next
kono
parents:
diff changeset
336 -- is fast and does not involve any list traversal.
kono
parents:
diff changeset
337
kono
parents:
diff changeset
338 procedure Initialize;
kono
parents:
diff changeset
339 -- Called at the start of compilation of each new main source file to
kono
parents:
diff changeset
340 -- initialize the allocation of the list table. Note that Initialize
kono
parents:
diff changeset
341 -- must not be called if Tree_Read is used.
kono
parents:
diff changeset
342
kono
parents:
diff changeset
343 procedure Lock;
kono
parents:
diff changeset
344 -- Called to lock tables before back end is called
kono
parents:
diff changeset
345
kono
parents:
diff changeset
346 procedure Lock_Lists;
kono
parents:
diff changeset
347 -- Called to lock list contents when assertions are enabled. Without
kono
parents:
diff changeset
348 -- assertions calling this subprogram has no effect. The initial state
kono
parents:
diff changeset
349 -- of the lock is unlocked.
kono
parents:
diff changeset
350
kono
parents:
diff changeset
351 procedure Unlock;
kono
parents:
diff changeset
352 -- Unlock tables, in cases where the back end needs to modify them
kono
parents:
diff changeset
353
kono
parents:
diff changeset
354 procedure Unlock_Lists;
kono
parents:
diff changeset
355 -- Called to unlock list contents when assertions are enabled; if
kono
parents:
diff changeset
356 -- assertions are not enabled calling this subprogram has no effect.
kono
parents:
diff changeset
357
kono
parents:
diff changeset
358 procedure Tree_Read;
kono
parents:
diff changeset
359 -- Initializes internal tables from current tree file using the relevant
kono
parents:
diff changeset
360 -- Table.Tree_Read routines. Note that Initialize should not be called if
kono
parents:
diff changeset
361 -- Tree_Read is used. Tree_Read includes all necessary initialization.
kono
parents:
diff changeset
362
kono
parents:
diff changeset
363 procedure Tree_Write;
kono
parents:
diff changeset
364 -- Writes out internal tables to current tree file using the relevant
kono
parents:
diff changeset
365 -- Table.Tree_Write routines.
kono
parents:
diff changeset
366
kono
parents:
diff changeset
367 function Parent (List : List_Id) return Node_Or_Entity_Id;
kono
parents:
diff changeset
368 pragma Inline (Parent);
kono
parents:
diff changeset
369 -- Node lists may have a parent in the same way as a node. The function
kono
parents:
diff changeset
370 -- accesses the Parent value, which is either Empty when a list header
kono
parents:
diff changeset
371 -- is first created, or the value that has been set by Set_Parent.
kono
parents:
diff changeset
372
kono
parents:
diff changeset
373 procedure Set_Parent (List : List_Id; Node : Node_Or_Entity_Id);
kono
parents:
diff changeset
374 pragma Inline (Set_Parent);
kono
parents:
diff changeset
375 -- Sets the parent field of the given list to reference the given node
kono
parents:
diff changeset
376
kono
parents:
diff changeset
377 function No (List : List_Id) return Boolean;
kono
parents:
diff changeset
378 pragma Inline (No);
kono
parents:
diff changeset
379 -- Tests given Id for equality with No_List. This allows notations like
kono
parents:
diff changeset
380 -- "if No (Statements)" as opposed to "if Statements = No_List". Note that
kono
parents:
diff changeset
381 -- an empty list gives False for this test, as opposed to Is_Empty_List
kono
parents:
diff changeset
382 -- which gives True either for No_List or for an empty list.
kono
parents:
diff changeset
383
kono
parents:
diff changeset
384 function Present (List : List_Id) return Boolean;
kono
parents:
diff changeset
385 pragma Inline (Present);
kono
parents:
diff changeset
386 -- Tests given Id for inequality with No_List. This allows notations like
kono
parents:
diff changeset
387 -- "if Present (Statements)" as opposed to "if Statements /= No_List".
kono
parents:
diff changeset
388
kono
parents:
diff changeset
389 procedure Allocate_List_Tables (N : Node_Or_Entity_Id);
kono
parents:
diff changeset
390 -- Called when nodes table is expanded to include node N. This call
kono
parents:
diff changeset
391 -- makes sure that list structures internal to Nlists are adjusted
kono
parents:
diff changeset
392 -- appropriately to reflect this increase in the size of the nodes table.
kono
parents:
diff changeset
393
kono
parents:
diff changeset
394 function Next_Node_Address return System.Address;
kono
parents:
diff changeset
395 function Prev_Node_Address return System.Address;
kono
parents:
diff changeset
396 -- These functions return the addresses of the Next_Node and Prev_Node
kono
parents:
diff changeset
397 -- tables (used in Back_End for Gigi).
kono
parents:
diff changeset
398
kono
parents:
diff changeset
399 end Nlists;