-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- GNATprove mode. As a special case, the front end does not insert a
-- Do_Division_Check flag on float exponentiation expressions, for the case
-- where the value is 0.0 and the exponent is negative, although this case
- -- does lead to a division check failure.
+ -- does lead to a division check failure. As another special case,
+ -- the front end does not insert a Do_Range_Check on an allocator where
+ -- the designated type is scalar, and the designated type is more
+ -- constrained than the type of the initialized allocator value or the type
+ -- of the default value for an uninitialized allocator.
- -- Note: the expander always takes care of the Do_Range check case,
- -- so this flag will never be set in the expanded tree passed to the
- -- back end code generator.
+ -- Note that the expander always takes care of the Do_Range_Check case, so
+ -- this flag will never be set in the expanded tree passed to the back end.
+ -- For the other two flags, the check can be generated either by the back
+ -- end or by the front end, depending on the setting of a target parameter.
-- Note that this accounts for all nodes that trigger the corresponding
-- checks, except for range checks on subtype_indications, which may be
-- Corresponding_Generic_Association (Node5-Sem)
-- This field is defined for object declarations and object renaming
-- declarations. It is set for the declarations within an instance that
- -- map generic formals to their actuals. If set, the field points to
- -- a generic_association which is the original parent of the expression
- -- or name appearing in the declaration. This simplifies ASIS queries.
+ -- map generic formals to their actuals. If set, the field points either
+ -- to a copy of a default expression for an actual of mode IN or to a
+ -- generic_association which is the original parent of the expression or
+ -- name appearing in the declaration. This simplifies ASIS and GNATprove
+ -- queries.
-- Corresponding_Integer_Value (Uint4-Sem)
-- This field is set in real literals of fixed-point types (it is not
-- conversion nodes (and set if the conversion requires a check).
-- Do_Division_Check (Flag13-Sem)
- -- This flag is set on a division operator (/ mod rem) to indicate
- -- that a zero divide check is required. The actual check is dealt
- -- with by the backend (all the front end does is to set the flag).
+ -- This flag is set on a division operator (/ mod rem) to indicate that
+ -- a zero divide check is required. The actual check is either dealt with
+ -- by the back end if Backend_Divide_Checks is set to true, or by the
+ -- front end itself if it is set to false.
-- Do_Length_Check (Flag4-Sem)
-- This flag is set in an N_Assignment_Statement, N_Op_And, N_Op_Or,
-- Do_Overflow_Check (Flag17-Sem)
-- This flag is set on an operator where an overflow check is required on
- -- the operation. The actual check is dealt with by the backend (all the
- -- front end does is to set the flag). The other cases where this flag is
- -- used is on a Type_Conversion node and for attribute reference nodes.
+ -- the operation. The actual check is either dealt with by the back end
+ -- if Backend_Overflow_Checks is set to true, or by the front end itself
+ -- if it is set to false. The other cases where this flag is used is on a
+ -- Type_Conversion node as well on if and case expression nodes.
-- For a type conversion, it means that the conversion is from one base
-- type to another, and the value may not fit in the target base type.
- -- See also the description of Do_Range_Check for this case. The only
- -- attribute references which use this flag are Pred and Succ, where it
- -- means that the result should be checked for going outside the base
- -- range. Note that this flag is not set for modular types. This flag is
+ -- See also the description of Do_Range_Check for this case. This flag is
-- also set on if and case expression nodes if we are operating in either
-- MINIMIZED or ELIMINATED overflow checking mode (to make sure that we
-- properly process overflow checking for dependent expressions).
-- range check is required. The target type is clear from the context.
-- The contexts in which this flag can appear are the following:
- -- Right side of an assignment. In this case the target type is
- -- taken from the left side of the assignment, which is referenced
- -- by the Name of the N_Assignment_Statement node.
+ -- Right side of an assignment. In this case the target type is taken
+ -- from the left side of the assignment, which is referenced by the
+ -- Name of the N_Assignment_Statement node.
-- Subscript expressions in an indexed component. In this case the
-- target type is determined from the type of the array, which is
-- listed above (e.g. in a return statement), an additional type
-- conversion node is introduced to represent the required check.
- -- A special case arises for the arguments of the Pred/Succ attributes.
- -- Here the range check needed is against First + 1 .. Last (Pred) or
- -- First .. Last - 1 (Succ) of the corresponding base type. Essentially
- -- these checks are what would be performed within the implicit body of
- -- the functions that correspond to these attributes. In these cases,
- -- the Do_Range check flag is set on the argument to the attribute
- -- function, and the back end must special case the appropriate range
- -- to check against.
-
-- Do_Storage_Check (Flag17-Sem)
-- This flag is set in an N_Allocator node to indicate that a storage
-- check is required for the allocation, or in an N_Subprogram_Body node
-- procedure call statement
-- procedure instantiation
-- requeue statement
+ -- variable reference marker
--
-- Set when the node appears within a context which allows the generation
-- of run-time ABE checks. This flag detemines whether the ABE Processing
-- attribute reference
-- call marker
-- entry call statement
+ -- expanded name
-- function call
-- function instantiation
+ -- identifier
-- package instantiation
-- procedure call statement
-- procedure instantiation
-- requeue statement
+ -- variable reference marker
--
-- Set when the node appears within a context where elaboration warnings
-- are enabled. This flag determines whether the ABE processing phase
-- can be determined to be null at compile time. This is used to remove
-- the loop entirely at expansion time.
+ -- Is_OpenAcc_Environment (Flag13-Sem)
+ -- This flag is set in an N_Loop_Statement node if it contains an
+ -- Acc_Data, Acc_Parallel or Add_Kernels pragma.
+
+ -- Is_OpenAcc_Loop (Flag14-Sem)
+ -- This flag is set in an N_Loop_Statement node if it contains an
+ -- OpenAcc_Loop pragma.
+
-- Is_Overloaded (Flag5-Sem)
-- A flag present in all expression nodes. Used temporarily during
-- overloading determination. The setting of this flag is not relevant
-- the resolution of accidental overloading of binary or unary operators
-- which may occur in instances.
- -- Is_Read (Flag1-Sem)
+ -- Is_Read (Flag4-Sem)
-- Present in variable reference markers. Set when the original variable
-- reference constitues a read of the variable.
-- source.
-- Is_SPARK_Mode_On_Node (Flag2-Sem)
- -- Present in nodes which represent an elaboration scenario. Those are
- -- assignment statement, attribute reference, call marker, entry call
- -- statement, expanded name, function call, identifier, instantiation,
- -- procedure call statement, and requeue statement nodes. Set when the
- -- node appears within a context subject to SPARK_Mode On. This flag
- -- determines when the SPARK model of elaboration be activated by the
- -- ABE Processing phase.
+ -- Present in the following nodes:
+ --
+ -- assignment statement
+ -- attribute reference
+ -- call marker
+ -- entry call statement
+ -- expanded name
+ -- function call
+ -- function instantiation
+ -- identifier
+ -- package instantiation
+ -- procedure call statement
+ -- procedure instantiation
+ -- requeue statement
+ -- variable reference marker
+ --
+ -- Set when the node appears within a context subject to SPARK_Mode On.
+ -- This flag determines when the SPARK model of elaboration be activated
+ -- by the ABE Processing phase.
-- Is_Static_Coextension (Flag14-Sem)
-- Present in N_Allocator nodes. Set if the allocator is a coextension
-- Is_Static_Expression (Flag6-Sem)
-- Indicates that an expression is a static expression according to the
- -- rules in (RM 4.9). Note that it is possible for this flag to be set
- -- when Raises_Constraint_Error is also set. In practice almost all cases
- -- where a static expression is required do not allow an expression which
- -- raises Constraint_Error, so almost always, callers should call the
- -- Is_Ok_Static_Expression routine instead of testing this flag. See
- -- spec of package Sem_Eval for full details on the use of this flag.
+ -- rules in RM-4.9. See Sem_Eval for details.
-- Is_Subprogram_Descriptor (Flag16-Sem)
-- Present in N_Object_Declaration, and set only for the object
-- indicate that the construct is a task master (i.e. has declared tasks
-- or declares an access to a task type).
- -- Is_Write (Flag2-Sem)
+ -- Is_Write (Flag5-Sem)
-- Present in variable reference markers. Set when the original variable
-- reference constitues a write of the variable.
-- Raises_Constraint_Error (Flag7-Sem)
-- Set on an expression whose evaluation will definitely fail constraint
- -- error check. In the case of static expressions, this flag must be set
- -- accurately (and if it is set, the expression is typically illegal
- -- unless it appears as a non-elaborated branch of a short-circuit form).
- -- For a non-static expression, this flag may be set whenever an
- -- expression (e.g. an aggregate) is known to raise constraint error. If
- -- set, the expression definitely will raise CE if elaborated at runtime.
- -- If not set, the expression may or may not raise CE. In other words, on
- -- static expressions, the flag is set accurately, on non-static
- -- expressions it is set conservatively.
+ -- error check. See Sem_Eval for details.
-- Redundant_Use (Flag13-Sem)
-- Present in nodes that can appear as an operand in a use clause or use
-- Present in N_Extended_Return_Statement. Points to a list initially
-- containing a single N_Object_Declaration representing the return
-- object. We use a list (instead of just a pointer to the object decl)
- -- because Analyze wants to insert extra actions on this list.
+ -- because Analyze wants to insert extra actions on this list, before the
+ -- N_Object_Declaration, which always remains last on the list.
-- Rounded_Result (Flag18-Sem)
-- Present in N_Type_Conversion, N_Op_Divide, and N_Op_Multiply nodes.
-- are the result of expansion of rounded fixed-point divide, conversion
-- and multiplication operations.
+ -- Save_Invocation_Graph_Of_Body (Flag1-Sem)
+ -- Present in compilation unit nodes. Set when the elaboration mechanism
+ -- must record all invocation constructs and invocation relations within
+ -- the body of the compilation unit.
+ --
-- SCIL_Entity (Node4-Sem)
-- Present in SCIL nodes. References the specific tagged type associated
-- with the SCIL node (for an N_SCIL_Dispatching_Call node, this is
-- Original_Discriminant (Node2-Sem)
-- Is_Elaboration_Checks_OK_Node (Flag1-Sem)
-- Is_SPARK_Mode_On_Node (Flag2-Sem)
+ -- Is_Elaboration_Warnings_OK_Node (Flag3-Sem)
-- Has_Private_View (Flag11-Sem) (set in generic units)
-- Redundant_Use (Flag13-Sem)
-- Atomic_Sync_Required (Flag14-Sem)
-- Einfo.
-- Note: N_Defining_Identifier is an extended node whose fields are
- -- deliberately layed out to match the layout of fields in an ordinary
+ -- deliberately laid out to match the layout of fields in an ordinary
-- N_Identifier node allowing for easy alteration of an identifier
-- node into a defining identifier node. For details, see procedure
-- Sinfo.CN.Change_Identifier_To_Defining_Identifier.
-- in package Einfo.
-- Note: N_Defining_Character_Literal is an extended node whose fields
- -- are deliberate layed out to match the layout of fields in an ordinary
- -- N_Character_Literal node allowing for easy alteration of a character
+ -- are deliberately laid out to match layout of fields in an ordinary
+ -- N_Character_Literal node, allowing for easy alteration of a character
-- literal node into a defining character literal node. For details, see
-- Sinfo.CN.Change_Character_Literal_To_Defining_Character_Literal.
--------------------------
-- 4.5.7 If Expression --
- ----------------------------
+ --------------------------
-- IF_EXPRESSION ::=
-- if CONDITION then DEPENDENT_EXPRESSION
-- Iteration_Scheme (Node2) (set to Empty if no iteration scheme)
-- Statements (List3)
-- End_Label (Node4)
+ -- Is_OpenAcc_Environment (Flag13-Sem)
+ -- Is_OpenAcc_Loop (Flag14-Sem)
-- Has_Created_Identifier (Flag15)
-- Is_Null_Loop (Flag16)
-- Suppress_Loop_Warnings (Flag17)
-- in package Einfo.
-- Note: N_Defining_Operator_Symbol is an extended node whose fields
- -- are deliberately layed out to match the layout of fields in an
+ -- are deliberately laid out to match the layout of fields in an
-- ordinary N_Operator_Symbol node allowing for easy alteration of
-- an operator symbol node into a defining operator symbol node.
-- See Sinfo.CN.Change_Operator_Symbol_To_Defining_Operator_Symbol
-- N_Compilation_Unit
-- Sloc points to first token of defining unit name
- -- Library_Unit (Node4-Sem) corresponding/parent spec/body
-- Context_Items (List1) context items and pragmas preceding unit
-- Private_Present (Flag15) set if library unit has private keyword
-- Unit (Node2) library item or subunit
-- Aux_Decls_Node (Node5) points to the N_Compilation_Unit_Aux node
- -- Has_No_Elaboration_Code (Flag17-Sem)
- -- Body_Required (Flag13-Sem) set for spec if body is required
- -- Acts_As_Spec (Flag4-Sem) flag for subprogram body with no spec
- -- Context_Pending (Flag16-Sem)
-- First_Inlined_Subprogram (Node3-Sem)
+ -- Library_Unit (Node4-Sem) corresponding/parent spec/body
+ -- Save_Invocation_Graph_Of_Body (Flag1-Sem)
+ -- Acts_As_Spec (Flag4-Sem) flag for subprogram body with no spec
+ -- Body_Required (Flag13-Sem) set for spec if body is required
-- Has_Pragma_Suppress_All (Flag14-Sem)
+ -- Context_Pending (Flag16-Sem)
+ -- Has_No_Elaboration_Code (Flag17-Sem)
-- N_Compilation_Unit_Aux
-- Sloc is a copy of the Sloc from the N_Compilation_Unit node
-- of this node, leaving the N_Selected_Component node used only when
-- the prefix is a record or protected type.
- -- The fields of the N_Expanded_Name node are layed out identically
+ -- The fields of the N_Expanded_Name node are laid out identically
-- to those of the N_Selected_Component node, allowing conversion of
-- an expanded name node to a selected component node to be done
-- easily, see Sinfo.CN.Change_Selected_Component_To_Expanded_Name.
-- Associated_Node (Node4-Sem)
-- Is_Elaboration_Checks_OK_Node (Flag1-Sem)
-- Is_SPARK_Mode_On_Node (Flag2-Sem)
+ -- Is_Elaboration_Warnings_OK_Node (Flag3-Sem)
-- Has_Private_View (Flag11-Sem) set in generic units
-- Redundant_Use (Flag13-Sem)
-- Atomic_Sync_Required (Flag14-Sem)
-- N_Variable_Reference_Marker
-- Sloc points to Sloc of original variable reference
-- Target (Node1-Sem)
- -- Is_Read (Flag1-Sem)
- -- Is_Write (Flag2-Sem)
+ -- Is_Elaboration_Checks_OK_Node (Flag1-Sem)
+ -- Is_SPARK_Mode_On_Node (Flag2-Sem)
+ -- Is_Elaboration_Warnings_OK_Node (Flag3-Sem)
+ -- Is_Read (Flag4-Sem)
+ -- Is_Write (Flag5-Sem)
-----------
-- Empty --
function Is_Null_Loop
(N : Node_Id) return Boolean; -- Flag16
+ function Is_OpenAcc_Environment
+ (N : Node_Id) return Boolean; -- Flag13
+
+ function Is_OpenAcc_Loop
+ (N : Node_Id) return Boolean; -- Flag14
+
function Is_Overloaded
(N : Node_Id) return Boolean; -- Flag5
(N : Node_Id) return Boolean; -- Flag4
function Is_Read
- (N : Node_Id) return Boolean; -- Flag1
+ (N : Node_Id) return Boolean; -- Flag4
function Is_Source_Call
(N : Node_Id) return Boolean; -- Flag4
(N : Node_Id) return Boolean; -- Flag5
function Is_Write
- (N : Node_Id) return Boolean; -- Flag2
+ (N : Node_Id) return Boolean; -- Flag5
function Iteration_Scheme
(N : Node_Id) return Node_Id; -- Node2
function Rounded_Result
(N : Node_Id) return Boolean; -- Flag18
+ function Save_Invocation_Graph_Of_Body
+ (N : Node_Id) return Boolean; -- Flag1
+
function SCIL_Controlling_Tag
(N : Node_Id) return Node_Id; -- Node5
procedure Set_Is_Null_Loop
(N : Node_Id; Val : Boolean := True); -- Flag16
+ procedure Set_Is_OpenAcc_Environment
+ (N : Node_Id; Val : Boolean := True); -- Flag13
+
+ procedure Set_Is_OpenAcc_Loop
+ (N : Node_Id; Val : Boolean := True); -- Flag14
+
procedure Set_Is_Overloaded
(N : Node_Id; Val : Boolean := True); -- Flag5
(N : Node_Id; Val : Boolean := True); -- Flag4
procedure Set_Is_Read
- (N : Node_Id; Val : Boolean := True); -- Flag1
+ (N : Node_Id; Val : Boolean := True); -- Flag4
procedure Set_Is_Source_Call
(N : Node_Id; Val : Boolean := True); -- Flag4
(N : Node_Id; Val : Boolean := True); -- Flag5
procedure Set_Is_Write
- (N : Node_Id; Val : Boolean := True); -- Flag2
+ (N : Node_Id; Val : Boolean := True); -- Flag5
procedure Set_Iteration_Scheme
(N : Node_Id; Val : Node_Id); -- Node2
procedure Set_Rounded_Result
(N : Node_Id; Val : Boolean := True); -- Flag18
+ procedure Set_Save_Invocation_Graph_Of_Body
+ (N : Node_Id; Val : Boolean := True); -- Flag1
+
procedure Set_SCIL_Controlling_Tag
(N : Node_Id; Val : Node_Id); -- Node5
N_Iterated_Component_Association =>
(1 => True, -- Defining_Identifier (Node1)
- 2 => False, -- unused
+ 2 => True, -- Loop_Actions (List2-Sem)
3 => True, -- Expression (Node3)
4 => True, -- Discrete_Choices (List4)
5 => False), -- unused
pragma Inline (Is_Known_Guaranteed_ABE);
pragma Inline (Is_Machine_Number);
pragma Inline (Is_Null_Loop);
+ pragma Inline (Is_OpenAcc_Environment);
+ pragma Inline (Is_OpenAcc_Loop);
pragma Inline (Is_Overloaded);
pragma Inline (Is_Power_Of_2_For_Shift);
pragma Inline (Is_Prefixed_Call);
pragma Inline (Reverse_Present);
pragma Inline (Right_Opnd);
pragma Inline (Rounded_Result);
+ pragma Inline (Save_Invocation_Graph_Of_Body);
pragma Inline (SCIL_Controlling_Tag);
pragma Inline (SCIL_Entity);
pragma Inline (SCIL_Tag_Value);
pragma Inline (Set_Is_Known_Guaranteed_ABE);
pragma Inline (Set_Is_Machine_Number);
pragma Inline (Set_Is_Null_Loop);
+ pragma Inline (Set_Is_OpenAcc_Environment);
+ pragma Inline (Set_Is_OpenAcc_Loop);
pragma Inline (Set_Is_Overloaded);
pragma Inline (Set_Is_Power_Of_2_For_Shift);
pragma Inline (Set_Is_Prefixed_Call);
pragma Inline (Set_Reverse_Present);
pragma Inline (Set_Right_Opnd);
pragma Inline (Set_Rounded_Result);
+ pragma Inline (Set_Save_Invocation_Graph_Of_Body);
pragma Inline (Set_SCIL_Controlling_Tag);
pragma Inline (Set_SCIL_Entity);
pragma Inline (Set_SCIL_Tag_Value);