OSDN Git Service

* 1aexcept.adb, 1aexcept.ads, 1ic.ads, 1ssecsta.adb,
[pf3gnuchains/gcc-fork.git] / gcc / ada / sinfo.ads
index d6eca70..7f3fe5c 100644 (file)
@@ -6,9 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---                            $Revision: 1.1 $
---                                                                          --
---          Copyright (C) 1992-2001, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2002, 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- --
@@ -29,7 +27,7 @@
 -- covered by the  GNU Public License.                                      --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
--- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
@@ -404,6 +402,7 @@ package Sinfo is
    --       Left_Opnd                (Node2)      left operand expression
    --       Right_Opnd               (Node3)      right operand expression
    --       Entity                   (Node4-Sem)  defining entity for operator
+   --       Associated_Node          (Node4-Sem)  for generic processing
    --       Do_Overflow_Check        (Flag17-Sem) set if overflow check needed
    --       Has_Private_View         (Flag11-Sem) set in generic units.
 
@@ -411,6 +410,7 @@ package Sinfo is
    --       Chars                    (Name1)      Name_Id for the operator
    --       Right_Opnd               (Node3)      right operand expression
    --       Entity                   (Node4-Sem)  defining entity for operator
+   --       Associated_Node          (Node4-Sem)  for generic processing
    --       Do_Overflow_Check        (Flag17-Sem) set if overflow check needed
    --       Has_Private_View         (Flag11-Sem) set in generic units.
 
@@ -549,9 +549,9 @@ package Sinfo is
 
    --  All_Others (Flag11-Sem)
    --    Present in an N_Others_Choice node. This flag is set in the case
-   --    of an others exception where all exceptions, even those that are
-   --    not normally handled (in particular the tasking abort signal) by
-   --    others. This is used for translation of the at end handler into
+   --    of an others exception where all exceptions are to be caught, even
+   --    those that are not normally handled (in particular the tasking abort
+   --    signal). This is used for translation of the at end handler into
    --    a normal exception handler.
 
    --  Assignment_OK (Flag15-Sem)
@@ -566,6 +566,17 @@ package Sinfo is
    --    expression is valid, even where it would normally not be allowed
    --    (e.g. where the type involved is limited).
 
+   --  Associated_Node (Node4-Sem)
+   --    Present in nodes that can denote an entity: identifiers, character
+   --    literals, operator symbols, expanded names, operator nodes and
+   --    attribute reference nodes (all these nodes have an Entity field).
+   --    This field is also present in N_Aggregate, N_Selected_Component,
+   --    and N_Extension_Aggregate nodes. This field is used during generic
+   --    processing to relate nodes in the original template to nodes in the
+   --    generic copy. It overlaps the Entity field, and is used to capture
+   --    global references in the analyzed copy and place them in the template.
+   --    See description in Sem_Ch12 for further details on this usage.
+
    --  At_End_Proc (Node1)
    --    This field is present in an N_Handled_Sequence_Of_Statements node.
    --    It contains an identifier reference for the cleanup procedure to
@@ -849,10 +860,11 @@ package Sinfo is
    --    defining occurrence is in a separately compiled file, and this
    --    pointer must be set using the library Load procedure. Note that
    --    during name resolution, the value in Entity may be temporarily
-   --    incorrect (e.g. during overload resolution, Entity is
-   --    initially set to the first possible correct interpretation, and
-   --    then later modified if necessary to contain the correct value
-   --    after resolution).
+   --    incorrect (e.g. during overload resolution, Entity is initially
+   --    set to the first possible correct interpretation, and then later
+   --    modified if necessary to contain the correct value after resolution).
+   --    Note that Associated_Node overlays this field during the processing
+   --    of generics. See Sem_Ch12 for further details.
 
    --  Etype (Node5-Sem)
    --    Appears in all expression nodes, all direct names, and all
@@ -1166,6 +1178,16 @@ package Sinfo is
    --    Used to collect actions that must be executed within the loop because
    --    they may need to be evaluated anew each time through.
 
+   --  Must_Be_Byte_Aligned (Flag14-Sem)
+   --    This flag is present in N_Attribute_Reference nodes. It can be set
+   --    only for the Address and Unrestricted_Access attributes. If set it
+   --    means that the object for which the address/access is given must be
+   --    on a byte (more accurately a storage unit) boundary. If necessary,
+   --    a copy of the object is to be made before taking the address (this
+   --    copy is in the current scope on the stack frame). This is used for
+   --    certainly cases of code generated by the expander that passes
+   --    parameters by address.
+
    --  Must_Not_Freeze (Flag8-Sem)
    --    A flag present in all expression nodes. Normally expressions cause
    --    freezing as described in the RM. If this flag is set, then this
@@ -1461,6 +1483,7 @@ package Sinfo is
    --    Case Statement             end case;
 
    --    Record Definition          end record;
+   --    Enumeration Definition     );
 
    --  The End_Label and End_Span fields are used to mark the locations
    --  of these lines, and also keep track of the label in the case where
@@ -1492,6 +1515,9 @@ package Sinfo is
    --  entry for the end of a record, since it represents a scope for
    --  name declaration purposes.
 
+   --  The enumeration definition case is handled in an exactly similar
+   --  manner, building a dummy identifier to get a cross-reference.
+
    --  Note: the reason we store the difference as a Uint, instead of
    --  storing the Source_Ptr value directly, is that Source_Ptr values
    --  cannot be distinguished from other types of values, and we count
@@ -1538,6 +1564,7 @@ package Sinfo is
       --  Sloc points to identifier
       --  Chars (Name1) contains the Name_Id for the identifier
       --  Entity (Node4-Sem)
+      --  Associated_Node (Node4-Sem)
       --  Original_Discriminant (Node2-Sem)
       --  Redundant_Use (Flag13-Sem)
       --  Has_Private_View (Flag11-Sem) (set in generic units)
@@ -1610,6 +1637,7 @@ package Sinfo is
       --  Chars (Name1) contains the Name_Id for the identifier
       --  Char_Literal_Value (Char_Code2) contains the literal value
       --  Entity (Node4-Sem)
+      --  Associated_Node (Node4-Sem)
       --  Has_Private_View (Flag11-Sem) set in generic units.
       --  plus fields for expression
 
@@ -1991,6 +2019,7 @@ package Sinfo is
       --  N_Enumeration_Type_Definition
       --  Sloc points to left parenthesis
       --  Literals (List1) (Empty for CHARACTER or WIDE_CHARACTER)
+      --  End_Label (Node4) (set to Empty if internally generated record)
 
       ----------------------------------------------
       -- 3.5.1  Enumeration Literal Specification --
@@ -2721,6 +2750,7 @@ package Sinfo is
       --  Sloc points to period
       --  Prefix (Node3)
       --  Selector_Name (Node2)
+      --  Associated_Node (Node4-Sem)
       --  Do_Access_Check (Flag11-Sem)
       --  Do_Discriminant_Check (Flag13-Sem)
       --  plus fields for expression
@@ -2785,16 +2815,27 @@ package Sinfo is
       --  a non-standard enumeration type or a nonzero/zero semantics
       --  boolean type, so the value is simply the stored representation.
 
+      --  Note: In generated code, the Address and Unrestricted_Access
+      --  attributes can be applied to any expression, and the meaning is
+      --  to create an object containing the value (the object is in the
+      --  current stack frame), and pass the address of this value. If the
+      --  Must_Be_Byte_Aligned flag is set, then the object whose address
+      --  is taken must be on a byte (storage unit) boundary, and if it is
+      --  not (or may not be), then the generated code must create a copy
+      --  that is byte aligned, and pass the address of this copy.
+
       --  N_Attribute_Reference
       --  Sloc points to apostrophe
       --  Prefix (Node3)
       --  Attribute_Name (Name2) identifier name from attribute designator
       --  Expressions (List1) (set to No_List if no associated expressions)
       --  Entity (Node4-Sem) used if the attribute yields a type
+      --  Associated_Node (Node4-Sem)
       --  Do_Access_Check (Flag11-Sem)
       --  Do_Overflow_Check (Flag17-Sem)
       --  Redundant_Use (Flag13-Sem)
       --  OK_For_Stream (Flag4-Sem)
+      --  Must_Be_Byte_Aligned (Flag14)
       --  plus fields for expression
 
       ---------------------------------
@@ -2850,6 +2891,7 @@ package Sinfo is
       --  Component_Associations (List2) (set to No_List if none)
       --  Null_Record_Present (Flag17)
       --  Aggregate_Bounds (Node3-Sem)
+      --  Associated_Node (Node4-Sem)
       --  Static_Processing_OK (Flag4-Sem)
       --  Compile_Time_Known_Aggregate (Flag18-Sem)
       --  Expansion_Delayed (Flag11-Sem)
@@ -2932,6 +2974,7 @@ package Sinfo is
       --  N_Extension_Aggregate
       --  Sloc points to left parenthesis
       --  Ancestor_Part (Node3)
+      --  Associated_Node (Node4-Sem)
       --  Expressions (List1) (set to No_List if none or null record case)
       --  Component_Associations (List2) (set to No_List if none)
       --  Null_Record_Present (Flag17)
@@ -3779,6 +3822,7 @@ package Sinfo is
       --  Strval (Str3) Id of string value. This is used if the operator
       --   symbol turns out to be a normal string after all.
       --  Entity (Node4-Sem)
+      --  Associated_Node (Node4-Sem)
       --  Has_Private_View (Flag11-Sem) set in generic units.
       --  Etype (Node5-Sem)
 
@@ -5887,6 +5931,7 @@ package Sinfo is
       --  Prefix (Node3)
       --  Selector_Name (Node2)
       --  Entity (Node4-Sem)
+      --  Associated_Node (Node4-Sem)
       --  Redundant_Use (Flag13-Sem)
       --  Has_Private_View (Flag11-Sem) set in generic units.
       --  plus fields for expression
@@ -6041,33 +6086,42 @@ package Sinfo is
       --  circuit form whose left argument is static and decisively
       --  eliminates elaboration of the raise operation.
 
+      --  The exception is generated with a message that contains the
+      --  file name and line number, and then appended text. The Reason
+      --  code shows the text to be added. The Reason code is an element
+      --  of the type Types.RT_Exception_Code, and indicates both the
+      --  message to be added, and the exception to be raised (which must
+      --  match the node type). The value is stored by storing a Uint which
+      --  is the Pos value of the enumeration element in this type.
+
       --  Gigi restriction: This expander ensures that the type of the
       --  Condition field is always Standard.Boolean, even if the type
       --  in the source is some non-standard boolean type.
 
-      --  Sprint syntax: [xxx_error]
-      --             or: [xxx_error when condition]
+      --  Sprint syntax: [xxx_error "msg"]
+      --             or: [xxx_error when condition "msg"]
 
       --  N_Raise_Constraint_Error
       --  Sloc references related construct
       --  Condition (Node1) (set to Empty if no condition)
-      --  Sloc is copied from the expression generating the exception
+      --  Reason (Uint3)
       --  plus fields for expression
 
       --  N_Raise_Program_Error
       --  Sloc references related construct
       --  Condition (Node1) (set to Empty if no condition)
-      --  Sloc is copied from the construct generating the exception
+      --  Reason (Uint3)
       --  plus fields for expression
 
       --  N_Raise_Storage_Error
       --  Sloc references related construct
       --  Condition (Node1) (set to Empty if no condition)
-      --  Sloc is copied from the construct generating the exception
+      --  Reason (Uint3)
       --  plus fields for expression
 
-      --  Note: in the case where a debug source file is generated, the Sloc
-      --  for this node points to the left bracket in the Sprint file output.
+      --  Note: Sloc is copied from the expression generating the exception.
+      --  In the case where a debug source file is generated, the Sloc for
+      --  this node points to the left bracket in the Sprint file output.
 
       ---------------
       -- Reference --
@@ -6186,7 +6240,7 @@ package Sinfo is
       --  to unchecked conversion, and these are most conveniently performed
       --  in the specialized back-end.
 
-      --  To accomodate this requirement, for such back ends, the following
+      --  To accommodate this requirement, for such back ends, the following
       --  special node is generated recording an unchecked conversion that
       --  needs to be validated. The back end should post an appropriate
       --  error message if the unchecked conversion is invalid or warrants
@@ -6739,6 +6793,9 @@ package Sinfo is
    function Assignment_OK
      (N : Node_Id) return Boolean;    -- Flag15
 
+   function Associated_Node
+     (N : Node_Id) return Node_Id;    -- Node4
+
    function At_End_Proc
      (N : Node_Id) return Node_Id;    -- Node1
 
@@ -7180,6 +7237,9 @@ package Sinfo is
    function More_Ids
      (N : Node_Id) return Boolean;    -- Flag5
 
+   function Must_Be_Byte_Aligned
+     (N : Node_Id) return Boolean;    -- Flag14
+
    function Must_Not_Freeze
      (N : Node_Id) return Boolean;    -- Flag8
 
@@ -7303,6 +7363,9 @@ package Sinfo is
    function Realval
      (N : Node_Id) return Ureal;      -- Ureal3
 
+   function Reason
+     (N : Node_Id) return Uint;       -- Uint3
+
    function Record_Extension_Part
      (N : Node_Id) return Node_Id;    -- Node3
 
@@ -7486,6 +7549,9 @@ package Sinfo is
    procedure Set_Assignment_OK
      (N : Node_Id; Val : Boolean := True);    -- Flag15
 
+   procedure Set_Associated_Node
+     (N : Node_Id; Val : Node_Id);            -- Node4
+
    procedure Set_Attribute_Name
      (N : Node_Id; Val : Name_Id);            -- Name2
 
@@ -7927,6 +7993,9 @@ package Sinfo is
    procedure Set_More_Ids
      (N : Node_Id; Val : Boolean := True);    -- Flag5
 
+   procedure Set_Must_Be_Byte_Aligned
+     (N : Node_Id; Val : Boolean := True);    -- Flag14
+
    procedure Set_Must_Not_Freeze
      (N : Node_Id; Val : Boolean := True);    -- Flag8
 
@@ -8050,6 +8119,9 @@ package Sinfo is
    procedure Set_Realval
      (N : Node_Id; Val : Ureal);              -- Ureal3
 
+   procedure Set_Reason
+     (N : Node_Id; Val : Uint);               -- Uint3
+
    procedure Set_Record_Extension_Part
      (N : Node_Id; Val : Node_Id);            -- Node3
 
@@ -8215,6 +8287,7 @@ package Sinfo is
    pragma Inline (Ancestor_Part);
    pragma Inline (Array_Aggregate);
    pragma Inline (Assignment_OK);
+   pragma Inline (Associated_Node);
    pragma Inline (At_End_Proc);
    pragma Inline (Attribute_Name);
    pragma Inline (Aux_Decls_Node);
@@ -8362,6 +8435,7 @@ package Sinfo is
    pragma Inline (Low_Bound);
    pragma Inline (Mod_Clause);
    pragma Inline (More_Ids);
+   pragma Inline (Must_Be_Byte_Aligned);
    pragma Inline (Must_Not_Freeze);
    pragma Inline (Name);
    pragma Inline (Names);
@@ -8401,8 +8475,9 @@ package Sinfo is
    pragma Inline (Raises_Constraint_Error);
    pragma Inline (Range_Constraint);
    pragma Inline (Range_Expression);
-   pragma Inline (Realval);
    pragma Inline (Real_Range_Specification);
+   pragma Inline (Realval);
+   pragma Inline (Reason);
    pragma Inline (Record_Extension_Part);
    pragma Inline (Redundant_Use);
    pragma Inline (Return_Type);
@@ -8461,6 +8536,7 @@ package Sinfo is
    pragma Inline (Set_Ancestor_Part);
    pragma Inline (Set_Array_Aggregate);
    pragma Inline (Set_Assignment_OK);
+   pragma Inline (Set_Associated_Node);
    pragma Inline (Set_At_End_Proc);
    pragma Inline (Set_Attribute_Name);
    pragma Inline (Set_Aux_Decls_Node);
@@ -8608,6 +8684,7 @@ package Sinfo is
    pragma Inline (Set_Low_Bound);
    pragma Inline (Set_Mod_Clause);
    pragma Inline (Set_More_Ids);
+   pragma Inline (Set_Must_Be_Byte_Aligned);
    pragma Inline (Set_Must_Not_Freeze);
    pragma Inline (Set_Name);
    pragma Inline (Set_Names);
@@ -8646,8 +8723,9 @@ package Sinfo is
    pragma Inline (Set_Raises_Constraint_Error);
    pragma Inline (Set_Range_Constraint);
    pragma Inline (Set_Range_Expression);
-   pragma Inline (Set_Realval);
    pragma Inline (Set_Real_Range_Specification);
+   pragma Inline (Set_Realval);
+   pragma Inline (Set_Reason);
    pragma Inline (Set_Record_Extension_Part);
    pragma Inline (Set_Redundant_Use);
    pragma Inline (Set_Return_Type);