annotate gcc/ada/exp_util.ads @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
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 -- E X P _ U T I L --
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. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- Package containing utility procedures used throughout the expander
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 with Exp_Tss; use Exp_Tss;
kono
parents:
diff changeset
29 with Namet; use Namet;
kono
parents:
diff changeset
30 with Rtsfind; use Rtsfind;
kono
parents:
diff changeset
31 with Sinfo; use Sinfo;
kono
parents:
diff changeset
32 with Types; use Types;
kono
parents:
diff changeset
33 with Uintp; use Uintp;
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 package Exp_Util is
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 -----------------------------------------------
kono
parents:
diff changeset
38 -- Handling of Actions Associated with Nodes --
kono
parents:
diff changeset
39 -----------------------------------------------
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 -- The evaluation of certain expression nodes involves the elaboration
kono
parents:
diff changeset
42 -- of associated types and other declarations, and the execution of
kono
parents:
diff changeset
43 -- statement sequences. Expansion routines generating such actions must
kono
parents:
diff changeset
44 -- find an appropriate place in the tree to hang the actions so that
kono
parents:
diff changeset
45 -- they will be evaluated at the appropriate point.
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 -- Some cases are simple:
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 -- For an expression occurring in a simple statement that is in a list
kono
parents:
diff changeset
50 -- of statements, the actions are simply inserted into the list before
kono
parents:
diff changeset
51 -- the associated statement.
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 -- For an expression occurring in a declaration (declarations always
kono
parents:
diff changeset
54 -- appear in lists), the actions are similarly inserted into the list
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
55 -- just before the associated declaration. ???Declarations do not always
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
56 -- appear in lists; in particular, a library unit declaration does not
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
57 -- appear in a list, and Insert_Action will crash in that case.
111
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 -- The following special cases arise:
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 -- For actions associated with the right operand of a short circuit
kono
parents:
diff changeset
62 -- form, the actions are first stored in the short circuit form node
kono
parents:
diff changeset
63 -- in the Actions field. The expansion of these forms subsequently
kono
parents:
diff changeset
64 -- expands the short circuit forms into if statements which can then
kono
parents:
diff changeset
65 -- be moved as described above.
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 -- For actions appearing in the Condition expression of a while loop,
kono
parents:
diff changeset
68 -- or an elsif clause, the actions are similarly temporarily stored in
kono
parents:
diff changeset
69 -- in the node (N_Elsif_Part or N_Iteration_Scheme) associated with
kono
parents:
diff changeset
70 -- the expression using the Condition_Actions field. Subsequently, the
kono
parents:
diff changeset
71 -- expansion of these nodes rewrites the control structures involved to
kono
parents:
diff changeset
72 -- reposition the actions in normal statement sequence.
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 -- For actions appearing in the then or else expression of a conditional
kono
parents:
diff changeset
75 -- expression, these actions are similarly placed in the node, using the
kono
parents:
diff changeset
76 -- Then_Actions or Else_Actions field as appropriate. Once again the
kono
parents:
diff changeset
77 -- expansion of the N_If_Expression node rewrites the node so that the
kono
parents:
diff changeset
78 -- actions can be positioned normally.
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 -- For actions coming from expansion of the expression in an expression
kono
parents:
diff changeset
81 -- with actions node, the action is appended to the list of actions.
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 -- Basically what we do is to climb up to the tree looking for the
kono
parents:
diff changeset
84 -- proper insertion point, as described by one of the above cases,
kono
parents:
diff changeset
85 -- and then insert the appropriate action or actions.
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 -- Note if more than one insert call is made specifying the same
kono
parents:
diff changeset
88 -- Assoc_Node, then the actions are elaborated in the order of the
kono
parents:
diff changeset
89 -- calls, and this guarantee is preserved for the special cases above.
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 procedure Insert_Action
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
92 (Assoc_Node : Node_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
93 Ins_Action : Node_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
94 Spec_Expr_OK : Boolean := False);
111
kono
parents:
diff changeset
95 -- Insert the action Ins_Action at the appropriate point as described
kono
parents:
diff changeset
96 -- above. The action is analyzed using the default checks after it is
kono
parents:
diff changeset
97 -- inserted. Assoc_Node is the node with which the action is associated.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
98 -- When flag Spec_Expr_OK is set, insertions triggered in the context of
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
99 -- spec expressions are honored, even though they contradict "Handling
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
100 -- of Default and Per-Object Expressions".
111
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 procedure Insert_Action
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
103 (Assoc_Node : Node_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
104 Ins_Action : Node_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
105 Suppress : Check_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
106 Spec_Expr_OK : Boolean := False);
111
kono
parents:
diff changeset
107 -- Insert the action Ins_Action at the appropriate point as described
kono
parents:
diff changeset
108 -- above. The action is analyzed using the default checks as modified
kono
parents:
diff changeset
109 -- by the given Suppress argument after it is inserted. Assoc_Node is
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
110 -- the node with which the action is associated. When flag Spec_Expr_OK
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
111 -- is set, insertions triggered in the context of spec expressions are
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
112 -- honored, even though they contradict "Handling of Default and Per-
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
113 -- Object Expressions".
111
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 procedure Insert_Actions
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
116 (Assoc_Node : Node_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
117 Ins_Actions : List_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
118 Spec_Expr_OK : Boolean := False);
111
kono
parents:
diff changeset
119 -- Insert the list of action Ins_Actions at the appropriate point as
kono
parents:
diff changeset
120 -- described above. The actions are analyzed using the default checks
kono
parents:
diff changeset
121 -- after they are inserted. Assoc_Node is the node with which the actions
kono
parents:
diff changeset
122 -- are associated. Ins_Actions may be No_List, in which case the call has
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
123 -- no effect. When flag Spec_Expr_OK is set, insertions triggered in the
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
124 -- context of spec expressions are honored, even though they contradict
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
125 -- "Handling of Default and Per-Object Expressions".
111
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 procedure Insert_Actions
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
128 (Assoc_Node : Node_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
129 Ins_Actions : List_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
130 Suppress : Check_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
131 Spec_Expr_OK : Boolean := False);
111
kono
parents:
diff changeset
132 -- Insert the list of action Ins_Actions at the appropriate point as
kono
parents:
diff changeset
133 -- described above. The actions are analyzed using the default checks
kono
parents:
diff changeset
134 -- as modified by the given Suppress argument after they are inserted.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
135 -- Assoc_Node is the node with which the actions are associated. List
111
kono
parents:
diff changeset
136 -- Ins_Actions may be No_List, in which case the call has no effect.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
137 -- When flag Spec_Expr_OK is set, insertions triggered in the context of
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
138 -- spec expressions are honored, even though they contradict "Handling
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
139 -- of Default and Per-Object Expressions".
111
kono
parents:
diff changeset
140
kono
parents:
diff changeset
141 procedure Insert_Action_After
kono
parents:
diff changeset
142 (Assoc_Node : Node_Id;
kono
parents:
diff changeset
143 Ins_Action : Node_Id);
kono
parents:
diff changeset
144 -- Assoc_Node must be a node in a list. Same as Insert_Action but the
kono
parents:
diff changeset
145 -- action will be inserted after N in a manner that is compatible with
kono
parents:
diff changeset
146 -- the transient scope mechanism.
kono
parents:
diff changeset
147 --
kono
parents:
diff changeset
148 -- Note: If several successive calls to Insert_Action_After are made for
kono
parents:
diff changeset
149 -- the same node, they will each in turn be inserted just after the node.
kono
parents:
diff changeset
150 -- This means they will end up being executed in reverse order. Use the
kono
parents:
diff changeset
151 -- call to Insert_Actions_After to insert a list of actions to be executed
kono
parents:
diff changeset
152 -- in the sequence in which they are given in the list.
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 procedure Insert_Actions_After
kono
parents:
diff changeset
155 (Assoc_Node : Node_Id;
kono
parents:
diff changeset
156 Ins_Actions : List_Id);
kono
parents:
diff changeset
157 -- Assoc_Node must be a node in a list. Same as Insert_Actions but
kono
parents:
diff changeset
158 -- actions will be inserted after N in a manner that is compatible with
kono
parents:
diff changeset
159 -- the transient scope mechanism. This procedure must be used instead
kono
parents:
diff changeset
160 -- of Insert_List_After if Assoc_Node may be in a transient scope.
kono
parents:
diff changeset
161 --
kono
parents:
diff changeset
162 -- Implementation limitation: Assoc_Node must be a statement. We can
kono
parents:
diff changeset
163 -- generalize to expressions if there is a need but this is tricky to
kono
parents:
diff changeset
164 -- implement because of short-circuits (among other things).???
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 procedure Insert_Declaration (N : Node_Id; Decl : Node_Id);
kono
parents:
diff changeset
167 -- N must be a subexpression (Nkind in N_Subexpr). This is similar to
kono
parents:
diff changeset
168 -- Insert_Action (N, Decl), but inserts Decl outside the expression in
kono
parents:
diff changeset
169 -- which N appears. This is called Insert_Declaration because the intended
kono
parents:
diff changeset
170 -- use is for declarations that have no associated code. We can't go
kono
parents:
diff changeset
171 -- moving other kinds of things out of the current expression, since they
kono
parents:
diff changeset
172 -- could be executed conditionally (e.g. right operand of short circuit,
kono
parents:
diff changeset
173 -- or THEN/ELSE of if expression). This is currently used only in
kono
parents:
diff changeset
174 -- Modify_Tree_For_C mode, where it is needed because in C we have no
kono
parents:
diff changeset
175 -- way of having declarations within an expression (a really annoying
kono
parents:
diff changeset
176 -- limitation).
kono
parents:
diff changeset
177
kono
parents:
diff changeset
178 procedure Insert_Library_Level_Action (N : Node_Id);
kono
parents:
diff changeset
179 -- This procedure inserts and analyzes the node N as an action at the
kono
parents:
diff changeset
180 -- library level for the current unit (i.e. it is attached to the
kono
parents:
diff changeset
181 -- Actions field of the N_Compilation_Aux node for the main unit).
kono
parents:
diff changeset
182
kono
parents:
diff changeset
183 procedure Insert_Library_Level_Actions (L : List_Id);
kono
parents:
diff changeset
184 -- Similar, but inserts a list of actions
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 -----------------------
kono
parents:
diff changeset
187 -- Other Subprograms --
kono
parents:
diff changeset
188 -----------------------
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 procedure Activate_Atomic_Synchronization (N : Node_Id);
kono
parents:
diff changeset
191 -- N is a node for which atomic synchronization may be required (it is
kono
parents:
diff changeset
192 -- either an identifier, expanded name, or selected/indexed component or
kono
parents:
diff changeset
193 -- an explicit dereference). The caller has checked the basic conditions
kono
parents:
diff changeset
194 -- (atomic variable appearing and Atomic_Sync not disabled). This function
kono
parents:
diff changeset
195 -- checks if atomic synchronization is required and if so sets the flag
kono
parents:
diff changeset
196 -- and if appropriate generates a warning (in -gnatw.n mode).
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 procedure Adjust_Condition (N : Node_Id);
kono
parents:
diff changeset
199 -- The node N is an expression whose root-type is Boolean, and which
kono
parents:
diff changeset
200 -- represents a boolean value used as a condition (i.e. a True/False
kono
parents:
diff changeset
201 -- value). This routine handles the case of C and Fortran convention
kono
parents:
diff changeset
202 -- boolean types, which have zero/non-zero semantics rather than the normal
kono
parents:
diff changeset
203 -- 0/1 semantics, and also the case of an enumeration rep clause that
kono
parents:
diff changeset
204 -- specifies a non-standard representation. On return, node N always has
kono
parents:
diff changeset
205 -- the type Standard.Boolean, with a value that is a standard Boolean
kono
parents:
diff changeset
206 -- values of 0/1 for False/True. This procedure is used in two situations.
kono
parents:
diff changeset
207 -- First, the processing for a condition field always calls
kono
parents:
diff changeset
208 -- Adjust_Condition, so that the boolean value presented to the backend is
kono
parents:
diff changeset
209 -- a standard value. Second, for the code for boolean operations such as
kono
parents:
diff changeset
210 -- AND, Adjust_Condition is called on both operands, and then the operation
kono
parents:
diff changeset
211 -- is done in the domain of Standard_Boolean, then Adjust_Result_Type is
kono
parents:
diff changeset
212 -- called on the result to possibly reset the original type. This procedure
kono
parents:
diff changeset
213 -- also takes care of validity checking if Validity_Checks = Tests.
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215 procedure Adjust_Result_Type (N : Node_Id; T : Entity_Id);
kono
parents:
diff changeset
216 -- The processing of boolean operations like AND uses the procedure
kono
parents:
diff changeset
217 -- Adjust_Condition so that it can operate on Standard.Boolean, which is
kono
parents:
diff changeset
218 -- the only boolean type on which the backend needs to be able to implement
kono
parents:
diff changeset
219 -- such operators. This means that the result is also of type
kono
parents:
diff changeset
220 -- Standard.Boolean. In general the type must be reset back to the original
kono
parents:
diff changeset
221 -- type to get proper semantics, and that is the purpose of this procedure.
kono
parents:
diff changeset
222 -- N is the node (of type Standard.Boolean), and T is the desired type. As
kono
parents:
diff changeset
223 -- an optimization, this procedure leaves the type as Standard.Boolean in
kono
parents:
diff changeset
224 -- contexts where this is permissible (in particular for Condition fields,
kono
parents:
diff changeset
225 -- and for operands of other logical operations higher up the tree). The
kono
parents:
diff changeset
226 -- call to this procedure is completely ignored if the argument N is not of
kono
parents:
diff changeset
227 -- type Boolean.
kono
parents:
diff changeset
228
kono
parents:
diff changeset
229 procedure Append_Freeze_Action (T : Entity_Id; N : Node_Id);
kono
parents:
diff changeset
230 -- Add a new freeze action for the given type. The freeze action is
kono
parents:
diff changeset
231 -- attached to the freeze node for the type. Actions will be elaborated in
kono
parents:
diff changeset
232 -- the order in which they are added. Note that the added node is not
kono
parents:
diff changeset
233 -- analyzed. The analyze call is found in Exp_Ch13.Expand_N_Freeze_Entity.
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 procedure Append_Freeze_Actions (T : Entity_Id; L : List_Id);
kono
parents:
diff changeset
236 -- Adds the given list of freeze actions (declarations or statements) for
kono
parents:
diff changeset
237 -- the given type. The freeze actions are attached to the freeze node for
kono
parents:
diff changeset
238 -- the type. Actions will be elaborated in the order in which they are
kono
parents:
diff changeset
239 -- added, and the actions within the list will be elaborated in list order.
kono
parents:
diff changeset
240 -- Note that the added nodes are not analyzed. The analyze call is found in
kono
parents:
diff changeset
241 -- Exp_Ch13.Expand_N_Freeze_Entity.
kono
parents:
diff changeset
242
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
243 function Attribute_Constrained_Static_Value (Pref : Node_Id) return Boolean;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
244 -- Return the static value of a statically known attribute reference
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
245 -- Pref'Constrained.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
246
111
kono
parents:
diff changeset
247 procedure Build_Allocate_Deallocate_Proc
kono
parents:
diff changeset
248 (N : Node_Id;
kono
parents:
diff changeset
249 Is_Allocate : Boolean);
kono
parents:
diff changeset
250 -- Create a custom Allocate/Deallocate to be associated with an allocation
kono
parents:
diff changeset
251 -- or deallocation:
kono
parents:
diff changeset
252 --
kono
parents:
diff changeset
253 -- 1) controlled objects
kono
parents:
diff changeset
254 -- 2) class-wide objects
kono
parents:
diff changeset
255 -- 3) any kind of object on a subpool
kono
parents:
diff changeset
256 --
kono
parents:
diff changeset
257 -- N must be an allocator or the declaration of a temporary variable which
kono
parents:
diff changeset
258 -- represents the expression of the original allocator node, otherwise N
kono
parents:
diff changeset
259 -- must be a free statement. If flag Is_Allocate is set, the generated
kono
parents:
diff changeset
260 -- routine is allocate, deallocate otherwise.
kono
parents:
diff changeset
261
kono
parents:
diff changeset
262 function Build_Abort_Undefer_Block
kono
parents:
diff changeset
263 (Loc : Source_Ptr;
kono
parents:
diff changeset
264 Stmts : List_Id;
kono
parents:
diff changeset
265 Context : Node_Id) return Node_Id;
kono
parents:
diff changeset
266 -- Wrap statements Stmts in a block where the AT END handler contains a
kono
parents:
diff changeset
267 -- call to Abort_Undefer_Direct. Context is the node which prompted the
kono
parents:
diff changeset
268 -- inlining of the abort undefer routine. Note that this routine does
kono
parents:
diff changeset
269 -- not install a call to Abort_Defer.
kono
parents:
diff changeset
270
kono
parents:
diff changeset
271 procedure Build_Class_Wide_Expression
kono
parents:
diff changeset
272 (Prag : Node_Id;
kono
parents:
diff changeset
273 Subp : Entity_Id;
kono
parents:
diff changeset
274 Par_Subp : Entity_Id;
kono
parents:
diff changeset
275 Adjust_Sloc : Boolean;
kono
parents:
diff changeset
276 Needs_Wrapper : out Boolean);
kono
parents:
diff changeset
277 -- Build the expression for an inherited class-wide condition. Prag is
kono
parents:
diff changeset
278 -- the pragma constructed from the corresponding aspect of the parent
kono
parents:
diff changeset
279 -- subprogram, and Subp is the overriding operation, and Par_Subp is
kono
parents:
diff changeset
280 -- the overridden operation that has the condition. Adjust_Sloc is True
kono
parents:
diff changeset
281 -- when the sloc of nodes traversed should be adjusted for the inherited
kono
parents:
diff changeset
282 -- pragma. The routine is also called to check whether an inherited
kono
parents:
diff changeset
283 -- operation that is not overridden but has inherited conditions needs
kono
parents:
diff changeset
284 -- a wrapper, because the inherited condition includes calls to other
kono
parents:
diff changeset
285 -- primitives that have been overridden. In that case the first argument
kono
parents:
diff changeset
286 -- is the expression of the original class-wide aspect. In SPARK_Mode, such
kono
parents:
diff changeset
287 -- operation which are just inherited but have modified pre/postconditions
kono
parents:
diff changeset
288 -- are illegal.
kono
parents:
diff changeset
289 -- If there are calls to overridden operations in the condition, and the
kono
parents:
diff changeset
290 -- pragma applies to an inherited operation, a wrapper must be built for
kono
parents:
diff changeset
291 -- it to capture the new inherited condition. The flag Needs_Wrapper is
kono
parents:
diff changeset
292 -- set in that case so that the wrapper can be built, when the controlling
kono
parents:
diff changeset
293 -- type is frozen.
kono
parents:
diff changeset
294
kono
parents:
diff changeset
295 function Build_DIC_Call
kono
parents:
diff changeset
296 (Loc : Source_Ptr;
kono
parents:
diff changeset
297 Obj_Id : Entity_Id;
kono
parents:
diff changeset
298 Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
299 -- Build a call to the DIC procedure of type Typ with Obj_Id as the actual
kono
parents:
diff changeset
300 -- parameter.
kono
parents:
diff changeset
301
kono
parents:
diff changeset
302 procedure Build_DIC_Procedure_Body
kono
parents:
diff changeset
303 (Typ : Entity_Id;
kono
parents:
diff changeset
304 For_Freeze : Boolean := False);
kono
parents:
diff changeset
305 -- Create the body of the procedure which verifies the assertion expression
kono
parents:
diff changeset
306 -- of pragma Default_Initial_Condition at run time. Flag For_Freeze should
kono
parents:
diff changeset
307 -- be set when the body is constructed as part of the freezing actions for
kono
parents:
diff changeset
308 -- Typ.
kono
parents:
diff changeset
309
kono
parents:
diff changeset
310 procedure Build_DIC_Procedure_Declaration (Typ : Entity_Id);
kono
parents:
diff changeset
311 -- Create the declaration of the procedure which verifies the assertion
kono
parents:
diff changeset
312 -- expression of pragma Default_Initial_Condition at run time.
kono
parents:
diff changeset
313
kono
parents:
diff changeset
314 procedure Build_Invariant_Procedure_Body
kono
parents:
diff changeset
315 (Typ : Entity_Id;
kono
parents:
diff changeset
316 Partial_Invariant : Boolean := False);
kono
parents:
diff changeset
317 -- Create the body of the procedure which verifies the invariants of type
kono
parents:
diff changeset
318 -- Typ at runtime. Flag Partial_Invariant should be set when Typ denotes a
kono
parents:
diff changeset
319 -- private type, otherwise it is assumed that Typ denotes the full view of
kono
parents:
diff changeset
320 -- a private type.
kono
parents:
diff changeset
321
kono
parents:
diff changeset
322 procedure Build_Invariant_Procedure_Declaration
kono
parents:
diff changeset
323 (Typ : Entity_Id;
kono
parents:
diff changeset
324 Partial_Invariant : Boolean := False);
kono
parents:
diff changeset
325 -- Create the declaration of the procedure which verifies the invariants of
kono
parents:
diff changeset
326 -- type Typ at runtime. Flag Partial_Invariant should be set when building
kono
parents:
diff changeset
327 -- the invariant procedure for a private type.
kono
parents:
diff changeset
328
kono
parents:
diff changeset
329 procedure Build_Procedure_Form (N : Node_Id);
kono
parents:
diff changeset
330 -- Create a procedure declaration which emulates the behavior of a function
kono
parents:
diff changeset
331 -- that returns an array type, for C-compatible generation.
kono
parents:
diff changeset
332
kono
parents:
diff changeset
333 function Build_Runtime_Call (Loc : Source_Ptr; RE : RE_Id) return Node_Id;
kono
parents:
diff changeset
334 -- Build an N_Procedure_Call_Statement calling the given runtime entity.
kono
parents:
diff changeset
335 -- The call has no parameters. The first argument provides the location
kono
parents:
diff changeset
336 -- information for the tree and for error messages. The call node is not
kono
parents:
diff changeset
337 -- analyzed on return, the caller is responsible for analyzing it.
kono
parents:
diff changeset
338
kono
parents:
diff changeset
339 function Build_SS_Mark_Call
kono
parents:
diff changeset
340 (Loc : Source_Ptr;
kono
parents:
diff changeset
341 Mark : Entity_Id) return Node_Id;
kono
parents:
diff changeset
342 -- Build a call to routine System.Secondary_Stack.Mark. Mark denotes the
kono
parents:
diff changeset
343 -- entity of the secondary stack mark.
kono
parents:
diff changeset
344
kono
parents:
diff changeset
345 function Build_SS_Release_Call
kono
parents:
diff changeset
346 (Loc : Source_Ptr;
kono
parents:
diff changeset
347 Mark : Entity_Id) return Node_Id;
kono
parents:
diff changeset
348 -- Build a call to routine System.Secondary_Stack.Release. Mark denotes the
kono
parents:
diff changeset
349 -- entity of the secondary stack mark.
kono
parents:
diff changeset
350
kono
parents:
diff changeset
351 function Build_Task_Image_Decls
kono
parents:
diff changeset
352 (Loc : Source_Ptr;
kono
parents:
diff changeset
353 Id_Ref : Node_Id;
kono
parents:
diff changeset
354 A_Type : Entity_Id;
kono
parents:
diff changeset
355 In_Init_Proc : Boolean := False) return List_Id;
kono
parents:
diff changeset
356 -- Build declaration for a variable that holds an identifying string to be
kono
parents:
diff changeset
357 -- used as a task name. Id_Ref is an identifier if the task is a variable,
kono
parents:
diff changeset
358 -- and a selected or indexed component if the task is component of an
kono
parents:
diff changeset
359 -- object. If it is an indexed component, A_Type is the corresponding array
kono
parents:
diff changeset
360 -- type. Its index types are used to build the string as an image of the
kono
parents:
diff changeset
361 -- index values. For composite types, the result includes two declarations:
kono
parents:
diff changeset
362 -- one for a generated function that computes the image without using
kono
parents:
diff changeset
363 -- concatenation, and one for the variable that holds the result.
kono
parents:
diff changeset
364 --
kono
parents:
diff changeset
365 -- If In_Init_Proc is true, the call is part of the initialization of
kono
parents:
diff changeset
366 -- a component of a composite type, and the enclosing initialization
kono
parents:
diff changeset
367 -- procedure must be flagged as using the secondary stack. If In_Init_Proc
kono
parents:
diff changeset
368 -- is false, the call is for a stand-alone object, and the generated
kono
parents:
diff changeset
369 -- function itself must do its own cleanups.
kono
parents:
diff changeset
370
kono
parents:
diff changeset
371 procedure Build_Transient_Object_Statements
kono
parents:
diff changeset
372 (Obj_Decl : Node_Id;
kono
parents:
diff changeset
373 Fin_Call : out Node_Id;
kono
parents:
diff changeset
374 Hook_Assign : out Node_Id;
kono
parents:
diff changeset
375 Hook_Clear : out Node_Id;
kono
parents:
diff changeset
376 Hook_Decl : out Node_Id;
kono
parents:
diff changeset
377 Ptr_Decl : out Node_Id;
kono
parents:
diff changeset
378 Finalize_Obj : Boolean := True);
kono
parents:
diff changeset
379 -- Subsidiary to the processing of transient objects in transient scopes,
kono
parents:
diff changeset
380 -- if expressions, case expressions, expression_with_action nodes, array
kono
parents:
diff changeset
381 -- aggregates, and record aggregates. Obj_Decl denotes the declaration of
kono
parents:
diff changeset
382 -- the transient object. Generate the following nodes:
kono
parents:
diff changeset
383 --
kono
parents:
diff changeset
384 -- * Fin_Call - the call to [Deep_]Finalize which cleans up the transient
kono
parents:
diff changeset
385 -- object if flag Finalize_Obj is set to True, or finalizes the hook when
kono
parents:
diff changeset
386 -- the flag is False.
kono
parents:
diff changeset
387 --
kono
parents:
diff changeset
388 -- * Hook_Assign - the assignment statement which captures a reference to
kono
parents:
diff changeset
389 -- the transient object in the hook.
kono
parents:
diff changeset
390 --
kono
parents:
diff changeset
391 -- * Hook_Clear - the assignment statement which resets the hook to null
kono
parents:
diff changeset
392 --
kono
parents:
diff changeset
393 -- * Hook_Decl - the declaration of the hook object
kono
parents:
diff changeset
394 --
kono
parents:
diff changeset
395 -- * Ptr_Decl - the full type declaration of the hook type
kono
parents:
diff changeset
396 --
kono
parents:
diff changeset
397 -- These nodes are inserted in specific places depending on the context by
kono
parents:
diff changeset
398 -- the various Process_Transient_xxx routines.
kono
parents:
diff changeset
399
kono
parents:
diff changeset
400 procedure Check_Float_Op_Overflow (N : Node_Id);
kono
parents:
diff changeset
401 -- Called where we could have a floating-point binary operator where we
kono
parents:
diff changeset
402 -- must check for infinities if we are operating in Check_Float_Overflow
kono
parents:
diff changeset
403 -- mode. Note that we don't need to worry about unary operator cases,
kono
parents:
diff changeset
404 -- since for floating-point, abs, unary "-", and unary "+" can never
kono
parents:
diff changeset
405 -- case overflow.
kono
parents:
diff changeset
406
kono
parents:
diff changeset
407 function Component_May_Be_Bit_Aligned (Comp : Entity_Id) return Boolean;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
408 -- This function is in charge of detecting record components that may cause
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
409 -- trouble for the back end if an attempt is made to access the component
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
410 -- as a whole. The back end can handle such accesses with no problem if the
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
411 -- components involved are small (64 bits or less) records or scalar items
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
412 -- (including bit-packed arrays represented with a modular type), or else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
413 -- if they are aligned on byte boundaries (i.e. starting on a byte boundary
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
414 -- and occupying an integral number of bytes).
111
kono
parents:
diff changeset
415 --
kono
parents:
diff changeset
416 -- However, problems arise for records larger than 64 bits, or for arrays
kono
parents:
diff changeset
417 -- (other than bit-packed arrays represented with a modular type) if the
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
418 -- component either does not start on a byte boundary or does not occupy an
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
419 -- integral number of bytes (i.e. there are some bits possibly shared with
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
420 -- other components at the start or the end of the component). The back end
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
421 -- cannot handle loading from or storing to such components as a whole.
111
kono
parents:
diff changeset
422 --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
423 -- This function is used to detect the troublesome situation. It is meant
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
424 -- to be conservative in the sense that it produces True unless it knows
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
425 -- for sure that the component is safe (as outlined in the first paragraph
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
426 -- above). The processing for record and array assignment indirectly checks
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
427 -- for trouble using this function and, if so, the assignment is expanded
111
kono
parents:
diff changeset
428 -- component-wise, which the back end is required to handle correctly.
kono
parents:
diff changeset
429
kono
parents:
diff changeset
430 function Containing_Package_With_Ext_Axioms
kono
parents:
diff changeset
431 (E : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
432 -- Returns the package entity with an external axiomatization containing E,
kono
parents:
diff changeset
433 -- if any, or Empty if none.
kono
parents:
diff changeset
434
kono
parents:
diff changeset
435 procedure Convert_To_Actual_Subtype (Exp : Node_Id);
kono
parents:
diff changeset
436 -- The Etype of an expression is the nominal type of the expression,
kono
parents:
diff changeset
437 -- not the actual subtype. Often these are the same, but not always.
kono
parents:
diff changeset
438 -- For example, a reference to a formal of unconstrained type has the
kono
parents:
diff changeset
439 -- unconstrained type as its Etype, but the actual subtype is obtained by
kono
parents:
diff changeset
440 -- applying the actual bounds. This routine is given an expression, Exp,
kono
parents:
diff changeset
441 -- and (if necessary), replaces it using Rewrite, with a conversion to
kono
parents:
diff changeset
442 -- the actual subtype, building the actual subtype if necessary. If the
kono
parents:
diff changeset
443 -- expression is already of the requested type, then it is unchanged.
kono
parents:
diff changeset
444
kono
parents:
diff changeset
445 function Corresponding_Runtime_Package (Typ : Entity_Id) return RTU_Id;
kono
parents:
diff changeset
446 -- Return the id of the runtime package that will provide support for
kono
parents:
diff changeset
447 -- concurrent type Typ. Currently only protected types are supported,
kono
parents:
diff changeset
448 -- and the returned value is one of the following:
kono
parents:
diff changeset
449 -- System_Tasking_Protected_Objects
kono
parents:
diff changeset
450 -- System_Tasking_Protected_Objects_Entries
kono
parents:
diff changeset
451 -- System_Tasking_Protected_Objects_Single_Entry
kono
parents:
diff changeset
452
kono
parents:
diff changeset
453 function Current_Sem_Unit_Declarations return List_Id;
kono
parents:
diff changeset
454 -- Return the place where it is fine to insert declarations for the
kono
parents:
diff changeset
455 -- current semantic unit. If the unit is a package body, return the
kono
parents:
diff changeset
456 -- visible declarations of the corresponding spec. For RCI stubs, this
kono
parents:
diff changeset
457 -- is necessary because the point at which they are generated may not
kono
parents:
diff changeset
458 -- be the earliest point at which they are used.
kono
parents:
diff changeset
459
kono
parents:
diff changeset
460 function Duplicate_Subexpr
kono
parents:
diff changeset
461 (Exp : Node_Id;
kono
parents:
diff changeset
462 Name_Req : Boolean := False;
kono
parents:
diff changeset
463 Renaming_Req : Boolean := False) return Node_Id;
kono
parents:
diff changeset
464 -- Given the node for a subexpression, this function makes a logical copy
kono
parents:
diff changeset
465 -- of the subexpression, and returns it. This is intended for use when the
kono
parents:
diff changeset
466 -- expansion of an expression needs to repeat part of it. For example,
kono
parents:
diff changeset
467 -- replacing a**2 by a*a requires two references to a which may be a
kono
parents:
diff changeset
468 -- complex subexpression. Duplicate_Subexpr guarantees not to duplicate
kono
parents:
diff changeset
469 -- side effects. If necessary, it generates actions to save the expression
kono
parents:
diff changeset
470 -- value in a temporary, inserting these actions into the tree using
kono
parents:
diff changeset
471 -- Insert_Actions with Exp as the insertion location. The original
kono
parents:
diff changeset
472 -- expression and the returned result then become references to this saved
kono
parents:
diff changeset
473 -- value. Exp must be analyzed on entry. On return, Exp is analyzed, but
kono
parents:
diff changeset
474 -- the caller is responsible for analyzing the returned copy after it is
kono
parents:
diff changeset
475 -- attached to the tree.
kono
parents:
diff changeset
476 --
kono
parents:
diff changeset
477 -- The Name_Req flag is set to ensure that the result is suitable for use
kono
parents:
diff changeset
478 -- in a context requiring a name (for example, the prefix of an attribute
kono
parents:
diff changeset
479 -- reference) (can't this just be a qualification in Ada 2012???).
kono
parents:
diff changeset
480 --
kono
parents:
diff changeset
481 -- The Renaming_Req flag is set to produce an object renaming declaration
kono
parents:
diff changeset
482 -- rather than an object declaration. This is valid only if the expression
kono
parents:
diff changeset
483 -- Exp designates a renamable object. This is used for example in the case
kono
parents:
diff changeset
484 -- of an unchecked deallocation, to make sure the object gets set to null.
kono
parents:
diff changeset
485 --
kono
parents:
diff changeset
486 -- Note that if there are any run time checks in Exp, these same checks
kono
parents:
diff changeset
487 -- will be duplicated in the returned duplicated expression. The two
kono
parents:
diff changeset
488 -- following functions allow this behavior to be modified.
kono
parents:
diff changeset
489
kono
parents:
diff changeset
490 function Duplicate_Subexpr_No_Checks
kono
parents:
diff changeset
491 (Exp : Node_Id;
kono
parents:
diff changeset
492 Name_Req : Boolean := False;
kono
parents:
diff changeset
493 Renaming_Req : Boolean := False;
kono
parents:
diff changeset
494 Related_Id : Entity_Id := Empty;
kono
parents:
diff changeset
495 Is_Low_Bound : Boolean := False;
kono
parents:
diff changeset
496 Is_High_Bound : Boolean := False) return Node_Id;
kono
parents:
diff changeset
497 -- Identical in effect to Duplicate_Subexpr, except that Remove_Checks is
kono
parents:
diff changeset
498 -- called on the result, so that the duplicated expression does not include
kono
parents:
diff changeset
499 -- checks. This is appropriate for use when Exp, the original expression is
kono
parents:
diff changeset
500 -- unconditionally elaborated before the duplicated expression, so that
kono
parents:
diff changeset
501 -- there is no need to repeat any checks.
kono
parents:
diff changeset
502 --
kono
parents:
diff changeset
503 -- Related_Id denotes the entity of the context where Expr appears. Flags
kono
parents:
diff changeset
504 -- Is_Low_Bound and Is_High_Bound specify whether the expression to check
kono
parents:
diff changeset
505 -- is the low or the high bound of a range. These three optional arguments
kono
parents:
diff changeset
506 -- signal Remove_Side_Effects to create an external symbol of the form
kono
parents:
diff changeset
507 -- Chars (Related_Id)_FIRST/_LAST. For suggested use of these parameters
kono
parents:
diff changeset
508 -- see the warning in the body of Sem_Ch3.Process_Range_Expr_In_Decl.
kono
parents:
diff changeset
509
kono
parents:
diff changeset
510 function Duplicate_Subexpr_Move_Checks
kono
parents:
diff changeset
511 (Exp : Node_Id;
kono
parents:
diff changeset
512 Name_Req : Boolean := False;
kono
parents:
diff changeset
513 Renaming_Req : Boolean := False) return Node_Id;
kono
parents:
diff changeset
514 -- Identical in effect to Duplicate_Subexpr, except that Remove_Checks is
kono
parents:
diff changeset
515 -- called on Exp after the duplication is complete, so that the original
kono
parents:
diff changeset
516 -- expression does not include checks. In this case the result returned
kono
parents:
diff changeset
517 -- (the duplicated expression) will retain the original checks. This is
kono
parents:
diff changeset
518 -- appropriate for use when the duplicated expression is sure to be
kono
parents:
diff changeset
519 -- elaborated before the original expression Exp, so that there is no need
kono
parents:
diff changeset
520 -- to repeat the checks.
kono
parents:
diff changeset
521
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
522 function Enclosing_Init_Proc return Entity_Id;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
523 -- Obtain the entity of the type initialization procedure which encloses
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
524 -- the current scope. Return Empty if no such procedure exists.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
525
111
kono
parents:
diff changeset
526 procedure Ensure_Defined (Typ : Entity_Id; N : Node_Id);
kono
parents:
diff changeset
527 -- This procedure ensures that type referenced by Typ is defined. For the
kono
parents:
diff changeset
528 -- case of a type other than an Itype, nothing needs to be done, since
kono
parents:
diff changeset
529 -- all such types have declaration nodes. For Itypes, an N_Itype_Reference
kono
parents:
diff changeset
530 -- node is generated and inserted as an action on node N. This is typically
kono
parents:
diff changeset
531 -- used to ensure that an Itype is properly defined outside a conditional
kono
parents:
diff changeset
532 -- construct when it is referenced in more than one branch.
kono
parents:
diff changeset
533
kono
parents:
diff changeset
534 function Entry_Names_OK return Boolean;
kono
parents:
diff changeset
535 -- Determine whether it is appropriate to dynamically allocate strings
kono
parents:
diff changeset
536 -- which represent entry [family member] names. These strings are created
kono
parents:
diff changeset
537 -- by the compiler and used by GDB.
kono
parents:
diff changeset
538
kono
parents:
diff changeset
539 procedure Evaluate_Name (Nam : Node_Id);
kono
parents:
diff changeset
540 -- Remove all side effects from a name which appears as part of an object
kono
parents:
diff changeset
541 -- renaming declaration. Similarly to Force_Evaluation, it removes the
kono
parents:
diff changeset
542 -- side effects and captures the values of the variables, except for the
kono
parents:
diff changeset
543 -- variable being renamed. Hence this differs from Force_Evaluation and
kono
parents:
diff changeset
544 -- Remove_Side_Effects (but it calls Force_Evaluation on subexpressions
kono
parents:
diff changeset
545 -- whose value needs to be fixed).
kono
parents:
diff changeset
546
kono
parents:
diff changeset
547 procedure Evolve_And_Then (Cond : in out Node_Id; Cond1 : Node_Id);
kono
parents:
diff changeset
548 -- Rewrites Cond with the expression: Cond and then Cond1. If Cond is
kono
parents:
diff changeset
549 -- Empty, then simply returns Cond1 (this allows the use of Empty to
kono
parents:
diff changeset
550 -- initialize a series of checks evolved by this routine, with a final
kono
parents:
diff changeset
551 -- result of Empty indicating that no checks were required). The Sloc field
kono
parents:
diff changeset
552 -- of the constructed N_And_Then node is copied from Cond1.
kono
parents:
diff changeset
553
kono
parents:
diff changeset
554 procedure Evolve_Or_Else (Cond : in out Node_Id; Cond1 : Node_Id);
kono
parents:
diff changeset
555 -- Rewrites Cond with the expression: Cond or else Cond1. If Cond is Empty,
kono
parents:
diff changeset
556 -- then simply returns Cond1 (this allows the use of Empty to initialize a
kono
parents:
diff changeset
557 -- series of checks evolved by this routine, with a final result of Empty
kono
parents:
diff changeset
558 -- indicating that no checks were required). The Sloc field of the
kono
parents:
diff changeset
559 -- constructed N_Or_Else node is copied from Cond1.
kono
parents:
diff changeset
560
kono
parents:
diff changeset
561 procedure Expand_Static_Predicates_In_Choices (N : Node_Id);
kono
parents:
diff changeset
562 -- N is either a case alternative or a variant. The Discrete_Choices field
kono
parents:
diff changeset
563 -- of N points to a list of choices. If any of these choices is the name
kono
parents:
diff changeset
564 -- of a (statically) predicated subtype, then it is rewritten as the series
kono
parents:
diff changeset
565 -- of choices that correspond to the values allowed for the subtype.
kono
parents:
diff changeset
566
kono
parents:
diff changeset
567 procedure Expand_Subtype_From_Expr
kono
parents:
diff changeset
568 (N : Node_Id;
kono
parents:
diff changeset
569 Unc_Type : Entity_Id;
kono
parents:
diff changeset
570 Subtype_Indic : Node_Id;
kono
parents:
diff changeset
571 Exp : Node_Id;
kono
parents:
diff changeset
572 Related_Id : Entity_Id := Empty);
kono
parents:
diff changeset
573 -- Build a constrained subtype from the initial value in object
kono
parents:
diff changeset
574 -- declarations and/or allocations when the type is indefinite (including
kono
parents:
diff changeset
575 -- class-wide). Set Related_Id to request an external name for the subtype
kono
parents:
diff changeset
576 -- rather than an internal temporary.
kono
parents:
diff changeset
577
kono
parents:
diff changeset
578 function Expression_Contains_Primitives_Calls_Of
kono
parents:
diff changeset
579 (Expr : Node_Id;
kono
parents:
diff changeset
580 Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
581 -- Return True if the expression Expr contains a nondispatching call to a
kono
parents:
diff changeset
582 -- function which is a primitive of the tagged type Typ.
kono
parents:
diff changeset
583
kono
parents:
diff changeset
584 function Finalize_Address (Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
585 -- Locate TSS primitive Finalize_Address in type Typ. Return Empty if the
kono
parents:
diff changeset
586 -- subprogram is not available.
kono
parents:
diff changeset
587
kono
parents:
diff changeset
588 function Find_Interface_ADT
kono
parents:
diff changeset
589 (T : Entity_Id;
kono
parents:
diff changeset
590 Iface : Entity_Id) return Elmt_Id;
kono
parents:
diff changeset
591 -- Ada 2005 (AI-251): Given a type T implementing the interface Iface,
kono
parents:
diff changeset
592 -- return the element of Access_Disp_Table containing the tag of the
kono
parents:
diff changeset
593 -- interface.
kono
parents:
diff changeset
594
kono
parents:
diff changeset
595 function Find_Interface_Tag
kono
parents:
diff changeset
596 (T : Entity_Id;
kono
parents:
diff changeset
597 Iface : Entity_Id) return Entity_Id;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
598 -- Ada 2005 (AI-251): Given a type T and an interface Iface, return the
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
599 -- record component containing the tag of Iface if T implements Iface or
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
600 -- Empty if it does not.
111
kono
parents:
diff changeset
601
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
602 -- WARNING: There is a matching C declaration of this subprogram in fe.h
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
603
111
kono
parents:
diff changeset
604 function Find_Prim_Op (T : Entity_Id; Name : Name_Id) return Entity_Id;
kono
parents:
diff changeset
605 -- Find the first primitive operation of a tagged type T with name Name.
kono
parents:
diff changeset
606 -- This function allows the use of a primitive operation which is not
kono
parents:
diff changeset
607 -- directly visible. If T is a class wide type, then the reference is to an
kono
parents:
diff changeset
608 -- operation of the corresponding root type. It is an error if no primitive
kono
parents:
diff changeset
609 -- operation with the given name is found.
kono
parents:
diff changeset
610
kono
parents:
diff changeset
611 function Find_Prim_Op
kono
parents:
diff changeset
612 (T : Entity_Id;
kono
parents:
diff changeset
613 Name : TSS_Name_Type) return Entity_Id;
kono
parents:
diff changeset
614 -- Same as Find_Prim_Op above, except we're searching for an op that has
kono
parents:
diff changeset
615 -- the form indicated by Name (i.e. is a type support subprogram with the
kono
parents:
diff changeset
616 -- indicated suffix).
kono
parents:
diff changeset
617
kono
parents:
diff changeset
618 function Find_Optional_Prim_Op
kono
parents:
diff changeset
619 (T : Entity_Id; Name : Name_Id) return Entity_Id;
kono
parents:
diff changeset
620 function Find_Optional_Prim_Op
kono
parents:
diff changeset
621 (T : Entity_Id;
kono
parents:
diff changeset
622 Name : TSS_Name_Type) return Entity_Id;
kono
parents:
diff changeset
623 -- Same as Find_Prim_Op, except returns Empty if not found
kono
parents:
diff changeset
624
kono
parents:
diff changeset
625 function Find_Protection_Object (Scop : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
626 -- Traverse the scope stack starting from Scop and look for an entry, entry
kono
parents:
diff changeset
627 -- family, or a subprogram that has a Protection_Object and return it. Must
kono
parents:
diff changeset
628 -- always return a value since the context in which this routine is invoked
kono
parents:
diff changeset
629 -- should always have a protection object.
kono
parents:
diff changeset
630
kono
parents:
diff changeset
631 function Find_Protection_Type (Conc_Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
632 -- Given a protected type or its corresponding record, find the type of
kono
parents:
diff changeset
633 -- field _object.
kono
parents:
diff changeset
634
kono
parents:
diff changeset
635 function Find_Hook_Context (N : Node_Id) return Node_Id;
kono
parents:
diff changeset
636 -- Determine a suitable node on which to attach actions related to N that
kono
parents:
diff changeset
637 -- need to be elaborated unconditionally. In general this is the topmost
kono
parents:
diff changeset
638 -- expression of which N is a subexpression, which in turn may or may not
kono
parents:
diff changeset
639 -- be evaluated, for example if N is the right operand of a short circuit
kono
parents:
diff changeset
640 -- operator.
kono
parents:
diff changeset
641
kono
parents:
diff changeset
642 function Following_Address_Clause (D : Node_Id) return Node_Id;
kono
parents:
diff changeset
643 -- D is the node for an object declaration. This function searches the
kono
parents:
diff changeset
644 -- current declarative part to look for an address clause for the object
kono
parents:
diff changeset
645 -- being declared, and returns the clause if one is found, returns
kono
parents:
diff changeset
646 -- Empty otherwise.
kono
parents:
diff changeset
647 --
kono
parents:
diff changeset
648 -- Note: this function can be costly and must be invoked with special care.
kono
parents:
diff changeset
649 -- Possibly we could introduce a flag at parse time indicating the presence
kono
parents:
diff changeset
650 -- of an address clause to speed this up???
kono
parents:
diff changeset
651 --
kono
parents:
diff changeset
652 -- Note: currently this function does not scan the private part, that seems
kono
parents:
diff changeset
653 -- like a potential bug ???
kono
parents:
diff changeset
654
kono
parents:
diff changeset
655 type Force_Evaluation_Mode is (Relaxed, Strict);
kono
parents:
diff changeset
656
kono
parents:
diff changeset
657 procedure Force_Evaluation
kono
parents:
diff changeset
658 (Exp : Node_Id;
kono
parents:
diff changeset
659 Name_Req : Boolean := False;
kono
parents:
diff changeset
660 Related_Id : Entity_Id := Empty;
kono
parents:
diff changeset
661 Is_Low_Bound : Boolean := False;
kono
parents:
diff changeset
662 Is_High_Bound : Boolean := False;
kono
parents:
diff changeset
663 Mode : Force_Evaluation_Mode := Relaxed);
kono
parents:
diff changeset
664 -- Force the evaluation of the expression right away. Similar behavior
kono
parents:
diff changeset
665 -- to Remove_Side_Effects when Variable_Ref is set to TRUE. That is to
kono
parents:
diff changeset
666 -- say, it removes the side effects and captures the values of the
kono
parents:
diff changeset
667 -- variables. Remove_Side_Effects guarantees that multiple evaluations
kono
parents:
diff changeset
668 -- of the same expression won't generate multiple side effects, whereas
kono
parents:
diff changeset
669 -- Force_Evaluation further guarantees that all evaluations will yield
kono
parents:
diff changeset
670 -- the same result. If Mode is Relaxed then calls to this subprogram have
kono
parents:
diff changeset
671 -- no effect if Exp is side-effect free; if Mode is Strict and Exp is not
kono
parents:
diff changeset
672 -- a static expression then no side-effect check is performed on Exp and
kono
parents:
diff changeset
673 -- temporaries are unconditionally generated.
kono
parents:
diff changeset
674 --
kono
parents:
diff changeset
675 -- Related_Id denotes the entity of the context where Expr appears. Flags
kono
parents:
diff changeset
676 -- Is_Low_Bound and Is_High_Bound specify whether the expression to check
kono
parents:
diff changeset
677 -- is the low or the high bound of a range. These three optional arguments
kono
parents:
diff changeset
678 -- signal Remove_Side_Effects to create an external symbol of the form
kono
parents:
diff changeset
679 -- Chars (Related_Id)_FIRST/_LAST. If Related_Id is set, then exactly one
kono
parents:
diff changeset
680 -- of the Is_xxx_Bound flags must be set. For use of these parameters see
kono
parents:
diff changeset
681 -- the warning in the body of Sem_Ch3.Process_Range_Expr_In_Decl.
kono
parents:
diff changeset
682
kono
parents:
diff changeset
683 function Fully_Qualified_Name_String
kono
parents:
diff changeset
684 (E : Entity_Id;
kono
parents:
diff changeset
685 Append_NUL : Boolean := True) return String_Id;
kono
parents:
diff changeset
686 -- Generates the string literal corresponding to the fully qualified name
kono
parents:
diff changeset
687 -- of entity E, in all upper case, with an ASCII.NUL appended at the end
kono
parents:
diff changeset
688 -- of the name if Append_NUL is True.
kono
parents:
diff changeset
689
kono
parents:
diff changeset
690 procedure Generate_Poll_Call (N : Node_Id);
kono
parents:
diff changeset
691 -- If polling is active, then a call to the Poll routine is built,
kono
parents:
diff changeset
692 -- and then inserted before the given node N and analyzed.
kono
parents:
diff changeset
693
kono
parents:
diff changeset
694 procedure Get_Current_Value_Condition
kono
parents:
diff changeset
695 (Var : Node_Id;
kono
parents:
diff changeset
696 Op : out Node_Kind;
kono
parents:
diff changeset
697 Val : out Node_Id);
kono
parents:
diff changeset
698 -- This routine processes the Current_Value field of the variable Var. If
kono
parents:
diff changeset
699 -- the Current_Value field is null or if it represents a known value, then
kono
parents:
diff changeset
700 -- on return Cond is set to N_Empty, and Val is set to Empty.
kono
parents:
diff changeset
701 --
kono
parents:
diff changeset
702 -- The other case is when Current_Value points to an N_If_Statement or an
kono
parents:
diff changeset
703 -- N_Elsif_Part or a N_Iteration_Scheme node (see description in Einfo for
kono
parents:
diff changeset
704 -- exact details). In this case, Get_Current_Condition digs out the
kono
parents:
diff changeset
705 -- condition, and then checks if the condition is known false, known true,
kono
parents:
diff changeset
706 -- or not known at all. In the first two cases, Get_Current_Condition will
kono
parents:
diff changeset
707 -- return with Op set to the appropriate conditional operator (inverted if
kono
parents:
diff changeset
708 -- the condition is known false), and Val set to the constant value. If the
kono
parents:
diff changeset
709 -- condition is not known, then Op and Val are set for the empty case
kono
parents:
diff changeset
710 -- (N_Empty and Empty).
kono
parents:
diff changeset
711 --
kono
parents:
diff changeset
712 -- The check for whether the condition is true/false unknown depends
kono
parents:
diff changeset
713 -- on the case:
kono
parents:
diff changeset
714 --
kono
parents:
diff changeset
715 -- For an IF, the condition is known true in the THEN part, known false
kono
parents:
diff changeset
716 -- in any ELSIF or ELSE part, and not known outside the IF statement in
kono
parents:
diff changeset
717 -- question.
kono
parents:
diff changeset
718 --
kono
parents:
diff changeset
719 -- For an ELSIF, the condition is known true in the ELSIF part, known
kono
parents:
diff changeset
720 -- FALSE in any subsequent ELSIF, or ELSE part, and not known before the
kono
parents:
diff changeset
721 -- ELSIF, or after the end of the IF statement.
kono
parents:
diff changeset
722 --
kono
parents:
diff changeset
723 -- The caller can use this result to determine the value (for the case of
kono
parents:
diff changeset
724 -- N_Op_Eq), or to determine the result of some other test in other cases
kono
parents:
diff changeset
725 -- (e.g. no access check required if N_Op_Ne Null).
kono
parents:
diff changeset
726
kono
parents:
diff changeset
727 function Get_Stream_Size (E : Entity_Id) return Uint;
kono
parents:
diff changeset
728 -- Return the stream size value of the subtype E
kono
parents:
diff changeset
729
kono
parents:
diff changeset
730 function Has_Access_Constraint (E : Entity_Id) return Boolean;
kono
parents:
diff changeset
731 -- Given object or type E, determine if a discriminant is of an access type
kono
parents:
diff changeset
732
kono
parents:
diff changeset
733 function Has_Annotate_Pragma_For_External_Axiomatization
kono
parents:
diff changeset
734 (E : Entity_Id) return Boolean;
kono
parents:
diff changeset
735 -- Returns whether E is a package entity, for which the initial list of
kono
parents:
diff changeset
736 -- pragmas at the start of the package declaration contains
kono
parents:
diff changeset
737 -- pragma Annotate (GNATprove, External_Axiomatization);
kono
parents:
diff changeset
738
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
739 function Homonym_Number (Subp : Entity_Id) return Pos;
111
kono
parents:
diff changeset
740 -- Here subp is the entity for a subprogram. This routine returns the
kono
parents:
diff changeset
741 -- homonym number used to disambiguate overloaded subprograms in the same
kono
parents:
diff changeset
742 -- scope (the number is used as part of constructed names to make sure that
kono
parents:
diff changeset
743 -- they are unique). The number is the ordinal position on the Homonym
kono
parents:
diff changeset
744 -- chain, counting only entries in the current scope. If an entity is not
kono
parents:
diff changeset
745 -- overloaded, the returned number will be one.
kono
parents:
diff changeset
746
kono
parents:
diff changeset
747 function Inside_Init_Proc return Boolean;
kono
parents:
diff changeset
748 -- Returns True if current scope is within an init proc
kono
parents:
diff changeset
749
kono
parents:
diff changeset
750 function In_Library_Level_Package_Body (Id : Entity_Id) return Boolean;
kono
parents:
diff changeset
751 -- Given an arbitrary entity, determine whether it appears at the library
kono
parents:
diff changeset
752 -- level of a package body.
kono
parents:
diff changeset
753
kono
parents:
diff changeset
754 function In_Unconditional_Context (Node : Node_Id) return Boolean;
kono
parents:
diff changeset
755 -- Node is the node for a statement or a component of a statement. This
kono
parents:
diff changeset
756 -- function determines if the statement appears in a context that is
kono
parents:
diff changeset
757 -- unconditionally executed, i.e. it is not within a loop or a conditional
kono
parents:
diff changeset
758 -- or a case statement etc.
kono
parents:
diff changeset
759
kono
parents:
diff changeset
760 function Is_All_Null_Statements (L : List_Id) return Boolean;
kono
parents:
diff changeset
761 -- Return True if all the items of the list are N_Null_Statement nodes.
kono
parents:
diff changeset
762 -- False otherwise. True for an empty list. It is an error to call this
kono
parents:
diff changeset
763 -- routine with No_List as the argument.
kono
parents:
diff changeset
764
kono
parents:
diff changeset
765 function Is_Displacement_Of_Object_Or_Function_Result
kono
parents:
diff changeset
766 (Obj_Id : Entity_Id) return Boolean;
kono
parents:
diff changeset
767 -- Determine whether Obj_Id is a source entity that has been initialized by
kono
parents:
diff changeset
768 -- either a controlled function call or the assignment of another source
kono
parents:
diff changeset
769 -- object. In both cases the initialization expression is rewritten as a
kono
parents:
diff changeset
770 -- class-wide conversion of Ada.Tags.Displace.
kono
parents:
diff changeset
771
kono
parents:
diff changeset
772 function Is_Finalizable_Transient
kono
parents:
diff changeset
773 (Decl : Node_Id;
kono
parents:
diff changeset
774 Rel_Node : Node_Id) return Boolean;
kono
parents:
diff changeset
775 -- Determine whether declaration Decl denotes a controlled transient which
kono
parents:
diff changeset
776 -- should be finalized. Rel_Node is the related context. Even though some
kono
parents:
diff changeset
777 -- transients are controlled, they may act as renamings of other objects or
kono
parents:
diff changeset
778 -- function calls.
kono
parents:
diff changeset
779
kono
parents:
diff changeset
780 function Is_Fully_Repped_Tagged_Type (T : Entity_Id) return Boolean;
kono
parents:
diff changeset
781 -- Tests given type T, and returns True if T is a non-discriminated tagged
kono
parents:
diff changeset
782 -- type which has a record representation clause that specifies the layout
kono
parents:
diff changeset
783 -- of all the components, including recursively components in all parent
kono
parents:
diff changeset
784 -- types. We exclude discriminated types for convenience, it is extremely
kono
parents:
diff changeset
785 -- unlikely that the special processing associated with the use of this
kono
parents:
diff changeset
786 -- routine is useful for the case of a discriminated type, and testing for
kono
parents:
diff changeset
787 -- component overlap would be a pain.
kono
parents:
diff changeset
788
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
789 -- WARNING: There is a matching C declaration of this subprogram in fe.h
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
790
111
kono
parents:
diff changeset
791 function Is_Library_Level_Tagged_Type (Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
792 -- Return True if Typ is a library level tagged type. Currently we use
kono
parents:
diff changeset
793 -- this information to build statically allocated dispatch tables.
kono
parents:
diff changeset
794
kono
parents:
diff changeset
795 function Is_Non_BIP_Func_Call (Expr : Node_Id) return Boolean;
kono
parents:
diff changeset
796 -- Determine whether node Expr denotes a non build-in-place function call
kono
parents:
diff changeset
797
kono
parents:
diff changeset
798 function Is_Possibly_Unaligned_Object (N : Node_Id) return Boolean;
kono
parents:
diff changeset
799 -- Node N is an object reference. This function returns True if it is
kono
parents:
diff changeset
800 -- possible that the object may not be aligned according to the normal
kono
parents:
diff changeset
801 -- default alignment requirement for its type (e.g. if it appears in a
kono
parents:
diff changeset
802 -- packed record, or as part of a component that has a component clause.)
kono
parents:
diff changeset
803
kono
parents:
diff changeset
804 function Is_Possibly_Unaligned_Slice (N : Node_Id) return Boolean;
kono
parents:
diff changeset
805 -- Determine whether the node P is a slice of an array where the slice
kono
parents:
diff changeset
806 -- result may cause alignment problems because it has an alignment that
kono
parents:
diff changeset
807 -- is not compatible with the type. Return True if so.
kono
parents:
diff changeset
808
kono
parents:
diff changeset
809 function Is_Ref_To_Bit_Packed_Array (N : Node_Id) return Boolean;
kono
parents:
diff changeset
810 -- Determine whether the node P is a reference to a bit packed array, i.e.
kono
parents:
diff changeset
811 -- whether the designated object is a component of a bit packed array, or a
kono
parents:
diff changeset
812 -- subcomponent of such a component. If so, then all subscripts in P are
kono
parents:
diff changeset
813 -- evaluated with a call to Force_Evaluation, and True is returned.
kono
parents:
diff changeset
814 -- Otherwise False is returned, and P is not affected.
kono
parents:
diff changeset
815
kono
parents:
diff changeset
816 function Is_Ref_To_Bit_Packed_Slice (N : Node_Id) return Boolean;
kono
parents:
diff changeset
817 -- Determine whether the node P is a reference to a bit packed slice, i.e.
kono
parents:
diff changeset
818 -- whether the designated object is bit packed slice or a component of a
kono
parents:
diff changeset
819 -- bit packed slice. Return True if so.
kono
parents:
diff changeset
820
kono
parents:
diff changeset
821 function Is_Related_To_Func_Return (Id : Entity_Id) return Boolean;
kono
parents:
diff changeset
822 -- Determine whether object Id is related to an expanded return statement.
kono
parents:
diff changeset
823 -- The case concerned is "return Id.all;".
kono
parents:
diff changeset
824
kono
parents:
diff changeset
825 function Is_Renamed_Object (N : Node_Id) return Boolean;
kono
parents:
diff changeset
826 -- Returns True if the node N is a renamed object. An expression is
kono
parents:
diff changeset
827 -- considered to be a renamed object if either it is the Name of an object
kono
parents:
diff changeset
828 -- renaming declaration, or is the prefix of a name which is a renamed
kono
parents:
diff changeset
829 -- object. For example, in:
kono
parents:
diff changeset
830 --
kono
parents:
diff changeset
831 -- x : r renames a (1 .. 2) (1);
kono
parents:
diff changeset
832 --
kono
parents:
diff changeset
833 -- We consider that a (1 .. 2) is a renamed object since it is the prefix
kono
parents:
diff changeset
834 -- of the name in the renaming declaration.
kono
parents:
diff changeset
835
kono
parents:
diff changeset
836 function Is_Secondary_Stack_BIP_Func_Call (Expr : Node_Id) return Boolean;
kono
parents:
diff changeset
837 -- Determine whether Expr denotes a build-in-place function which returns
kono
parents:
diff changeset
838 -- its result on the secondary stack.
kono
parents:
diff changeset
839
kono
parents:
diff changeset
840 function Is_Tag_To_Class_Wide_Conversion
kono
parents:
diff changeset
841 (Obj_Id : Entity_Id) return Boolean;
kono
parents:
diff changeset
842 -- Determine whether object Obj_Id is the result of a tag-to-class-wide
kono
parents:
diff changeset
843 -- type conversion.
kono
parents:
diff changeset
844
kono
parents:
diff changeset
845 function Is_Untagged_Derivation (T : Entity_Id) return Boolean;
kono
parents:
diff changeset
846 -- Returns true if type T is not tagged and is a derived type,
kono
parents:
diff changeset
847 -- or is a private type whose completion is such a type.
kono
parents:
diff changeset
848
kono
parents:
diff changeset
849 function Is_Untagged_Private_Derivation
kono
parents:
diff changeset
850 (Priv_Typ : Entity_Id;
kono
parents:
diff changeset
851 Full_Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
852 -- Determine whether private type Priv_Typ and its full view Full_Typ
kono
parents:
diff changeset
853 -- represent an untagged derivation from a private parent.
kono
parents:
diff changeset
854
kono
parents:
diff changeset
855 function Is_Volatile_Reference (N : Node_Id) return Boolean;
kono
parents:
diff changeset
856 -- Checks if the node N represents a volatile reference, which can be
kono
parents:
diff changeset
857 -- either a direct reference to a variable treated as volatile, or an
kono
parents:
diff changeset
858 -- indexed/selected component where the prefix is treated as volatile,
kono
parents:
diff changeset
859 -- or has Volatile_Components set. A slice of a volatile variable is
kono
parents:
diff changeset
860 -- also volatile.
kono
parents:
diff changeset
861
kono
parents:
diff changeset
862 procedure Kill_Dead_Code (N : Node_Id; Warn : Boolean := False);
kono
parents:
diff changeset
863 -- N represents a node for a section of code that is known to be dead. Any
kono
parents:
diff changeset
864 -- exception handler references and warning messages relating to this code
kono
parents:
diff changeset
865 -- are removed. If Warn is True, a warning will be output at the start of N
kono
parents:
diff changeset
866 -- indicating the deletion of the code. Note that the tree for the deleted
kono
parents:
diff changeset
867 -- code is left intact so that e.g. cross-reference data is still valid.
kono
parents:
diff changeset
868
kono
parents:
diff changeset
869 procedure Kill_Dead_Code (L : List_Id; Warn : Boolean := False);
kono
parents:
diff changeset
870 -- Like the above procedure, but applies to every element in the given
kono
parents:
diff changeset
871 -- list. If Warn is True, a warning will be output at the start of N
kono
parents:
diff changeset
872 -- indicating the deletion of the code.
kono
parents:
diff changeset
873
kono
parents:
diff changeset
874 function Known_Non_Negative (Opnd : Node_Id) return Boolean;
kono
parents:
diff changeset
875 -- Given a node for a subexpression, determines if it represents a value
kono
parents:
diff changeset
876 -- that cannot possibly be negative, and if so returns True. A value of
kono
parents:
diff changeset
877 -- False means that it is not known if the value is positive or negative.
kono
parents:
diff changeset
878
kono
parents:
diff changeset
879 function Make_Invariant_Call (Expr : Node_Id) return Node_Id;
kono
parents:
diff changeset
880 -- Generate a call to the Invariant_Procedure associated with the type of
kono
parents:
diff changeset
881 -- expression Expr. Expr is passed as an actual parameter in the call.
kono
parents:
diff changeset
882
kono
parents:
diff changeset
883 function Make_Predicate_Call
kono
parents:
diff changeset
884 (Typ : Entity_Id;
kono
parents:
diff changeset
885 Expr : Node_Id;
kono
parents:
diff changeset
886 Mem : Boolean := False) return Node_Id;
kono
parents:
diff changeset
887 -- Typ is a type with Predicate_Function set. This routine builds a call to
kono
parents:
diff changeset
888 -- this function passing Expr as the argument, and returns it unanalyzed.
kono
parents:
diff changeset
889 -- If Mem is set True, this is the special call for the membership case,
kono
parents:
diff changeset
890 -- and the function called is the Predicate_Function_M if present.
kono
parents:
diff changeset
891
kono
parents:
diff changeset
892 function Make_Predicate_Check
kono
parents:
diff changeset
893 (Typ : Entity_Id;
kono
parents:
diff changeset
894 Expr : Node_Id) return Node_Id;
kono
parents:
diff changeset
895 -- Typ is a type with Predicate_Function set. This routine builds a Check
kono
parents:
diff changeset
896 -- pragma whose first argument is Predicate, and the second argument is
kono
parents:
diff changeset
897 -- a call to the predicate function of Typ with Expr as the argument. If
kono
parents:
diff changeset
898 -- Predicate_Check is suppressed then a null statement is returned instead.
kono
parents:
diff changeset
899
kono
parents:
diff changeset
900 function Make_Subtype_From_Expr
kono
parents:
diff changeset
901 (E : Node_Id;
kono
parents:
diff changeset
902 Unc_Typ : Entity_Id;
kono
parents:
diff changeset
903 Related_Id : Entity_Id := Empty) return Node_Id;
kono
parents:
diff changeset
904 -- Returns a subtype indication corresponding to the actual type of an
kono
parents:
diff changeset
905 -- expression E. Unc_Typ is an unconstrained array or record, or a class-
kono
parents:
diff changeset
906 -- wide type. Set Related_Id to request an external name for the subtype
kono
parents:
diff changeset
907 -- rather than an internal temporary.
kono
parents:
diff changeset
908
kono
parents:
diff changeset
909 procedure Map_Types (Parent_Type : Entity_Id; Derived_Type : Entity_Id);
kono
parents:
diff changeset
910 -- Establish the following mapping between the attributes of tagged parent
kono
parents:
diff changeset
911 -- type Parent_Type and tagged derived type Derived_Type.
kono
parents:
diff changeset
912 --
kono
parents:
diff changeset
913 -- * Map each discriminant of Parent_Type to ether the corresponding
kono
parents:
diff changeset
914 -- discriminant of Derived_Type or come constraint.
kono
parents:
diff changeset
915
kono
parents:
diff changeset
916 -- * Map each primitive operation of Parent_Type to the corresponding
kono
parents:
diff changeset
917 -- primitive of Derived_Type.
kono
parents:
diff changeset
918 --
kono
parents:
diff changeset
919 -- The mapping Parent_Type -> Derived_Type is also added to the table in
kono
parents:
diff changeset
920 -- order to prevent subsequent attempts of the same mapping.
kono
parents:
diff changeset
921
kono
parents:
diff changeset
922 function Matching_Standard_Type (Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
923 -- Given a scalar subtype Typ, returns a matching type in standard that
kono
parents:
diff changeset
924 -- has the same object size value. For example, a 16 bit signed type will
kono
parents:
diff changeset
925 -- typically return Standard_Short_Integer. For fixed-point types, this
kono
parents:
diff changeset
926 -- will return integer types of the corresponding size.
kono
parents:
diff changeset
927
kono
parents:
diff changeset
928 function May_Generate_Large_Temp (Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
929 -- Determines if the given type, Typ, may require a large temporary of the
kono
parents:
diff changeset
930 -- kind that causes back-end trouble if stack checking is enabled. The
kono
parents:
diff changeset
931 -- result is True only the size of the type is known at compile time and
kono
parents:
diff changeset
932 -- large, where large is defined heuristically by the body of this routine.
kono
parents:
diff changeset
933 -- The purpose of this routine is to help avoid generating troublesome
kono
parents:
diff changeset
934 -- temporaries that interfere with stack checking mechanism. Note that the
kono
parents:
diff changeset
935 -- caller has to check whether stack checking is actually enabled in order
kono
parents:
diff changeset
936 -- to guide the expansion (typically of a function call).
kono
parents:
diff changeset
937
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
938 function Needs_Conditional_Null_Excluding_Check
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
939 (Typ : Entity_Id) return Boolean;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
940 -- Check if a type meets certain properties that require it to have a
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
941 -- conditional null-excluding check within its Init_Proc.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
942
111
kono
parents:
diff changeset
943 function Needs_Constant_Address
kono
parents:
diff changeset
944 (Decl : Node_Id;
kono
parents:
diff changeset
945 Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
946 -- Check whether the expression in an address clause is restricted to
kono
parents:
diff changeset
947 -- consist of constants, when the object has a nontrivial initialization
kono
parents:
diff changeset
948 -- or is controlled.
kono
parents:
diff changeset
949
kono
parents:
diff changeset
950 function Non_Limited_Designated_Type (T : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
951 -- An anonymous access type may designate a limited view. Check whether
kono
parents:
diff changeset
952 -- non-limited view is available during expansion, to examine components
kono
parents:
diff changeset
953 -- or other characteristics of the full type.
kono
parents:
diff changeset
954
kono
parents:
diff changeset
955 function OK_To_Do_Constant_Replacement (E : Entity_Id) return Boolean;
kono
parents:
diff changeset
956 -- This function is used when testing whether or not to replace a reference
kono
parents:
diff changeset
957 -- to entity E by a known constant value. Such replacement must be done
kono
parents:
diff changeset
958 -- only in a scope known to be safe for such replacements. In particular,
kono
parents:
diff changeset
959 -- if we are within a subprogram and the entity E is declared outside the
kono
parents:
diff changeset
960 -- subprogram then we cannot do the replacement, since we do not attempt to
kono
parents:
diff changeset
961 -- trace subprogram call flow. It is also unsafe to replace statically
kono
parents:
diff changeset
962 -- allocated values (since they can be modified outside the scope), and we
kono
parents:
diff changeset
963 -- also inhibit replacement of Volatile or aliased objects since their
kono
parents:
diff changeset
964 -- address might be captured in a way we do not detect. A value of True is
kono
parents:
diff changeset
965 -- returned only if the replacement is safe.
kono
parents:
diff changeset
966
kono
parents:
diff changeset
967 function Possible_Bit_Aligned_Component (N : Node_Id) return Boolean;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
968 -- This function is used during processing the assignment of a record or an
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
969 -- array, or the construction of an aggregate. The argument N is either the
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
970 -- left or the right hand side of an assignment and the function determines
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
971 -- whether there is a record component reference where the component may be
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
972 -- bit aligned in a manner that causes trouble for the back end (see also
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
973 -- Component_May_Be_Bit_Aligned for further details).
111
kono
parents:
diff changeset
974
kono
parents:
diff changeset
975 function Power_Of_Two (N : Node_Id) return Nat;
kono
parents:
diff changeset
976 -- Determines if N is a known at compile time value which is of the form
kono
parents:
diff changeset
977 -- 2**K, where K is in the range 1 .. M, where the Esize of N is 2**(M+1).
kono
parents:
diff changeset
978 -- If so, returns the value K, otherwise returns zero. The caller checks
kono
parents:
diff changeset
979 -- that N is of an integer type.
kono
parents:
diff changeset
980
kono
parents:
diff changeset
981 procedure Process_Statements_For_Controlled_Objects (N : Node_Id);
kono
parents:
diff changeset
982 -- N is a node which contains a non-handled statement list. Inspect the
kono
parents:
diff changeset
983 -- statements looking for declarations of controlled objects. If at least
kono
parents:
diff changeset
984 -- one such object is found, wrap the statement list in a block.
kono
parents:
diff changeset
985
kono
parents:
diff changeset
986 function Remove_Init_Call
kono
parents:
diff changeset
987 (Var : Entity_Id;
kono
parents:
diff changeset
988 Rep_Clause : Node_Id) return Node_Id;
kono
parents:
diff changeset
989 -- Look for init_proc call or aggregate initialization statements for
kono
parents:
diff changeset
990 -- variable Var, either among declarations between that of Var and a
kono
parents:
diff changeset
991 -- subsequent Rep_Clause applying to Var, or in the list of freeze actions
kono
parents:
diff changeset
992 -- associated with Var, and if found, remove and return that call node.
kono
parents:
diff changeset
993
kono
parents:
diff changeset
994 procedure Remove_Side_Effects
kono
parents:
diff changeset
995 (Exp : Node_Id;
kono
parents:
diff changeset
996 Name_Req : Boolean := False;
kono
parents:
diff changeset
997 Renaming_Req : Boolean := False;
kono
parents:
diff changeset
998 Variable_Ref : Boolean := False;
kono
parents:
diff changeset
999 Related_Id : Entity_Id := Empty;
kono
parents:
diff changeset
1000 Is_Low_Bound : Boolean := False;
kono
parents:
diff changeset
1001 Is_High_Bound : Boolean := False;
kono
parents:
diff changeset
1002 Check_Side_Effects : Boolean := True);
kono
parents:
diff changeset
1003 -- Given the node for a subexpression, this function replaces the node if
kono
parents:
diff changeset
1004 -- necessary by an equivalent subexpression that is guaranteed to be side
kono
parents:
diff changeset
1005 -- effect free. This is done by extracting any actions that could cause
kono
parents:
diff changeset
1006 -- side effects, and inserting them using Insert_Actions into the tree
kono
parents:
diff changeset
1007 -- to which Exp is attached. Exp must be analyzed and resolved before the
kono
parents:
diff changeset
1008 -- call and is analyzed and resolved on return. Name_Req may only be set to
kono
parents:
diff changeset
1009 -- True if Exp has the form of a name, and the effect is to guarantee that
kono
parents:
diff changeset
1010 -- any replacement maintains the form of name. If Renaming_Req is set to
kono
parents:
diff changeset
1011 -- True, the routine produces an object renaming reclaration capturing the
kono
parents:
diff changeset
1012 -- expression. If Variable_Ref is set to True, a variable is considered as
kono
parents:
diff changeset
1013 -- side effect (used in implementing Force_Evaluation). Note: after call to
kono
parents:
diff changeset
1014 -- Remove_Side_Effects, it is safe to call New_Copy_Tree to obtain a copy
kono
parents:
diff changeset
1015 -- of the resulting expression. If Check_Side_Effects is set to True then
kono
parents:
diff changeset
1016 -- no action is performed if Exp is known to be side-effect free.
kono
parents:
diff changeset
1017 --
kono
parents:
diff changeset
1018 -- Related_Id denotes the entity of the context where Expr appears. Flags
kono
parents:
diff changeset
1019 -- Is_Low_Bound and Is_High_Bound specify whether the expression to check
kono
parents:
diff changeset
1020 -- is the low or the high bound of a range. These three optional arguments
kono
parents:
diff changeset
1021 -- signal Remove_Side_Effects to create an external symbol of the form
kono
parents:
diff changeset
1022 -- Chars (Related_Id)_FIRST/_LAST. If Related_Id is set, then exactly one
kono
parents:
diff changeset
1023 -- of the Is_xxx_Bound flags must be set. For use of these parameters see
kono
parents:
diff changeset
1024 -- the warning in the body of Sem_Ch3.Process_Range_Expr_In_Decl.
kono
parents:
diff changeset
1025 --
kono
parents:
diff changeset
1026 -- The side effects are captured using one of the following methods:
kono
parents:
diff changeset
1027 --
kono
parents:
diff changeset
1028 -- 1) a constant initialized with the value of the subexpression
kono
parents:
diff changeset
1029 -- 2) a renaming of the subexpression
kono
parents:
diff changeset
1030 -- 3) a reference to the subexpression
kono
parents:
diff changeset
1031 --
kono
parents:
diff changeset
1032 -- For elementary types, methods 1) and 2) are used; for composite types,
kono
parents:
diff changeset
1033 -- methods 2) and 3) are used. The renaming (method 2) is used only when
kono
parents:
diff changeset
1034 -- the subexpression denotes a name, so that it can be elaborated by gigi
kono
parents:
diff changeset
1035 -- without evaluating the subexpression.
kono
parents:
diff changeset
1036 --
kono
parents:
diff changeset
1037 -- Historical note: the reference (method 3) used to be the common fallback
kono
parents:
diff changeset
1038 -- method but it gives rise to aliasing issues if the subexpression denotes
kono
parents:
diff changeset
1039 -- a name that is not aliased, since it is equivalent to taking the address
kono
parents:
diff changeset
1040 -- in this case. The renaming (method 2) used to be applied to any objects
kono
parents:
diff changeset
1041 -- in the RM sense, that is to say to the cases where a renaming is legal
kono
parents:
diff changeset
1042 -- in Ada. But for some of these cases, most notably functions calls, the
kono
parents:
diff changeset
1043 -- renaming cannot be elaborated without evaluating the subexpression, so
kono
parents:
diff changeset
1044 -- gigi would resort to method 1) or 3) under the hood for them.
kono
parents:
diff changeset
1045
kono
parents:
diff changeset
1046 procedure Replace_References
kono
parents:
diff changeset
1047 (Expr : Node_Id;
kono
parents:
diff changeset
1048 Par_Typ : Entity_Id;
kono
parents:
diff changeset
1049 Deriv_Typ : Entity_Id;
kono
parents:
diff changeset
1050 Par_Obj : Entity_Id := Empty;
kono
parents:
diff changeset
1051 Deriv_Obj : Entity_Id := Empty);
kono
parents:
diff changeset
1052 -- Expr denotes an arbitrary expression. Par_Typ is a tagged parent type
kono
parents:
diff changeset
1053 -- in a type hierarchy. Deriv_Typ is a tagged type derived from Par_Typ
kono
parents:
diff changeset
1054 -- with optional ancestors in between. Par_Obj is a formal parameter
kono
parents:
diff changeset
1055 -- which emulates the current instance of Par_Typ. Deriv_Obj is a formal
kono
parents:
diff changeset
1056 -- parameter which emulates the current instance of Deriv_Typ. Perform the
kono
parents:
diff changeset
1057 -- following substitutions in Expr:
kono
parents:
diff changeset
1058 --
kono
parents:
diff changeset
1059 -- * Replace a reference to Par_Obj with a reference to Deriv_Obj
kono
parents:
diff changeset
1060 --
kono
parents:
diff changeset
1061 -- * Replace a reference to a discriminant of Par_Typ with a suitable
kono
parents:
diff changeset
1062 -- value from the point of view of Deriv_Typ.
kono
parents:
diff changeset
1063 --
kono
parents:
diff changeset
1064 -- * Replace a call to an overridden primitive of Par_Typ with a call to
kono
parents:
diff changeset
1065 -- an overriding primitive of Deriv_Typ.
kono
parents:
diff changeset
1066 --
kono
parents:
diff changeset
1067 -- * Replace a call to an inherited primitive of Par_Type with a call to
kono
parents:
diff changeset
1068 -- the internally-generated inherited primitive of Deriv_Typ.
kono
parents:
diff changeset
1069
kono
parents:
diff changeset
1070 procedure Replace_Type_References
kono
parents:
diff changeset
1071 (Expr : Node_Id;
kono
parents:
diff changeset
1072 Typ : Entity_Id;
kono
parents:
diff changeset
1073 Obj_Id : Entity_Id);
kono
parents:
diff changeset
1074 -- Substitute all references of the current instance of type Typ with
kono
parents:
diff changeset
1075 -- references to formal parameter Obj_Id within expression Expr.
kono
parents:
diff changeset
1076
kono
parents:
diff changeset
1077 function Represented_As_Scalar (T : Entity_Id) return Boolean;
kono
parents:
diff changeset
1078 -- Returns True iff the implementation of this type in code generation
kono
parents:
diff changeset
1079 -- terms is scalar. This is true for scalars in the Ada sense, and for
kono
parents:
diff changeset
1080 -- packed arrays which are represented by a scalar (modular) type.
kono
parents:
diff changeset
1081
kono
parents:
diff changeset
1082 function Requires_Cleanup_Actions
kono
parents:
diff changeset
1083 (N : Node_Id;
kono
parents:
diff changeset
1084 Lib_Level : Boolean) return Boolean;
kono
parents:
diff changeset
1085 -- Given a node N, determine whether its declarative and/or statement list
kono
parents:
diff changeset
1086 -- contains one of the following:
kono
parents:
diff changeset
1087 --
kono
parents:
diff changeset
1088 -- 1) controlled objects
kono
parents:
diff changeset
1089 -- 2) library-level tagged types
kono
parents:
diff changeset
1090 --
kono
parents:
diff changeset
1091 -- These cases require special actions on scope exit. The flag Lib_Level
kono
parents:
diff changeset
1092 -- is set True if the construct is at library level, and False otherwise.
kono
parents:
diff changeset
1093
kono
parents:
diff changeset
1094 function Safe_Unchecked_Type_Conversion (Exp : Node_Id) return Boolean;
kono
parents:
diff changeset
1095 -- Given the node for an N_Unchecked_Type_Conversion, return True if this
kono
parents:
diff changeset
1096 -- is an unchecked conversion that Gigi can handle directly. Otherwise
kono
parents:
diff changeset
1097 -- return False if it is one for which the front end must provide a
kono
parents:
diff changeset
1098 -- temporary. Note that the node need not be analyzed, and thus the Etype
kono
parents:
diff changeset
1099 -- field may not be set, but in that case it must be the case that the
kono
parents:
diff changeset
1100 -- Subtype_Mark field of the node is set/analyzed.
kono
parents:
diff changeset
1101
kono
parents:
diff changeset
1102 procedure Set_Current_Value_Condition (Cnode : Node_Id);
kono
parents:
diff changeset
1103 -- Cnode is N_If_Statement, N_Elsif_Part, or N_Iteration_Scheme (the latter
kono
parents:
diff changeset
1104 -- when a WHILE condition is present). This call checks whether Condition
kono
parents:
diff changeset
1105 -- (Cnode) has embedded expressions of a form that should result in setting
kono
parents:
diff changeset
1106 -- the Current_Value field of one or more entities, and if so sets these
kono
parents:
diff changeset
1107 -- fields to point to Cnode.
kono
parents:
diff changeset
1108
kono
parents:
diff changeset
1109 procedure Set_Elaboration_Flag (N : Node_Id; Spec_Id : Entity_Id);
kono
parents:
diff changeset
1110 -- N is the node for a subprogram or generic body, and Spec_Id is the
kono
parents:
diff changeset
1111 -- entity for the corresponding spec. If an elaboration entity is defined,
kono
parents:
diff changeset
1112 -- then this procedure generates an assignment statement to set it True,
kono
parents:
diff changeset
1113 -- immediately after the body is elaborated. However, no assignment is
kono
parents:
diff changeset
1114 -- generated in the case of library level procedures, since the setting of
kono
parents:
diff changeset
1115 -- the flag in this case is generated in the binder. We do that so that we
kono
parents:
diff changeset
1116 -- can detect cases where this is the only elaboration action that is
kono
parents:
diff changeset
1117 -- required.
kono
parents:
diff changeset
1118
kono
parents:
diff changeset
1119 procedure Set_Renamed_Subprogram (N : Node_Id; E : Entity_Id);
kono
parents:
diff changeset
1120 -- N is an node which is an entity name that represents the name of a
kono
parents:
diff changeset
1121 -- renamed subprogram. The node is rewritten to be an identifier that
kono
parents:
diff changeset
1122 -- refers directly to the renamed subprogram, given by entity E.
kono
parents:
diff changeset
1123
kono
parents:
diff changeset
1124 function Side_Effect_Free
kono
parents:
diff changeset
1125 (N : Node_Id;
kono
parents:
diff changeset
1126 Name_Req : Boolean := False;
kono
parents:
diff changeset
1127 Variable_Ref : Boolean := False) return Boolean;
kono
parents:
diff changeset
1128 -- Determines if the tree N represents an expression that is known not
kono
parents:
diff changeset
1129 -- to have side effects. If this function returns True, then for example
kono
parents:
diff changeset
1130 -- a call to Remove_Side_Effects has no effect.
kono
parents:
diff changeset
1131 --
kono
parents:
diff changeset
1132 -- Name_Req controls the handling of volatile variable references. If
kono
parents:
diff changeset
1133 -- Name_Req is False (the normal case), then volatile references are
kono
parents:
diff changeset
1134 -- considered to be side effects. If Name_Req is True, then volatility
kono
parents:
diff changeset
1135 -- of variables is ignored.
kono
parents:
diff changeset
1136 --
kono
parents:
diff changeset
1137 -- If Variable_Ref is True, then all variable references are considered to
kono
parents:
diff changeset
1138 -- be side effects (regardless of volatility or the setting of Name_Req).
kono
parents:
diff changeset
1139
kono
parents:
diff changeset
1140 function Side_Effect_Free
kono
parents:
diff changeset
1141 (L : List_Id;
kono
parents:
diff changeset
1142 Name_Req : Boolean := False;
kono
parents:
diff changeset
1143 Variable_Ref : Boolean := False) return Boolean;
kono
parents:
diff changeset
1144 -- Determines if all elements of the list L are side-effect free. Name_Req
kono
parents:
diff changeset
1145 -- and Variable_Ref are as described above.
kono
parents:
diff changeset
1146
kono
parents:
diff changeset
1147 procedure Silly_Boolean_Array_Not_Test (N : Node_Id; T : Entity_Id);
kono
parents:
diff changeset
1148 -- N is the node for a boolean array NOT operation, and T is the type of
kono
parents:
diff changeset
1149 -- the array. This routine deals with the silly case where the subtype of
kono
parents:
diff changeset
1150 -- the boolean array is False..False or True..True, where it is required
kono
parents:
diff changeset
1151 -- that a Constraint_Error exception be raised (RM 4.5.6(6)).
kono
parents:
diff changeset
1152
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1153 procedure Silly_Boolean_Array_Xor_Test
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1154 (N : Node_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1155 R : Node_Id;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1156 T : Entity_Id);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1157 -- N is the node for a boolean array XOR operation, T is the type of the
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1158 -- array, and R is a copy of the right operand of N, required to prevent
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1159 -- scope anomalies when unnesting is in effect. This routine deals with
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1160 -- the admitedly silly case where the subtype of the boolean array is
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1161 -- True..True, where a raise of a Constraint_Error exception is required
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1162 -- (RM 4.5.6(6)) and ACATS-tested.
111
kono
parents:
diff changeset
1163
kono
parents:
diff changeset
1164 function Target_Has_Fixed_Ops
kono
parents:
diff changeset
1165 (Left_Typ : Entity_Id;
kono
parents:
diff changeset
1166 Right_Typ : Entity_Id;
kono
parents:
diff changeset
1167 Result_Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
1168 -- Returns True if and only if the target machine has direct support
kono
parents:
diff changeset
1169 -- for fixed-by-fixed multiplications and divisions for the given
kono
parents:
diff changeset
1170 -- operand and result types. This is called in package Exp_Fixd to
kono
parents:
diff changeset
1171 -- determine whether to expand such operations.
kono
parents:
diff changeset
1172
kono
parents:
diff changeset
1173 function Type_May_Have_Bit_Aligned_Components
kono
parents:
diff changeset
1174 (Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
1175 -- Determines if Typ is a composite type that has within it (looking down
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1176 -- recursively at subcomponents) a record which contains a component that
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1177 -- may be bit aligned in a manner that causes trouble for the back end
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1178 -- (see also Component_May_Be_Bit_Aligned for further details). The result
111
kono
parents:
diff changeset
1179 -- is conservative, in that a result of False is decisive. A result of True
kono
parents:
diff changeset
1180 -- means that such a component may or may not be present.
kono
parents:
diff changeset
1181
kono
parents:
diff changeset
1182 procedure Update_Primitives_Mapping
kono
parents:
diff changeset
1183 (Inher_Id : Entity_Id;
kono
parents:
diff changeset
1184 Subp_Id : Entity_Id);
kono
parents:
diff changeset
1185 -- Map primitive operations of the parent type to the corresponding
kono
parents:
diff changeset
1186 -- operations of the descendant. Note that the descendant type may not be
kono
parents:
diff changeset
1187 -- frozen yet, so we cannot use the dispatch table directly. This is called
kono
parents:
diff changeset
1188 -- when elaborating a contract for a subprogram, and when freezing a type
kono
parents:
diff changeset
1189 -- extension to verify legality rules on inherited conditions.
kono
parents:
diff changeset
1190
kono
parents:
diff changeset
1191 function Within_Case_Or_If_Expression (N : Node_Id) return Boolean;
kono
parents:
diff changeset
1192 -- Determine whether arbitrary node N is within a case or an if expression
kono
parents:
diff changeset
1193
kono
parents:
diff changeset
1194 function Within_Internal_Subprogram return Boolean;
kono
parents:
diff changeset
1195 -- Indicates that some expansion is taking place within the body of a
kono
parents:
diff changeset
1196 -- predefined primitive operation. Some expansion activity (e.g. predicate
kono
parents:
diff changeset
1197 -- checks) is disabled in such. Because we want to detect invalid uses
kono
parents:
diff changeset
1198 -- of function calls within predicates (which lead to infinite recursion)
kono
parents:
diff changeset
1199 -- predicate functions themselves are not considered internal here.
kono
parents:
diff changeset
1200
kono
parents:
diff changeset
1201 private
kono
parents:
diff changeset
1202 pragma Inline (Duplicate_Subexpr);
kono
parents:
diff changeset
1203 pragma Inline (Force_Evaluation);
kono
parents:
diff changeset
1204 pragma Inline (Is_Library_Level_Tagged_Type);
kono
parents:
diff changeset
1205 end Exp_Util;