diff options
Diffstat (limited to 'gcc/ada/exp_util.ads')
-rw-r--r-- | gcc/ada/exp_util.ads | 82 |
1 files changed, 79 insertions, 3 deletions
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index ae938a03504..e9b373d0e3f 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -118,6 +118,13 @@ package Exp_Util is -- Assoc_Node is the node with which the actions are associated. -- Ins_Actions may be No_List, in which case the call has no effect. + procedure Insert_Action_After + (Assoc_Node : Node_Id; + Ins_Action : Node_Id); + -- Assoc_Node must be a node in a list. Same as Insert_Action but the + -- action will be inserted after N in a manner that is compatible with + -- the transient scope mechanism. + procedure Insert_Actions_After (Assoc_Node : Node_Id; Ins_Actions : List_Id); @@ -187,6 +194,30 @@ package Exp_Util is -- Note that the added nodes are not analyzed. The analyze call is found in -- Exp_Ch13.Expand_N_Freeze_Entity. + procedure Build_Allocate_Deallocate_Proc + (N : Node_Id; + Is_Allocate : Boolean); + -- Create a custom Allocate/Deallocate to be associated with an allocation + -- or deallocation of a controlled or class-wide object. In the case of + -- allocation, N is the declaration of the temporary variable which + -- represents the expression of the original allocator node, otherwise N + -- must be a free statement. If flag Is_Allocate is set, the generated + -- routine is allocate, deallocate otherwise. The generated routine is: + -- + -- F : constant Boolean := -- CW case + -- Ada.Tags.Needs_Finalization (<Expr>'Tag); -- CW case + -- + -- procedure Allocate / Deallocate + -- (P : Storage_Pool; + -- A : [out] Address; -- out is present for Allocate + -- S : Storage_Count; + -- L : Storage_Count) + -- is + -- begin + -- Allocate / Deallocate + -- (<Ptr_Typ collection>, A, S, L, [Needs_Header => F]); + -- end Allocate; + function Build_Runtime_Call (Loc : Source_Ptr; RE : RE_Id) return Node_Id; -- Build an N_Procedure_Call_Statement calling the given runtime entity. -- The call has no parameters. The first argument provides the location @@ -393,6 +424,10 @@ package Exp_Util is -- in which this routine is invoked should always have a protection -- object. + function Find_Protection_Type (Conc_Typ : Entity_Id) return Entity_Id; + -- Given a protected type or its corresponding record, find the type of + -- field _object. + procedure Force_Evaluation (Exp : Node_Id; Name_Req : Boolean := False); @@ -448,9 +483,21 @@ package Exp_Util is function Get_Stream_Size (E : Entity_Id) return Uint; -- Return the stream size value of the subtype E - function Has_Controlled_Coextensions (Typ : Entity_Id) return Boolean; - -- Determine whether a record type has anonymous access discriminants with - -- a controlled designated type. + function Has_Access_Constraint (E : Entity_Id) return Boolean; + -- Given object or type E, determine whether a discriminant is of an access + -- type. + + function Has_Controlled_Objects (N : Node_Id) return Boolean; + -- Given an arbitrary node N, determine whether it has a declarative or a + -- statement part and whether those lists contain at least one controlled + -- object. + + function Has_Controlled_Objects + (L : List_Id; + For_Package : Boolean) return Boolean; + -- Given a list, determine whether L contains at least one controlled + -- object. Flag For_Package should be set when the list comes from a + -- package spec or body. function Has_Following_Address_Clause (D : Node_Id) return Boolean; -- D is the node for an object declaration. This function searches the @@ -468,6 +515,10 @@ package Exp_Util is function Inside_Init_Proc return Boolean; -- Returns True if current scope is within an init proc + function In_Library_Level_Package_Body (Id : Entity_Id) return Boolean; + -- Given an arbitrary entity, determine whether it appears at the library + -- level of a package body. + function In_Unconditional_Context (Node : Node_Id) return Boolean; -- Node is the node for a statement or a component of a statement. This -- function determines if the statement appears in a context that is @@ -479,6 +530,14 @@ package Exp_Util is -- False otherwise. True for an empty list. It is an error to call this -- routine with No_List as the argument. + function Is_Finalizable_Transient + (Decl : Node_Id; + Rel_Node : Node_Id) return Boolean; + -- Determine whether declaration Decl denotes a controlled transient which + -- should be finalized. Rel_Node is the related context. Even though some + -- transient are controlled, they may act as renamings of other objects or + -- function calls. + function Is_Fully_Repped_Tagged_Type (T : Entity_Id) return Boolean; -- Tests given type T, and returns True if T is a non-discriminated tagged -- type which has a record representation clause that specifies the layout @@ -492,6 +551,13 @@ package Exp_Util is -- Return True if Typ is a library level tagged type. Currently we use -- this information to build statically allocated dispatch tables. + function Is_Null_Access_BIP_Func_Call (Expr : Node_Id) return Boolean; + -- Determine whether node Expr denotes a build-in-place function call with + -- a value of "null" for extra formal BIPaccess. + + function Is_Non_BIP_Func_Call (Expr : Node_Id) return Boolean; + -- Determine whether node Expr denotes a non build-in-place function call + function Is_Ref_To_Bit_Packed_Array (N : Node_Id) return Boolean; -- Determine whether the node P is a reference to a bit packed array, i.e. -- whether the designated object is a component of a bit packed array, or a @@ -504,6 +570,10 @@ package Exp_Util is -- whether the designated object is bit packed slice or a component of a -- bit packed slice. Return True if so. + function Is_Related_To_Func_Return (Id : Entity_Id) return Boolean; + -- Determine whether object Id is related to an expanded return statement. + -- The case concerned is "return Id.all;". + function Is_Possibly_Unaligned_Slice (N : Node_Id) return Boolean; -- Determine whether the node P is a slice of an array where the slice -- result may cause alignment problems because it has an alignment that @@ -614,6 +684,12 @@ package Exp_Util is -- consist of constants, when the object has a non-trivial initialization -- or is controlled. + function Needs_Finalization (T : Entity_Id) return Boolean; + -- True if type T is controlled, or has controlled subcomponents. Also + -- True if T is a class-wide type, because some type extension might add + -- controlled subcomponents, except that if pragma Restrictions + -- (No_Finalization) applies, this is False for class-wide types. + function Non_Limited_Designated_Type (T : Entity_Id) return Entity_Id; -- An anonymous access type may designate a limited view. Check whether -- non-limited view is available during expansion, to examine components |