OSDN Git Service

2014-05-07 Richard Biener <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / ada / atree.adb
index 1cdf5ae..793da13 100644 (file)
@@ -6,25 +6,23 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2006, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, 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- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, USA.                                              --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
 --                                                                          --
--- As a special exception,  if other files  instantiate  generics from this --
--- unit, or you link  this unit with other files  to produce an executable, --
--- this  unit  does not  by itself cause  the resulting  executable  to  be --
--- covered  by the  GNU  General  Public  License.  This exception does not --
--- however invalidate  any other reasons why  the executable file  might be --
--- covered by the  GNU Public License.                                      --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
@@ -35,21 +33,91 @@ pragma Style_Checks (All_Checks);
 --  Turn off subprogram ordering check for this package
 
 --  WARNING: There is a C version of this package. Any changes to this source
---  file must be properly reflected in the C header a-atree.h (for inlined
---  bodies) and the C file a-atree.c (for remaining non-inlined bodies).
+--  file must be properly reflected in the file atree.h which is a C header
+--  file containing equivalent definitions for use by gigi.
 
+with Aspects; use Aspects;
 with Debug;   use Debug;
-with Namet;   use Namet;
 with Nlists;  use Nlists;
-with Elists;  use Elists;
 with Output;  use Output;
 with Sinput;  use Sinput;
 with Tree_IO; use Tree_IO;
 
-with GNAT.HTable; use GNAT.HTable;
-
 package body Atree is
 
+   Reporting_Proc : Report_Proc := null;
+   --  Record argument to last call to Set_Reporting_Proc
+
+   ---------------
+   -- Debugging --
+   ---------------
+
+   --  Suppose you find that node 12345 is messed up. You might want to find
+   --  the code that created that node. There are two ways to do this:
+
+   --  One way is to set a conditional breakpoint on New_Node_Debugging_Output
+   --  (nickname "nnd"):
+   --     break nnd if n = 12345
+   --  and run gnat1 again from the beginning.
+
+   --  The other way is to set a breakpoint near the beginning (e.g. on
+   --  gnat1drv), and run. Then set Watch_Node (nickname "ww") to 12345 in gdb:
+   --     ww := 12345
+   --  and set a breakpoint on New_Node_Breakpoint (nickname "nn"). Continue.
+
+   --  Either way, gnat1 will stop when node 12345 is created
+
+   --  The second method is much faster
+
+   --  Similarly, rr and rrd allow breaking on rewriting of a given node
+
+   ww : Node_Id'Base := Node_Id'First - 1;
+   pragma Export (Ada, ww); --  trick the optimizer
+   Watch_Node : Node_Id'Base renames ww;
+   --  Node to "watch"; that is, whenever a node is created, we check if it
+   --  is equal to Watch_Node, and if so, call New_Node_Breakpoint. You have
+   --  presumably set a breakpoint on New_Node_Breakpoint. Note that the
+   --  initial value of Node_Id'First - 1 ensures that by default, no node
+   --  will be equal to Watch_Node.
+
+   procedure nn;
+   pragma Export (Ada, nn);
+   procedure New_Node_Breakpoint renames nn;
+   --  This doesn't do anything interesting; it's just for setting breakpoint
+   --  on as explained above.
+
+   procedure nnd (N : Node_Id);
+   pragma Export (Ada, nnd);
+   procedure New_Node_Debugging_Output (N : Node_Id) renames nnd;
+   --  For debugging. If debugging is turned on, New_Node and New_Entity call
+   --  this. If debug flag N is turned on, this prints out the new node.
+   --
+   --  If Node = Watch_Node, this prints out the new node and calls
+   --  New_Node_Breakpoint. Otherwise, does nothing.
+
+   procedure rr;
+   pragma Export (Ada, rr);
+   procedure Rewrite_Breakpoint renames rr;
+   --  This doesn't do anything interesting; it's just for setting breakpoint
+   --  on as explained above.
+
+   procedure rrd (Old_Node, New_Node : Node_Id);
+   pragma Export (Ada, rrd);
+   procedure Rewrite_Debugging_Output
+     (Old_Node, New_Node : Node_Id) renames rrd;
+   --  For debugging. If debugging is turned on, Rewrite calls this. If debug
+   --  flag N is turned on, this prints out the new node.
+   --
+   --  If Old_Node = Watch_Node, this prints out the old and new nodes and
+   --  calls Rewrite_Breakpoint. Otherwise, does nothing.
+
+   procedure Node_Debug_Output (Op : String; N : Node_Id);
+   --  Common code for nnd and rrd, writes Op followed by information about N
+
+   -----------------------------
+   -- Local Objects and Types --
+   -----------------------------
+
    Node_Count : Nat;
    --  Count allocated nodes for Num_Nodes function
 
@@ -59,8 +127,6 @@ package body Atree is
    use Atree_Private_Part;
    --  We are also allowed to see our private data structures!
 
-   function E_To_N is new Unchecked_Conversion (Entity_Kind, Node_Kind);
-   function N_To_E is new Unchecked_Conversion (Node_Kind, Entity_Kind);
    --  Functions used to store Entity_Kind value in Nkind field
 
    --  The following declarations are used to store flags 65-72 in the
@@ -89,6 +155,56 @@ package body Atree is
    function To_Flag_Byte_Ptr is new
      Unchecked_Conversion (Node_Kind_Ptr, Flag_Byte_Ptr);
 
+   --  The following declarations are used to store flags 239-246 in the
+   --  Nkind field of the fourth component of an extended (entity) node.
+
+   type Flag_Byte2 is record
+      Flag239 : Boolean;
+      Flag240 : Boolean;
+      Flag241 : Boolean;
+      Flag242 : Boolean;
+      Flag243 : Boolean;
+      Flag244 : Boolean;
+      Flag245 : Boolean;
+      Flag246 : Boolean;
+   end record;
+
+   pragma Pack (Flag_Byte2);
+   for Flag_Byte2'Size use 8;
+
+   type Flag_Byte2_Ptr is access all Flag_Byte2;
+
+   function To_Flag_Byte2 is new
+     Unchecked_Conversion (Node_Kind, Flag_Byte2);
+
+   function To_Flag_Byte2_Ptr is new
+     Unchecked_Conversion (Node_Kind_Ptr, Flag_Byte2_Ptr);
+
+   --  The following declarations are used to store flags 247-254 in the
+   --  Nkind field of the fifth component of an extended (entity) node.
+
+   type Flag_Byte3 is record
+      Flag247 : Boolean;
+      Flag248 : Boolean;
+      Flag249 : Boolean;
+      Flag250 : Boolean;
+      Flag251 : Boolean;
+      Flag252 : Boolean;
+      Flag253 : Boolean;
+      Flag254 : Boolean;
+   end record;
+
+   pragma Pack (Flag_Byte3);
+   for Flag_Byte3'Size use 8;
+
+   type Flag_Byte3_Ptr is access all Flag_Byte3;
+
+   function To_Flag_Byte3 is new
+     Unchecked_Conversion (Node_Kind, Flag_Byte3);
+
+   function To_Flag_Byte3_Ptr is new
+     Unchecked_Conversion (Node_Kind_Ptr, Flag_Byte3_Ptr);
+
    --  The following declarations are used to store flags 73-96 and the
    --  Convention field in the Field12 field of the third component of an
    --  extended (Entity) node.
@@ -244,7 +360,7 @@ package body Atree is
      Unchecked_Conversion (Union_Id_Ptr, Flag_Word3_Ptr);
 
    --  The following declarations are used to store flags 184-215 in the
-   --  Field11 field of the fifth component of an extended (entity) node.
+   --  Field12 field of the fifth component of an extended (entity) node.
 
    type Flag_Word4 is record
       Flag184 : Boolean;
@@ -296,91 +412,6 @@ package body Atree is
    function To_Flag_Word4_Ptr is new
      Unchecked_Conversion (Union_Id_Ptr, Flag_Word4_Ptr);
 
-   --  Default value used to initialize default nodes. Note that some of the
-   --  fields get overwritten, and in particular, Nkind always gets reset.
-
-   Default_Node : Node_Record := (
-      Is_Extension      => False,
-      Pflag1            => False,
-      Pflag2            => False,
-      In_List           => False,
-      Unused_1          => False,
-      Rewrite_Ins       => False,
-      Analyzed          => False,
-      Comes_From_Source => False, -- modified by Set_Comes_From_Source_Default
-      Error_Posted      => False,
-      Flag4             => False,
-
-      Flag5             => False,
-      Flag6             => False,
-      Flag7             => False,
-      Flag8             => False,
-      Flag9             => False,
-      Flag10            => False,
-      Flag11            => False,
-      Flag12            => False,
-
-      Flag13            => False,
-      Flag14            => False,
-      Flag15            => False,
-      Flag16            => False,
-      Flag17            => False,
-      Flag18            => False,
-
-      Nkind             => N_Unused_At_Start,
-
-      Sloc              => No_Location,
-      Link              => Empty_List_Or_Node,
-      Field1            => Empty_List_Or_Node,
-      Field2            => Empty_List_Or_Node,
-      Field3            => Empty_List_Or_Node,
-      Field4            => Empty_List_Or_Node,
-      Field5            => Empty_List_Or_Node);
-
-   --  Default value used to initialize node extensions (i.e. the second
-   --  and third and fourth components of an extended node). Note we are
-   --  cheating a bit here when it comes to Node12, which really holds
-   --  flags an (for the third component), the convention. But it works
-   --  because Empty, False, Convention_Ada, all happen to be all zero bits.
-
-   Default_Node_Extension : constant Node_Record := (
-      Is_Extension      => True,
-      Pflag1            => False,
-      Pflag2            => False,
-      In_List           => False,
-      Unused_1          => False,
-      Rewrite_Ins       => False,
-      Analyzed          => False,
-      Comes_From_Source => False,
-      Error_Posted      => False,
-      Flag4             => False,
-
-      Flag5             => False,
-      Flag6             => False,
-      Flag7             => False,
-      Flag8             => False,
-      Flag9             => False,
-      Flag10            => False,
-      Flag11            => False,
-      Flag12            => False,
-
-      Flag13            => False,
-      Flag14            => False,
-      Flag15            => False,
-      Flag16            => False,
-      Flag17            => False,
-      Flag18            => False,
-
-      Nkind             => E_To_N (E_Void),
-
-      Field6            => Empty_List_Or_Node,
-      Field7            => Empty_List_Or_Node,
-      Field8            => Empty_List_Or_Node,
-      Field9            => Empty_List_Or_Node,
-      Field10           => Empty_List_Or_Node,
-      Field11           => Empty_List_Or_Node,
-      Field12           => Empty_List_Or_Node);
-
    --------------------------------------------------
    -- Implementation of Tree Substitution Routines --
    --------------------------------------------------
@@ -396,48 +427,45 @@ package body Atree is
 
    package Orig_Nodes is new Table.Table (
       Table_Component_Type => Node_Id,
-      Table_Index_Type     => Node_Id,
+      Table_Index_Type     => Node_Id'Base,
       Table_Low_Bound      => First_Node_Id,
       Table_Initial        => Alloc.Orig_Nodes_Initial,
       Table_Increment      => Alloc.Orig_Nodes_Increment,
       Table_Name           => "Orig_Nodes");
 
-   ----------------------------------------
-   -- Global_Variables for New_Copy_Tree --
-   ----------------------------------------
-
-   --  These global variables are used by New_Copy_Tree. See description
-   --  of the body of this subprogram for details. Global variables can be
-   --  safely used by New_Copy_Tree, since there is no case of a recursive
-   --  call from the processing inside New_Copy_Tree.
-
-   NCT_Hash_Threshhold : constant := 20;
-   --  If there are more than this number of pairs of entries in the
-   --  map, then Hash_Tables_Used will be set, and the hash tables will
-   --  be initialized and used for the searches.
+   --------------------------
+   -- Paren_Count Handling --
+   --------------------------
 
-   NCT_Hash_Tables_Used : Boolean := False;
-   --  Set to True if hash tables are in use
+   --  As noted in the spec, the paren count in a sub-expression node has
+   --  four possible values 0,1,2, and 3. The value 3 really means 3 or more,
+   --  and we use an auxiliary serially scanned table to record the actual
+   --  count. A serial search is fine, only pathological programs will use
+   --  entries in this table. Normal programs won't use it at all.
 
-   NCT_Table_Entries : Nat;
-   --  Count entries in table to see if threshhold is reached
+   type Paren_Count_Entry is record
+      Nod   : Node_Id;
+      --  The node to which this count applies
 
-   NCT_Hash_Table_Setup : Boolean := False;
-   --  Set to True if hash table contains data. We set this True if we
-   --  setup the hash table with data, and leave it set permanently
-   --  from then on, this is a signal that second and subsequent users
-   --  of the hash table must clear the old entries before reuse.
+      Count : Nat range 3 .. Nat'Last;
+      --  The count of parentheses, which will be in the indicated range
+   end record;
 
-   subtype NCT_Header_Num is Int range 0 .. 511;
-   --  Defines range of headers in hash tables (512 headers)
+   package Paren_Counts is new Table.Table (
+     Table_Component_Type => Paren_Count_Entry,
+     Table_Index_Type     => Int,
+     Table_Low_Bound      => 0,
+     Table_Initial        => 10,
+     Table_Increment      => 200,
+     Table_Name           => "Paren_Counts");
 
    -----------------------
    -- Local Subprograms --
    -----------------------
 
-   procedure Fix_Parents (Old_Node, New_Node : Node_Id);
-   --  Fixup parent pointers for the syntactic children of New_Node after
-   --  a copy, setting them to New_Node when they pointed to Old_Node.
+   procedure Fix_Parents (Ref_Node, Fix_Node : Node_Id);
+   --  Fixup parent pointers for the syntactic children of Fix_Node after
+   --  a copy, setting them to Fix_Node when they pointed to Ref_Node.
 
    function Allocate_Initialize_Node
      (Src            : Node_Id;
@@ -453,48 +481,60 @@ package body Atree is
      (Src            : Node_Id;
       With_Extension : Boolean) return Node_Id
    is
-      New_Id : Node_Id     := Src;
-      Nod    : Node_Record := Default_Node;
-      Ext1   : Node_Record := Default_Node_Extension;
-      Ext2   : Node_Record := Default_Node_Extension;
-      Ext3   : Node_Record := Default_Node_Extension;
-      Ext4   : Node_Record := Default_Node_Extension;
+      New_Id : Node_Id;
 
    begin
-      if Present (Src) then
-         Nod := Nodes.Table (Src);
-
-         if Has_Extension (Src) then
-            Ext1 := Nodes.Table (Src + 1);
-            Ext2 := Nodes.Table (Src + 2);
-            Ext3 := Nodes.Table (Src + 3);
-            Ext4 := Nodes.Table (Src + 4);
-         end if;
-      end if;
-
-      if not (Present (Src)
-               and then not Has_Extension (Src)
-               and then With_Extension
-               and then Src = Nodes.Last)
+      if Present (Src)
+        and then not Has_Extension (Src)
+        and then With_Extension
+        and then Src = Nodes.Last
       then
+         New_Id := Src;
+      else
          --  We are allocating a new node, or extending a node
          --  other than Nodes.Last.
 
-         Nodes.Append (Nod);
+         if Present (Src) then
+            Nodes.Append (Nodes.Table (Src));
+         else
+            Nodes.Append (Default_Node);
+         end if;
+
          New_Id := Nodes.Last;
          Orig_Nodes.Append (New_Id);
          Node_Count := Node_Count + 1;
       end if;
 
+      --  Specifically copy Paren_Count to deal with creating new table entry
+      --  if the parentheses count is at the maximum possible value already.
+
+      if Present (Src) and then Nkind (Src) in N_Subexpr then
+         Set_Paren_Count (New_Id, Paren_Count (Src));
+      end if;
+
+      --  Set extension nodes if required
+
       if With_Extension then
-         Nodes.Append (Ext1);
-         Nodes.Append (Ext2);
-         Nodes.Append (Ext3);
-         Nodes.Append (Ext4);
+         if Present (Src) and then Has_Extension (Src) then
+            for J in 1 .. 4 loop
+               Nodes.Append (Nodes.Table (Src + Node_Id (J)));
+            end loop;
+         else
+            for J in 1 .. 4 loop
+               Nodes.Append (Default_Node_Extension);
+            end loop;
+         end if;
       end if;
 
       Orig_Nodes.Set_Last (Nodes.Last);
       Allocate_List_Tables (Nodes.Last);
+
+      --  Invoke the reporting procedure (if available)
+
+      if Reporting_Proc /= null then
+         Reporting_Proc.all (Target => New_Id, Source => Src);
+      end if;
+
       return New_Id;
    end Allocate_Initialize_Node;
 
@@ -504,10 +544,22 @@ package body Atree is
 
    function Analyzed (N : Node_Id) return Boolean is
    begin
-      pragma Assert (N in Nodes.First .. Nodes.Last);
+      pragma Assert (N <= Nodes.Last);
       return Nodes.Table (N).Analyzed;
    end Analyzed;
 
+   --------------------------
+   -- Basic_Set_Convention --
+   --------------------------
+
+   procedure Basic_Set_Convention  (E : Entity_Id; Val : Convention_Id) is
+   begin
+      pragma Assert (Nkind (E) in N_Entity);
+      To_Flag_Word_Ptr
+        (Union_Id_Ptr'
+          (Nodes.Table (E + 2).Field12'Unrestricted_Access)).Convention := Val;
+   end Basic_Set_Convention;
+
    -----------------
    -- Change_Node --
    -----------------
@@ -518,7 +570,7 @@ package body Atree is
       Save_Link    : constant Union_Id   := Nodes.Table (N).Link;
       Save_CFS     : constant Boolean    := Nodes.Table (N).Comes_From_Source;
       Save_Posted  : constant Boolean    := Nodes.Table (N).Error_Posted;
-      Par_Count    : Paren_Count_Type    := 0;
+      Par_Count    : Nat                 := 0;
 
    begin
       if Nkind (N) in N_Subexpr then
@@ -544,7 +596,7 @@ package body Atree is
 
    function Comes_From_Source (N : Node_Id) return Boolean is
    begin
-      pragma Assert (N in Nodes.First .. Nodes.Last);
+      pragma Assert (N <= Nodes.Last);
       return Nodes.Table (N).Comes_From_Source;
    end Comes_From_Source;
 
@@ -571,6 +623,15 @@ package body Atree is
       Nodes.Table (Destination).In_List := Save_In_List;
       Nodes.Table (Destination).Link    := Save_Link;
 
+      --  Specifically set Paren_Count to make sure auxiliary table entry
+      --  gets correctly made if the parentheses count is at the max value.
+
+      if Nkind (Destination) in N_Subexpr then
+         Set_Paren_Count (Destination, Paren_Count (Source));
+      end if;
+
+      --  Deal with copying extension nodes if present
+
       if Has_Extension (Source) then
          pragma Assert (Has_Extension (Destination));
          Nodes.Table (Destination + 1) := Nodes.Table (Source + 1);
@@ -585,6 +646,24 @@ package body Atree is
    end Copy_Node;
 
    ------------------------
+   -- Copy_Separate_List --
+   ------------------------
+
+   function Copy_Separate_List (Source : List_Id) return List_Id is
+      Result : constant List_Id := New_List;
+      Nod    : Node_Id;
+
+   begin
+      Nod := First (Source);
+      while Present (Nod) loop
+         Append (Copy_Separate_Tree (Nod), Result);
+         Next (Nod);
+      end loop;
+
+      return Result;
+   end Copy_Separate_List;
+
+   ------------------------
    -- Copy_Separate_Tree --
    ------------------------
 
@@ -705,8 +784,8 @@ package body Atree is
          Set_Field4 (New_Id, Possible_Copy (Field4 (New_Id)));
          Set_Field5 (New_Id, Possible_Copy (Field5 (New_Id)));
 
-         --  Set Entity field to Empty
-         --  Why is this done??? and why is it always right to do it???
+         --  Set Entity field to Empty to ensure that no entity references
+         --  are shared between the two, if the source is already analyzed.
 
          if Nkind (New_Id) in N_Has_Entity
            or else Nkind (New_Id) = N_Freeze_Entity
@@ -720,89 +799,6 @@ package body Atree is
       end if;
    end Copy_Separate_Tree;
 
-   -----------------
-   -- Delete_Node --
-   -----------------
-
-   procedure Delete_Node (Node : Node_Id) is
-   begin
-      pragma Assert (not Nodes.Table (Node).In_List);
-
-      if Debug_Flag_N then
-         Write_Str ("Delete node ");
-         Write_Int (Int (Node));
-         Write_Eol;
-      end if;
-
-      Nodes.Table (Node)       := Default_Node;
-      Nodes.Table (Node).Nkind := N_Unused_At_Start;
-      Node_Count := Node_Count - 1;
-
-      --  Note: for now, we are not bothering to reuse deleted nodes
-
-   end Delete_Node;
-
-   -----------------
-   -- Delete_Tree --
-   -----------------
-
-   procedure Delete_Tree (Node : Node_Id) is
-
-      procedure Delete_Field (F : Union_Id);
-      --  Delete item pointed to by field F if it is a syntactic element
-
-      procedure Delete_List (L : List_Id);
-      --  Delete all elements on the given list
-
-      ------------------
-      -- Delete_Field --
-      ------------------
-
-      procedure Delete_Field (F : Union_Id) is
-      begin
-         if F = Union_Id (Empty) then
-            return;
-
-         elsif F in Node_Range
-           and then Parent (Node_Id (F)) = Node
-         then
-            Delete_Tree (Node_Id (F));
-
-         elsif F in List_Range
-           and then Parent (List_Id (F)) = Node
-         then
-            Delete_List (List_Id (F));
-
-         --  No need to test Elist case, there are no syntactic Elists
-
-         else
-            return;
-         end if;
-      end Delete_Field;
-
-      -----------------
-      -- Delete_List --
-      -----------------
-
-      procedure Delete_List (L : List_Id) is
-      begin
-         while Is_Non_Empty_List (L) loop
-            Delete_Tree (Remove_Head (L));
-         end loop;
-      end Delete_List;
-
-   --  Start of processing for Delete_Tree
-
-   begin
-      --  Delete descendents
-
-      Delete_Field (Field1 (Node));
-      Delete_Field (Field2 (Node));
-      Delete_Field (Field3 (Node));
-      Delete_Field (Field4 (Node));
-      Delete_Field (Field5 (Node));
-   end Delete_Tree;
-
    -----------
    -- Ekind --
    -----------
@@ -813,13 +809,152 @@ package body Atree is
       return N_To_E (Nodes.Table (E + 1).Nkind);
    end Ekind;
 
+   --------------
+   -- Ekind_In --
+   --------------
+
+   function Ekind_In
+     (T  : Entity_Kind;
+      V1 : Entity_Kind;
+      V2 : Entity_Kind) return Boolean
+   is
+   begin
+      return T = V1 or else
+             T = V2;
+   end Ekind_In;
+
+   function Ekind_In
+     (T  : Entity_Kind;
+      V1 : Entity_Kind;
+      V2 : Entity_Kind;
+      V3 : Entity_Kind) return Boolean
+   is
+   begin
+      return T = V1 or else
+             T = V2 or else
+             T = V3;
+   end Ekind_In;
+
+   function Ekind_In
+     (T  : Entity_Kind;
+      V1 : Entity_Kind;
+      V2 : Entity_Kind;
+      V3 : Entity_Kind;
+      V4 : Entity_Kind) return Boolean
+   is
+   begin
+      return T = V1 or else
+             T = V2 or else
+             T = V3 or else
+             T = V4;
+   end Ekind_In;
+
+   function Ekind_In
+     (T  : Entity_Kind;
+      V1 : Entity_Kind;
+      V2 : Entity_Kind;
+      V3 : Entity_Kind;
+      V4 : Entity_Kind;
+      V5 : Entity_Kind) return Boolean
+   is
+   begin
+      return T = V1 or else
+             T = V2 or else
+             T = V3 or else
+             T = V4 or else
+             T = V5;
+   end Ekind_In;
+
+   function Ekind_In
+     (T  : Entity_Kind;
+      V1 : Entity_Kind;
+      V2 : Entity_Kind;
+      V3 : Entity_Kind;
+      V4 : Entity_Kind;
+      V5 : Entity_Kind;
+      V6 : Entity_Kind) return Boolean
+   is
+   begin
+      return T = V1 or else
+             T = V2 or else
+             T = V3 or else
+             T = V4 or else
+             T = V5 or else
+             T = V6;
+   end Ekind_In;
+
+   function Ekind_In
+     (E  : Entity_Id;
+      V1 : Entity_Kind;
+      V2 : Entity_Kind) return Boolean
+   is
+   begin
+      return Ekind_In (Ekind (E), V1, V2);
+   end Ekind_In;
+
+   function Ekind_In
+     (E  : Entity_Id;
+      V1 : Entity_Kind;
+      V2 : Entity_Kind;
+      V3 : Entity_Kind) return Boolean
+   is
+   begin
+      return Ekind_In (Ekind (E), V1, V2, V3);
+   end Ekind_In;
+
+   function Ekind_In
+     (E  : Entity_Id;
+      V1 : Entity_Kind;
+      V2 : Entity_Kind;
+      V3 : Entity_Kind;
+      V4 : Entity_Kind) return Boolean
+   is
+   begin
+      return Ekind_In (Ekind (E), V1, V2, V3, V4);
+   end Ekind_In;
+
+   function Ekind_In
+     (E  : Entity_Id;
+      V1 : Entity_Kind;
+      V2 : Entity_Kind;
+      V3 : Entity_Kind;
+      V4 : Entity_Kind;
+      V5 : Entity_Kind) return Boolean
+   is
+   begin
+      return Ekind_In (Ekind (E), V1, V2, V3, V4, V5);
+   end Ekind_In;
+
+   function Ekind_In
+     (E  : Entity_Id;
+      V1 : Entity_Kind;
+      V2 : Entity_Kind;
+      V3 : Entity_Kind;
+      V4 : Entity_Kind;
+      V5 : Entity_Kind;
+      V6 : Entity_Kind) return Boolean
+   is
+   begin
+      return Ekind_In (Ekind (E), V1, V2, V3, V4, V5, V6);
+   end Ekind_In;
+
+   ------------------------
+   -- Set_Reporting_Proc --
+   ------------------------
+
+   procedure Set_Reporting_Proc (P : Report_Proc) is
+   begin
+      pragma Assert (Reporting_Proc = null);
+      Reporting_Proc := P;
+   end Set_Reporting_Proc;
+
    ------------------
    -- Error_Posted --
    ------------------
 
    function Error_Posted (N : Node_Id) return Boolean is
    begin
-      pragma Assert (N in Nodes.First .. Nodes.Last);
+      pragma Assert (N <= Nodes.Last);
       return Nodes.Table (N).Error_Posted;
    end Error_Posted;
 
@@ -914,18 +1049,18 @@ package body Atree is
    -- Fix_Parents --
    -----------------
 
-   procedure Fix_Parents (Old_Node, New_Node : Node_Id) is
+   procedure Fix_Parents (Ref_Node, Fix_Node : Node_Id) is
 
-      procedure Fix_Parent (Field : Union_Id; Old_Node, New_Node : Node_Id);
-      --  Fixup one parent pointer. Field is checked to see if it
-      --  points to a node, list, or element list that has a parent that
-      --  points to Old_Node. If so, the parent is reset to point to New_Node.
+      procedure Fix_Parent (Field : Union_Id);
+      --  Fixup one parent pointer. Field is checked to see if it points to
+      --  a node, list, or element list that has a parent that points to
+      --  Ref_Node. If so, the parent is reset to point to Fix_Node.
 
       ----------------
       -- Fix_Parent --
       ----------------
 
-      procedure Fix_Parent (Field : Union_Id; Old_Node, New_Node : Node_Id) is
+      procedure Fix_Parent (Field : Union_Id) is
       begin
          --  Fix parent of node that is referenced by Field. Note that we must
          --  exclude the case where the node is a member of a list, because in
@@ -934,28 +1069,28 @@ package body Atree is
          if Field in Node_Range
            and then Present (Node_Id (Field))
            and then not Nodes.Table (Node_Id (Field)).In_List
-           and then Parent (Node_Id (Field)) = Old_Node
+           and then Parent (Node_Id (Field)) = Ref_Node
          then
-            Set_Parent (Node_Id (Field), New_Node);
+            Set_Parent (Node_Id (Field), Fix_Node);
 
          --  Fix parent of list that is referenced by Field
 
          elsif Field in List_Range
            and then Present (List_Id (Field))
-           and then Parent (List_Id (Field)) = Old_Node
+           and then Parent (List_Id (Field)) = Ref_Node
          then
-            Set_Parent (List_Id (Field), New_Node);
+            Set_Parent (List_Id (Field), Fix_Node);
          end if;
       end Fix_Parent;
 
    --  Start of processing for Fix_Parents
 
    begin
-      Fix_Parent (Field1 (New_Node), Old_Node, New_Node);
-      Fix_Parent (Field2 (New_Node), Old_Node, New_Node);
-      Fix_Parent (Field3 (New_Node), Old_Node, New_Node);
-      Fix_Parent (Field4 (New_Node), Old_Node, New_Node);
-      Fix_Parent (Field5 (New_Node), Old_Node, New_Node);
+      Fix_Parent (Field1 (Fix_Node));
+      Fix_Parent (Field2 (Fix_Node));
+      Fix_Parent (Field3 (Fix_Node));
+      Fix_Parent (Field4 (Fix_Node));
+      Fix_Parent (Field5 (Fix_Node));
    end Fix_Parents;
 
    -----------------------------------
@@ -967,6 +1102,16 @@ package body Atree is
       return Default_Node.Comes_From_Source;
    end Get_Comes_From_Source_Default;
 
+   -----------------
+   -- Has_Aspects --
+   -----------------
+
+   function Has_Aspects (N : Node_Id) return Boolean is
+   begin
+      pragma Assert (N <= Nodes.Last);
+      return Nodes.Table (N).Has_Aspects;
+   end Has_Aspects;
+
    -------------------
    -- Has_Extension --
    -------------------
@@ -988,6 +1133,7 @@ package body Atree is
       Node_Count := 0;
       Atree_Private_Part.Nodes.Init;
       Orig_Nodes.Init;
+      Paren_Counts.Init;
 
       --  Allocate Empty node
 
@@ -1000,12 +1146,6 @@ package body Atree is
       Dummy := New_Node (N_Error, No_Location);
       Set_Name1 (Error, Error_Name);
       Set_Error_Posted (Error, True);
-
-      --  Set global variables for New_Copy_Tree
-
-      NCT_Hash_Tables_Used := False;
-      NCT_Table_Entries    := 0;
-      NCT_Hash_Table_Setup := False;
    end Initialize;
 
    --------------------------
@@ -1065,996 +1205,273 @@ package body Atree is
 
    begin
       if Source > Empty_Or_Error then
-
          New_Id := Allocate_Initialize_Node (Source, Has_Extension (Source));
 
          Nodes.Table (New_Id).Link := Empty_List_Or_Node;
          Nodes.Table (New_Id).In_List := False;
 
-         --  If the original is marked as a rewrite insertion, then unmark
-         --  the copy, since we inserted the original, not the copy.
+         --  If the original is marked as a rewrite insertion, then unmark the
+         --  copy, since we inserted the original, not the copy.
 
          Nodes.Table (New_Id).Rewrite_Ins := False;
+         pragma Debug (New_Node_Debugging_Output (New_Id));
+
+         --  Clear Is_Overloaded since we cannot have semantic interpretations
+         --  of this new node.
+
+         if Nkind (Source) in N_Subexpr then
+            Set_Is_Overloaded (New_Id, False);
+         end if;
+
+         --  Always clear Has_Aspects, the caller must take care of copying
+         --  aspects if this is required for the particular situation.
+
+         Set_Has_Aspects (New_Id, False);
       end if;
 
       return New_Id;
    end New_Copy;
 
-   -------------------
-   -- New_Copy_Tree --
-   -------------------
-
-   --  Our approach here requires a two pass traversal of the tree. The
-   --  first pass visits all nodes that eventually will be copied looking
-   --  for defining Itypes. If any defining Itypes are found, then they are
-   --  copied, and an entry is added to the replacement map. In the second
-   --  phase, the tree is copied, using the replacement map to replace any
-   --  Itype references within the copied tree.
+   ----------------
+   -- New_Entity --
+   ----------------
 
-   --  The following hash tables are used if the Map supplied has more
-   --  than hash threshhold entries to speed up access to the map. If
-   --  there are fewer entries, then the map is searched sequentially
-   --  (because setting up a hash table for only a few entries takes
-   --  more time than it saves.
+   function New_Entity
+     (New_Node_Kind : Node_Kind;
+      New_Sloc      : Source_Ptr) return Entity_Id
+   is
+      Ent : Entity_Id;
 
-   function New_Copy_Hash (E : Entity_Id) return NCT_Header_Num;
-   --  Hash function used for hash operations
+   begin
+      pragma Assert (New_Node_Kind in N_Entity);
 
-   -------------------
-   -- New_Copy_Hash --
-   -------------------
+      Ent := Allocate_Initialize_Node (Empty, With_Extension => True);
 
-   function New_Copy_Hash (E : Entity_Id) return NCT_Header_Num is
-   begin
-      return Nat (E) mod (NCT_Header_Num'Last + 1);
-   end New_Copy_Hash;
+      --  If this is a node with a real location and we are generating
+      --  source nodes, then reset Current_Error_Node. This is useful
+      --  if we bomb during parsing to get a error location for the bomb.
 
-   ---------------
-   -- NCT_Assoc --
-   ---------------
+      if Default_Node.Comes_From_Source and then New_Sloc > No_Location then
+         Current_Error_Node := Ent;
+      end if;
 
-   --  The hash table NCT_Assoc associates old entities in the table
-   --  with their corresponding new entities (i.e. the pairs of entries
-   --  presented in the original Map argument are Key-Element pairs).
+      Nodes.Table (Ent).Nkind  := New_Node_Kind;
+      Nodes.Table (Ent).Sloc   := New_Sloc;
+      pragma Debug (New_Node_Debugging_Output (Ent));
 
-   package NCT_Assoc is new Simple_HTable (
-     Header_Num => NCT_Header_Num,
-     Element    => Entity_Id,
-     No_Element => Empty,
-     Key        => Entity_Id,
-     Hash       => New_Copy_Hash,
-     Equal      => Types."=");
+      return Ent;
+   end New_Entity;
 
-   ---------------------
-   -- NCT_Itype_Assoc --
-   ---------------------
+   --------------
+   -- New_Node --
+   --------------
 
-   --  The hash table NCT_Itype_Assoc contains entries only for those
-   --  old nodes which have a non-empty Associated_Node_For_Itype set.
-   --  The key is the associated node, and the element is the new node
-   --  itself (NOT the associated node for the new node).
-
-   package NCT_Itype_Assoc is new Simple_HTable (
-     Header_Num => NCT_Header_Num,
-     Element    => Entity_Id,
-     No_Element => Empty,
-     Key        => Entity_Id,
-     Hash       => New_Copy_Hash,
-     Equal      => Types."=");
-
-   --  Start of processing for New_Copy_Tree function
-
-   function New_Copy_Tree
-     (Source    : Node_Id;
-      Map       : Elist_Id := No_Elist;
-      New_Sloc  : Source_Ptr := No_Location;
-      New_Scope : Entity_Id := Empty) return Node_Id
+   function New_Node
+     (New_Node_Kind : Node_Kind;
+      New_Sloc      : Source_Ptr) return Node_Id
    is
-      Actual_Map : Elist_Id := Map;
-      --  This is the actual map for the copy. It is initialized with the
-      --  given elements, and then enlarged as required for Itypes that are
-      --  copied during the first phase of the copy operation. The visit
-      --  procedures add elements to this map as Itypes are encountered.
-      --  The reason we cannot use Map directly, is that it may well be
-      --  (and normally is) initialized to No_Elist, and if we have mapped
-      --  entities, we have to reset it to point to a real Elist.
-
-      function Assoc (N : Node_Or_Entity_Id) return Node_Id;
-      --  Called during second phase to map entities into their corresponding
-      --  copies using Actual_Map. If the argument is not an entity, or is not
-      --  in Actual_Map, then it is returned unchanged.
+      Nod : Node_Id;
 
-      procedure Build_NCT_Hash_Tables;
-      --  Builds hash tables (number of elements >= threshold value)
+   begin
+      pragma Assert (New_Node_Kind not in N_Entity);
+      Nod := Allocate_Initialize_Node (Empty, With_Extension => False);
+      Nodes.Table (Nod).Nkind := New_Node_Kind;
+      Nodes.Table (Nod).Sloc  := New_Sloc;
+      pragma Debug (New_Node_Debugging_Output (Nod));
 
-      function Copy_Elist_With_Replacement
-        (Old_Elist : Elist_Id) return Elist_Id;
-      --  Called during second phase to copy element list doing replacements
+      --  If this is a node with a real location and we are generating source
+      --  nodes, then reset Current_Error_Node. This is useful if we bomb
+      --  during parsing to get an error location for the bomb.
 
-      procedure Copy_Itype_With_Replacement (New_Itype : Entity_Id);
-      --  Called during the second phase to process a copied Itype. The actual
-      --  copy happened during the first phase (so that we could make the entry
-      --  in the mapping), but we still have to deal with the descendents of
-      --  the copied Itype and copy them where necessary.
+      if Default_Node.Comes_From_Source and then New_Sloc > No_Location then
+         Current_Error_Node := Nod;
+      end if;
 
-      function Copy_List_With_Replacement (Old_List : List_Id) return List_Id;
-      --  Called during second phase to copy list doing replacements
+      return Nod;
+   end New_Node;
 
-      function Copy_Node_With_Replacement (Old_Node : Node_Id) return Node_Id;
-      --  Called during second phase to copy node doing replacements
+   -------------------------
+   -- New_Node_Breakpoint --
+   -------------------------
 
-      procedure Visit_Elist (E : Elist_Id);
-      --  Called during first phase to visit all elements of an Elist
+   procedure nn is
+   begin
+      Write_Str ("Watched node ");
+      Write_Int (Int (Watch_Node));
+      Write_Str (" created");
+      Write_Eol;
+   end nn;
 
-      procedure Visit_Field (F : Union_Id; N : Node_Id);
-      --  Visit a single field, recursing to call Visit_Node or Visit_List
-      --  if the field is a syntactic descendent of the current node (i.e.
-      --  its parent is Node N).
+   -------------------------------
+   -- New_Node_Debugging_Output --
+   -------------------------------
 
-      procedure Visit_Itype (Old_Itype : Entity_Id);
-      --  Called during first phase to visit subsidiary fields of a defining
-      --  Itype, and also create a copy and make an entry in the replacement
-      --  map for the new copy.
+   procedure nnd (N : Node_Id) is
+      Node_Is_Watched : constant Boolean := N = Watch_Node;
 
-      procedure Visit_List (L : List_Id);
-      --  Called during first phase to visit all elements of a List
+   begin
+      if Debug_Flag_N or else Node_Is_Watched then
+         Node_Debug_Output ("Allocate", N);
 
-      procedure Visit_Node (N : Node_Or_Entity_Id);
-      --  Called during first phase to visit a node and all its subtrees
+         if Node_Is_Watched then
+            New_Node_Breakpoint;
+         end if;
+      end if;
+   end nnd;
 
-      -----------
-      -- Assoc --
-      -----------
+   -----------
+   -- Nkind --
+   -----------
 
-      function Assoc (N : Node_Or_Entity_Id) return Node_Id is
-         E   : Elmt_Id;
-         Ent : Entity_Id;
+   function Nkind (N : Node_Id) return Node_Kind is
+   begin
+      return Nodes.Table (N).Nkind;
+   end Nkind;
 
-      begin
-         if not Has_Extension (N) or else No (Actual_Map) then
-            return N;
+   --------------
+   -- Nkind_In --
+   --------------
 
-         elsif NCT_Hash_Tables_Used then
-            Ent := NCT_Assoc.Get (Entity_Id (N));
+   function Nkind_In
+     (N  : Node_Id;
+      V1 : Node_Kind;
+      V2 : Node_Kind) return Boolean
+   is
+   begin
+      return Nkind_In (Nkind (N), V1, V2);
+   end Nkind_In;
+
+   function Nkind_In
+     (N  : Node_Id;
+      V1 : Node_Kind;
+      V2 : Node_Kind;
+      V3 : Node_Kind) return Boolean
+   is
+   begin
+      return Nkind_In (Nkind (N), V1, V2, V3);
+   end Nkind_In;
+
+   function Nkind_In
+     (N  : Node_Id;
+      V1 : Node_Kind;
+      V2 : Node_Kind;
+      V3 : Node_Kind;
+      V4 : Node_Kind) return Boolean
+   is
+   begin
+      return Nkind_In (Nkind (N), V1, V2, V3, V4);
+   end Nkind_In;
+
+   function Nkind_In
+     (N  : Node_Id;
+      V1 : Node_Kind;
+      V2 : Node_Kind;
+      V3 : Node_Kind;
+      V4 : Node_Kind;
+      V5 : Node_Kind) return Boolean
+   is
+   begin
+      return Nkind_In (Nkind (N), V1, V2, V3, V4, V5);
+   end Nkind_In;
+
+   function Nkind_In
+     (N  : Node_Id;
+      V1 : Node_Kind;
+      V2 : Node_Kind;
+      V3 : Node_Kind;
+      V4 : Node_Kind;
+      V5 : Node_Kind;
+      V6 : Node_Kind) return Boolean
+   is
+   begin
+      return Nkind_In (Nkind (N), V1, V2, V3, V4, V5, V6);
+   end Nkind_In;
+
+   function Nkind_In
+     (N  : Node_Id;
+      V1 : Node_Kind;
+      V2 : Node_Kind;
+      V3 : Node_Kind;
+      V4 : Node_Kind;
+      V5 : Node_Kind;
+      V6 : Node_Kind;
+      V7 : Node_Kind) return Boolean
+   is
+   begin
+      return Nkind_In (Nkind (N), V1, V2, V3, V4, V5, V6, V7);
+   end Nkind_In;
+
+   function Nkind_In
+     (N  : Node_Id;
+      V1 : Node_Kind;
+      V2 : Node_Kind;
+      V3 : Node_Kind;
+      V4 : Node_Kind;
+      V5 : Node_Kind;
+      V6 : Node_Kind;
+      V7 : Node_Kind;
+      V8 : Node_Kind) return Boolean
+   is
+   begin
+      return Nkind_In (Nkind (N), V1, V2, V3, V4, V5, V6, V7, V8);
+   end Nkind_In;
+
+   function Nkind_In
+     (N  : Node_Id;
+      V1 : Node_Kind;
+      V2 : Node_Kind;
+      V3 : Node_Kind;
+      V4 : Node_Kind;
+      V5 : Node_Kind;
+      V6 : Node_Kind;
+      V7 : Node_Kind;
+      V8 : Node_Kind;
+      V9 : Node_Kind) return Boolean
+   is
+   begin
+      return Nkind_In (Nkind (N), V1, V2, V3, V4, V5, V6, V7, V8, V9);
+   end Nkind_In;
 
-            if Present (Ent) then
-               return Ent;
-            else
-               return N;
-            end if;
+   --------
+   -- No --
+   --------
 
-         --  No hash table used, do serial search
+   function No (N : Node_Id) return Boolean is
+   begin
+      return N = Empty;
+   end No;
 
-         else
-            E := First_Elmt (Actual_Map);
-            while Present (E) loop
-               if Node (E) = N then
-                  return Node (Next_Elmt (E));
-               else
-                  E := Next_Elmt (Next_Elmt (E));
-               end if;
-            end loop;
-         end if;
+   -----------------------
+   -- Node_Debug_Output --
+   -----------------------
 
-         return N;
-      end Assoc;
+   procedure Node_Debug_Output (Op : String; N : Node_Id) is
+   begin
+      Write_Str (Op);
 
-      ---------------------------
-      -- Build_NCT_Hash_Tables --
-      ---------------------------
+      if Nkind (N) in N_Entity then
+         Write_Str (" entity");
+      else
+         Write_Str (" node");
+      end if;
 
-      procedure Build_NCT_Hash_Tables is
-         Elmt : Elmt_Id;
-         Ent  : Entity_Id;
-      begin
-         if NCT_Hash_Table_Setup then
-            NCT_Assoc.Reset;
-            NCT_Itype_Assoc.Reset;
-         end if;
+      Write_Str (" Id = ");
+      Write_Int (Int (N));
+      Write_Str ("  ");
+      Write_Location (Sloc (N));
+      Write_Str ("  ");
+      Write_Str (Node_Kind'Image (Nkind (N)));
+      Write_Eol;
+   end Node_Debug_Output;
 
-         Elmt := First_Elmt (Actual_Map);
-         while Present (Elmt) loop
-            Ent := Node (Elmt);
-            Next_Elmt (Elmt);
-            NCT_Assoc.Set (Ent, Node (Elmt));
-            Next_Elmt (Elmt);
+   -------------------
+   -- Nodes_Address --
+   -------------------
 
-            if Is_Type (Ent) then
-               declare
-                  Anode : constant Entity_Id :=
-                            Associated_Node_For_Itype (Ent);
-
-               begin
-                  if Present (Anode) then
-                     NCT_Itype_Assoc.Set (Anode, Node (Elmt));
-                  end if;
-               end;
-            end if;
-         end loop;
-
-         NCT_Hash_Tables_Used := True;
-         NCT_Hash_Table_Setup := True;
-      end Build_NCT_Hash_Tables;
-
-      ---------------------------------
-      -- Copy_Elist_With_Replacement --
-      ---------------------------------
-
-      function Copy_Elist_With_Replacement
-        (Old_Elist : Elist_Id) return Elist_Id
-      is
-         M         : Elmt_Id;
-         New_Elist : Elist_Id;
-
-      begin
-         if No (Old_Elist) then
-            return No_Elist;
-
-         else
-            New_Elist := New_Elmt_List;
-
-            M := First_Elmt (Old_Elist);
-            while Present (M) loop
-               Append_Elmt (Copy_Node_With_Replacement (Node (M)), New_Elist);
-               Next_Elmt (M);
-            end loop;
-         end if;
-
-         return New_Elist;
-      end Copy_Elist_With_Replacement;
-
-      ---------------------------------
-      -- Copy_Itype_With_Replacement --
-      ---------------------------------
-
-      --  This routine exactly parallels its phase one analog Visit_Itype,
-      --  and like that routine, knows far too many semantic details about
-      --  the descendents of Itypes and whether they need copying or not.
-
-      procedure Copy_Itype_With_Replacement (New_Itype : Entity_Id) is
-      begin
-         --  Translate Next_Entity, Scope and Etype fields, in case they
-         --  reference entities that have been mapped into copies.
-
-         Set_Next_Entity (New_Itype, Assoc (Next_Entity (New_Itype)));
-         Set_Etype       (New_Itype, Assoc (Etype       (New_Itype)));
-
-         if Present (New_Scope) then
-            Set_Scope    (New_Itype, New_Scope);
-         else
-            Set_Scope    (New_Itype, Assoc (Scope       (New_Itype)));
-         end if;
-
-         --  Copy referenced fields
-
-         if Is_Discrete_Type (New_Itype) then
-            Set_Scalar_Range (New_Itype,
-              Copy_Node_With_Replacement (Scalar_Range (New_Itype)));
-
-         elsif Has_Discriminants (Base_Type (New_Itype)) then
-            Set_Discriminant_Constraint (New_Itype,
-              Copy_Elist_With_Replacement
-                (Discriminant_Constraint (New_Itype)));
-
-         elsif Is_Array_Type (New_Itype) then
-            if Present (First_Index (New_Itype)) then
-               Set_First_Index (New_Itype,
-                 First (Copy_List_With_Replacement
-                         (List_Containing (First_Index (New_Itype)))));
-            end if;
-
-            if Is_Packed (New_Itype) then
-               Set_Packed_Array_Type (New_Itype,
-                 Copy_Node_With_Replacement
-                   (Packed_Array_Type (New_Itype)));
-            end if;
-         end if;
-      end Copy_Itype_With_Replacement;
-
-      --------------------------------
-      -- Copy_List_With_Replacement --
-      --------------------------------
-
-      function Copy_List_With_Replacement
-        (Old_List : List_Id) return List_Id
-      is
-         New_List : List_Id;
-         E        : Node_Id;
-
-      begin
-         if Old_List = No_List then
-            return No_List;
-
-         else
-            New_List := Empty_List;
-
-            E := First (Old_List);
-            while Present (E) loop
-               Append (Copy_Node_With_Replacement (E), New_List);
-               Next (E);
-            end loop;
-
-            return New_List;
-         end if;
-      end Copy_List_With_Replacement;
-
-      --------------------------------
-      -- Copy_Node_With_Replacement --
-      --------------------------------
-
-      function Copy_Node_With_Replacement
-        (Old_Node : Node_Id) return Node_Id
-      is
-         New_Node : Node_Id;
-
-         function Copy_Field_With_Replacement
-           (Field : Union_Id) return Union_Id;
-         --  Given Field, which is a field of Old_Node, return a copy of it
-         --  if it is a syntactic field (i.e. its parent is Node), setting
-         --  the parent of the copy to poit to New_Node. Otherwise returns
-         --  the field (possibly mapped if it is an entity).
-
-         ---------------------------------
-         -- Copy_Field_With_Replacement --
-         ---------------------------------
-
-         function Copy_Field_With_Replacement
-           (Field : Union_Id) return Union_Id
-         is
-         begin
-            if Field = Union_Id (Empty) then
-               return Field;
-
-            elsif Field in Node_Range then
-               declare
-                  Old_N : constant Node_Id := Node_Id (Field);
-                  New_N : Node_Id;
-
-               begin
-                  --  If syntactic field, as indicated by the parent pointer
-                  --  being set, then copy the referenced node recursively.
-
-                  if Parent (Old_N) = Old_Node then
-                     New_N := Copy_Node_With_Replacement (Old_N);
-
-                     if New_N /= Old_N then
-                        Set_Parent (New_N, New_Node);
-                     end if;
-
-                  --  For semantic fields, update possible entity reference
-                  --  from the replacement map.
-
-                  else
-                     New_N := Assoc (Old_N);
-                  end if;
-
-                  return Union_Id (New_N);
-               end;
-
-            elsif Field in List_Range then
-               declare
-                  Old_L : constant List_Id := List_Id (Field);
-                  New_L : List_Id;
-
-               begin
-                  --  If syntactic field, as indicated by the parent pointer,
-                  --  then recursively copy the entire referenced list.
-
-                  if Parent (Old_L) = Old_Node then
-                     New_L := Copy_List_With_Replacement (Old_L);
-                     Set_Parent (New_L, New_Node);
-
-                  --  For semantic list, just returned unchanged
-
-                  else
-                     New_L := Old_L;
-                  end if;
-
-                  return Union_Id (New_L);
-               end;
-
-            --  Anything other than a list or a node is returned unchanged
-
-            else
-               return Field;
-            end if;
-         end Copy_Field_With_Replacement;
-
-      --  Start of processing for Copy_Node_With_Replacement
-
-      begin
-         if Old_Node <= Empty_Or_Error then
-            return Old_Node;
-
-         elsif Has_Extension (Old_Node) then
-            return Assoc (Old_Node);
-
-         else
-            New_Node := New_Copy (Old_Node);
-
-            --  If the node we are copying is the associated node of a
-            --  previously copied Itype, then adjust the associated node
-            --  of the copy of that Itype accordingly.
-
-            if Present (Actual_Map) then
-               declare
-                  E   : Elmt_Id;
-                  Ent : Entity_Id;
-
-               begin
-                  --  Case of hash table used
-
-                  if NCT_Hash_Tables_Used then
-                     Ent := NCT_Itype_Assoc.Get (Old_Node);
-
-                     if Present (Ent) then
-                        Set_Associated_Node_For_Itype (Ent, New_Node);
-                     end if;
-
-                  --  Case of no hash table used
-
-                  else
-                     E := First_Elmt (Actual_Map);
-                     while Present (E) loop
-                        if Is_Itype (Node (E))
-                          and then
-                            Old_Node = Associated_Node_For_Itype (Node (E))
-                        then
-                           Set_Associated_Node_For_Itype
-                             (Node (Next_Elmt (E)), New_Node);
-                        end if;
-
-                        E := Next_Elmt (Next_Elmt (E));
-                     end loop;
-                  end if;
-               end;
-            end if;
-
-            --  Recursively copy descendents
-
-            Set_Field1
-              (New_Node, Copy_Field_With_Replacement (Field1 (New_Node)));
-            Set_Field2
-              (New_Node, Copy_Field_With_Replacement (Field2 (New_Node)));
-            Set_Field3
-              (New_Node, Copy_Field_With_Replacement (Field3 (New_Node)));
-            Set_Field4
-              (New_Node, Copy_Field_With_Replacement (Field4 (New_Node)));
-            Set_Field5
-              (New_Node, Copy_Field_With_Replacement (Field5 (New_Node)));
-
-            --  Adjust Sloc of new node if necessary
-
-            if New_Sloc /= No_Location then
-               Set_Sloc (New_Node, New_Sloc);
-
-               --  If we adjust the Sloc, then we are essentially making
-               --  a completely new node, so the Comes_From_Source flag
-               --  should be reset to the proper default value.
-
-               Nodes.Table (New_Node).Comes_From_Source :=
-                 Default_Node.Comes_From_Source;
-            end if;
-
-            --  Reset First_Real_Statement for Handled_Sequence_Of_Statements.
-            --  The replacement mechanism applies to entities, and is not used
-            --  here. Eventually we may need a more general graph-copying
-            --  routine. For now, do a sequential search to find desired node.
-
-            if Nkind (Old_Node) = N_Handled_Sequence_Of_Statements
-              and then Present (First_Real_Statement (Old_Node))
-            then
-               declare
-                  Old_F  : constant Node_Id := First_Real_Statement (Old_Node);
-                  N1, N2 : Node_Id;
-
-               begin
-                  N1 := First (Statements (Old_Node));
-                  N2 := First (Statements (New_Node));
-
-                  while N1 /= Old_F loop
-                     Next (N1);
-                     Next (N2);
-                  end loop;
-
-                  Set_First_Real_Statement (New_Node, N2);
-               end;
-            end if;
-         end if;
-
-         --  All done, return copied node
-
-         return New_Node;
-      end Copy_Node_With_Replacement;
-
-      -----------------
-      -- Visit_Elist --
-      -----------------
-
-      procedure Visit_Elist (E : Elist_Id) is
-         Elmt : Elmt_Id;
-      begin
-         if Present (E) then
-            Elmt := First_Elmt (E);
-
-            while Elmt /= No_Elmt loop
-               Visit_Node (Node (Elmt));
-               Next_Elmt (Elmt);
-            end loop;
-         end if;
-      end Visit_Elist;
-
-      -----------------
-      -- Visit_Field --
-      -----------------
-
-      procedure Visit_Field (F : Union_Id; N : Node_Id) is
-      begin
-         if F = Union_Id (Empty) then
-            return;
-
-         elsif F in Node_Range then
-
-            --  Copy node if it is syntactic, i.e. its parent pointer is
-            --  set to point to the field that referenced it (certain
-            --  Itypes will also meet this criterion, which is fine, since
-            --  these are clearly Itypes that do need to be copied, since
-            --  we are copying their parent.)
-
-            if Parent (Node_Id (F)) = N then
-               Visit_Node (Node_Id (F));
-               return;
-
-            --  Another case, if we are pointing to an Itype, then we want
-            --  to copy it if its associated node is somewhere in the tree
-            --  being copied.
-
-            --  Note: the exclusion of self-referential copies is just an
-            --  optimization, since the search of the already copied list
-            --  would catch it, but it is a common case (Etype pointing
-            --  to itself for an Itype that is a base type).
-
-            elsif Has_Extension (Node_Id (F))
-              and then Is_Itype (Entity_Id (F))
-              and then Node_Id (F) /= N
-            then
-               declare
-                  P : Node_Id;
-
-               begin
-                  P := Associated_Node_For_Itype (Node_Id (F));
-                  while Present (P) loop
-                     if P = Source then
-                        Visit_Node (Node_Id (F));
-                        return;
-                     else
-                        P := Parent (P);
-                     end if;
-                  end loop;
-
-                  --  An Itype whose parent is not being copied definitely
-                  --  should NOT be copied, since it does not belong in any
-                  --  sense to the copied subtree.
-
-                  return;
-               end;
-            end if;
-
-         elsif F in List_Range
-           and then Parent (List_Id (F)) = N
-         then
-            Visit_List (List_Id (F));
-            return;
-         end if;
-      end Visit_Field;
-
-      -----------------
-      -- Visit_Itype --
-      -----------------
-
-      --  Note: we are relying on far too much semantic knowledge in this
-      --  routine, it really should just do a blind replacement of all
-      --  fields, or at least a more blind replacement. For example, we
-      --  do not deal with corresponding record types, and that works
-      --  because we have no Itypes of task types, but nowhere is there
-      --  a guarantee that this will always be the case. ???
-
-      procedure Visit_Itype (Old_Itype : Entity_Id) is
-         New_Itype : Entity_Id;
-         E         : Elmt_Id;
-         Ent       : Entity_Id;
-
-      begin
-         --  Itypes that describe the designated type of access to subprograms
-         --  have the structure of subprogram declarations, with signatures,
-         --  etc. Either we duplicate the signatures completely, or choose to
-         --  share such itypes, which is fine because their elaboration will
-         --  have no side effects. In any case, this is additional semantic
-         --  information that seems awkward to have in atree.
-
-         if Ekind (Old_Itype) = E_Subprogram_Type then
-            return;
-         end if;
-
-         New_Itype := New_Copy (Old_Itype);
-
-         --  The new Itype has all the attributes of the old one, and
-         --  we just copy the contents of the entity. However, the back-end
-         --  needs different names for debugging purposes, so we create a
-         --  new internal name by appending the letter 'c' (copy) to the
-         --  name of the original.
-
-         Get_Name_String (Chars (Old_Itype));
-         Add_Char_To_Name_Buffer ('c');
-         Set_Chars (New_Itype, Name_Enter);
-
-         --  If our associated node is an entity that has already been copied,
-         --  then set the associated node of the copy to point to the right
-         --  copy. If we have copied an Itype that is itself the associated
-         --  node of some previously copied Itype, then we set the right
-         --  pointer in the other direction.
-
-         if Present (Actual_Map) then
-
-            --  Case of hash tables used
-
-            if NCT_Hash_Tables_Used then
-
-               Ent := NCT_Assoc.Get (Associated_Node_For_Itype (Old_Itype));
-               if Present (Ent) then
-                  Set_Associated_Node_For_Itype (New_Itype, Ent);
-               end if;
-
-               Ent := NCT_Itype_Assoc.Get (Old_Itype);
-               if Present (Ent) then
-                  Set_Associated_Node_For_Itype (Ent, New_Itype);
-               end if;
-
-            --  Case of hash tables not used
-
-            else
-               E := First_Elmt (Actual_Map);
-               while Present (E) loop
-                  if Associated_Node_For_Itype (Old_Itype) = Node (E) then
-                     Set_Associated_Node_For_Itype
-                       (New_Itype, Node (Next_Elmt (E)));
-                  end if;
-
-                  if Is_Type (Node (E))
-                    and then
-                      Old_Itype = Associated_Node_For_Itype (Node (E))
-                  then
-                     Set_Associated_Node_For_Itype
-                       (Node (Next_Elmt (E)), New_Itype);
-                  end if;
-
-                  E := Next_Elmt (Next_Elmt (E));
-               end loop;
-            end if;
-         end if;
-
-         if Present (Freeze_Node (New_Itype)) then
-            Set_Is_Frozen (New_Itype, False);
-            Set_Freeze_Node (New_Itype, Empty);
-         end if;
-
-         --  Add new association to map
-
-         if No (Actual_Map) then
-            Actual_Map := New_Elmt_List;
-         end if;
-
-         Append_Elmt (Old_Itype, Actual_Map);
-         Append_Elmt (New_Itype, Actual_Map);
-
-         if NCT_Hash_Tables_Used then
-            NCT_Assoc.Set (Old_Itype, New_Itype);
-
-         else
-            NCT_Table_Entries := NCT_Table_Entries + 1;
-
-            if NCT_Table_Entries > NCT_Hash_Threshhold then
-               Build_NCT_Hash_Tables;
-            end if;
-         end if;
-
-         --  If a record subtype is simply copied, the entity list will be
-         --  shared. Thus cloned_Subtype must be set to indicate the sharing.
-
-         if Ekind (Old_Itype) = E_Record_Subtype
-           or else Ekind (Old_Itype) = E_Class_Wide_Subtype
-         then
-            Set_Cloned_Subtype (New_Itype, Old_Itype);
-         end if;
-
-         --  Visit descendents that eventually get copied
-
-         Visit_Field (Union_Id (Etype (Old_Itype)), Old_Itype);
-
-         if Is_Discrete_Type (Old_Itype) then
-            Visit_Field (Union_Id (Scalar_Range (Old_Itype)), Old_Itype);
-
-         elsif Has_Discriminants (Base_Type (Old_Itype)) then
-            --  ??? This should involve call to Visit_Field
-            Visit_Elist (Discriminant_Constraint (Old_Itype));
-
-         elsif Is_Array_Type (Old_Itype) then
-            if Present (First_Index (Old_Itype)) then
-               Visit_Field (Union_Id (List_Containing
-                                (First_Index (Old_Itype))),
-                            Old_Itype);
-            end if;
-
-            if Is_Packed (Old_Itype) then
-               Visit_Field (Union_Id (Packed_Array_Type (Old_Itype)),
-                            Old_Itype);
-            end if;
-         end if;
-      end Visit_Itype;
-
-      ----------------
-      -- Visit_List --
-      ----------------
-
-      procedure Visit_List (L : List_Id) is
-         N : Node_Id;
-      begin
-         if L /= No_List then
-            N := First (L);
-
-            while Present (N) loop
-               Visit_Node (N);
-               Next (N);
-            end loop;
-         end if;
-      end Visit_List;
-
-      ----------------
-      -- Visit_Node --
-      ----------------
-
-      procedure Visit_Node (N : Node_Or_Entity_Id) is
-
-      --  Start of processing for Visit_Node
-
-      begin
-         --  Handle case of an Itype, which must be copied
-
-         if Has_Extension (N)
-           and then Is_Itype (N)
-         then
-            --  Nothing to do if already in the list. This can happen with an
-            --  Itype entity that appears more than once in the tree.
-            --  Note that we do not want to visit descendents in this case.
-
-            --  Test for already in list when hash table is used
-
-            if NCT_Hash_Tables_Used then
-               if Present (NCT_Assoc.Get (Entity_Id (N))) then
-                  return;
-               end if;
-
-            --  Test for already in list when hash table not used
-
-            else
-               declare
-                  E : Elmt_Id;
-               begin
-                  if Present (Actual_Map) then
-                     E := First_Elmt (Actual_Map);
-                     while Present (E) loop
-                        if Node (E) = N then
-                           return;
-                        else
-                           E := Next_Elmt (Next_Elmt (E));
-                        end if;
-                     end loop;
-                  end if;
-               end;
-            end if;
-
-            Visit_Itype (N);
-         end if;
-
-         --  Visit descendents
-
-         Visit_Field (Field1 (N), N);
-         Visit_Field (Field2 (N), N);
-         Visit_Field (Field3 (N), N);
-         Visit_Field (Field4 (N), N);
-         Visit_Field (Field5 (N), N);
-      end Visit_Node;
-
-   --  Start of processing for New_Copy_Tree
-
-   begin
-      Actual_Map := Map;
-
-      --  See if we should use hash table
-
-      if No (Actual_Map) then
-         NCT_Hash_Tables_Used := False;
-
-      else
-         declare
-            Elmt : Elmt_Id;
-
-         begin
-            NCT_Table_Entries := 0;
-
-            Elmt := First_Elmt (Actual_Map);
-            while Present (Elmt) loop
-               NCT_Table_Entries := NCT_Table_Entries + 1;
-               Next_Elmt (Elmt);
-               Next_Elmt (Elmt);
-            end loop;
-
-            if NCT_Table_Entries > NCT_Hash_Threshhold then
-               Build_NCT_Hash_Tables;
-            else
-               NCT_Hash_Tables_Used := False;
-            end if;
-         end;
-      end if;
-
-      --  Hash table set up if required, now start phase one by visiting
-      --  top node (we will recursively visit the descendents).
-
-      Visit_Node (Source);
-
-      --  Now the second phase of the copy can start. First we process
-      --  all the mapped entities, copying their descendents.
-
-      if Present (Actual_Map) then
-         declare
-            Elmt      : Elmt_Id;
-            New_Itype : Entity_Id;
-         begin
-            Elmt := First_Elmt (Actual_Map);
-            while Present (Elmt) loop
-               Next_Elmt (Elmt);
-               New_Itype := Node (Elmt);
-               Copy_Itype_With_Replacement (New_Itype);
-               Next_Elmt (Elmt);
-            end loop;
-         end;
-      end if;
-
-      --  Now we can copy the actual tree
-
-      return Copy_Node_With_Replacement (Source);
-   end New_Copy_Tree;
-
-   ----------------
-   -- New_Entity --
-   ----------------
-
-   function New_Entity
-     (New_Node_Kind : Node_Kind;
-      New_Sloc      : Source_Ptr) return Entity_Id
-   is
-      Ent : Entity_Id;
-
-      procedure New_Entity_Debugging_Output;
-      pragma Inline (New_Entity_Debugging_Output);
-      --  Debugging routine for debug flag N
-
-      ---------------------------------
-      -- New_Entity_Debugging_Output --
-      ---------------------------------
-
-      procedure New_Entity_Debugging_Output is
-      begin
-         if Debug_Flag_N then
-            Write_Str ("Allocate entity, Id = ");
-            Write_Int (Int (Ent));
-            Write_Str ("  ");
-            Write_Location (New_Sloc);
-            Write_Str ("  ");
-            Write_Str (Node_Kind'Image (New_Node_Kind));
-            Write_Eol;
-         end if;
-      end New_Entity_Debugging_Output;
-
-   --  Start of processing for New_Entity
-
-   begin
-      pragma Assert (New_Node_Kind in N_Entity);
-
-      Ent := Allocate_Initialize_Node (Empty, With_Extension => True);
-
-      --  If this is a node with a real location and we are generating
-      --  source nodes, then reset Current_Error_Node. This is useful
-      --  if we bomb during parsing to get a error location for the bomb.
-
-      if Default_Node.Comes_From_Source and then New_Sloc > No_Location then
-         Current_Error_Node := Ent;
-      end if;
-
-      Nodes.Table (Ent).Nkind  := New_Node_Kind;
-      Nodes.Table (Ent).Sloc   := New_Sloc;
-      pragma Debug (New_Entity_Debugging_Output);
-
-      return Ent;
-   end New_Entity;
-
-   --------------
-   -- New_Node --
-   --------------
-
-   function New_Node
-     (New_Node_Kind : Node_Kind;
-      New_Sloc      : Source_Ptr) return Node_Id
-   is
-      Nod : Node_Id;
-
-      procedure New_Node_Debugging_Output;
-      pragma Inline (New_Node_Debugging_Output);
-      --  Debugging routine for debug flag N
-
-      --------------------------
-      -- New_Debugging_Output --
-      --------------------------
-
-      procedure New_Node_Debugging_Output is
-      begin
-         if Debug_Flag_N then
-            Write_Str ("Allocate node, Id = ");
-            Write_Int (Int (Nod));
-            Write_Str ("  ");
-            Write_Location (New_Sloc);
-            Write_Str ("  ");
-            Write_Str (Node_Kind'Image (New_Node_Kind));
-            Write_Eol;
-         end if;
-      end New_Node_Debugging_Output;
-
-   --  Start of processing for New_Node
-
-   begin
-      pragma Assert (New_Node_Kind not in N_Entity);
-      Nod := Allocate_Initialize_Node (Empty, With_Extension => False);
-      Nodes.Table (Nod).Nkind := New_Node_Kind;
-      Nodes.Table (Nod).Sloc  := New_Sloc;
-      pragma Debug (New_Node_Debugging_Output);
-
-      --  If this is a node with a real location and we are generating
-      --  source nodes, then reset Current_Error_Node. This is useful
-      --  if we bomb during parsing to get a error location for the bomb.
-
-      if Default_Node.Comes_From_Source and then New_Sloc > No_Location then
-         Current_Error_Node := Nod;
-      end if;
-
-      return Nod;
-   end New_Node;
-
-   -----------
-   -- Nkind --
-   -----------
-
-   function Nkind (N : Node_Id) return Node_Kind is
-   begin
-      return Nodes.Table (N).Nkind;
-   end Nkind;
-
-   --------
-   -- No --
-   --------
-
-   function No (N : Node_Id) return Boolean is
-   begin
-      return N = Empty;
-   end No;
-
-   -------------------
-   -- Nodes_Address --
-   -------------------
-
-   function Nodes_Address return System.Address is
-   begin
-      return Nodes.Table (First_Node_Id)'Address;
-   end Nodes_Address;
+   function Nodes_Address return System.Address is
+   begin
+      return Nodes.Table (First_Node_Id)'Address;
+   end Nodes_Address;
 
    ---------------
    -- Num_Nodes --
@@ -2078,11 +1495,11 @@ package body Atree is
    -- Paren_Count --
    -----------------
 
-   function Paren_Count (N : Node_Id) return Paren_Count_Type is
-      C : Paren_Count_Type := 0;
+   function Paren_Count (N : Node_Id) return Nat is
+      C : Nat := 0;
 
    begin
-      pragma Assert (N in Nodes.First .. Nodes.Last);
+      pragma Assert (N <= Nodes.Last);
 
       if Nodes.Table (N).Pflag1 then
          C := C + 1;
@@ -2092,7 +1509,22 @@ package body Atree is
          C := C + 2;
       end if;
 
-      return C;
+      --  Value of 0,1,2 returned as is
+
+      if C <= 2 then
+         return C;
+
+      --  Value of 3 means we search the table, and we must find an entry
+
+      else
+         for J in Paren_Counts.First .. Paren_Counts.Last loop
+            if N = Paren_Counts.Table (J).Nod then
+               return Paren_Counts.Table (J).Count;
+            end if;
+         end loop;
+
+         raise Program_Error;
+      end if;
    end Paren_Count;
 
    ------------
@@ -2140,7 +1572,7 @@ package body Atree is
       end if;
 
       New_Node := New_Copy (Source);
-      Fix_Parents (Source, New_Node);
+      Fix_Parents (Ref_Node => Source, Fix_Node => New_Node);
 
       --  We now set the parent of the new node to be the same as the
       --  parent of the source. Almost always this parent will be
@@ -2167,24 +1599,26 @@ package body Atree is
    -------------
 
    procedure Replace (Old_Node, New_Node : Node_Id) is
-      Old_Post : constant Boolean  := Nodes.Table (Old_Node).Error_Posted;
-      Old_CFS  : constant Boolean  := Nodes.Table (Old_Node).Comes_From_Source;
+      Old_Post : constant Boolean := Nodes.Table (Old_Node).Error_Posted;
+      Old_HasA : constant Boolean := Nodes.Table (Old_Node).Has_Aspects;
+      Old_CFS  : constant Boolean := Nodes.Table (Old_Node).Comes_From_Source;
 
    begin
       pragma Assert
         (not Has_Extension (Old_Node)
-           and not Has_Extension (New_Node)
-           and not Nodes.Table (New_Node).In_List);
+          and not Has_Extension (New_Node)
+          and not Nodes.Table (New_Node).In_List);
 
-      --  Do copy, preserving link and in list status and comes from source
+      --  Do copy, preserving link and in list status and required flags
 
       Copy_Node (Source => New_Node, Destination => Old_Node);
       Nodes.Table (Old_Node).Comes_From_Source := Old_CFS;
       Nodes.Table (Old_Node).Error_Posted      := Old_Post;
+      Nodes.Table (Old_Node).Has_Aspects       := Old_HasA;
 
       --  Fix parents of substituted node, since it has changed identity
 
-      Fix_Parents (New_Node, Old_Node);
+      Fix_Parents (Ref_Node => New_Node, Fix_Node => Old_Node);
 
       --  Since we are doing a replace, we assume that the original node
       --  is intended to become the new replaced node. The call would be
@@ -2192,9 +1626,11 @@ package body Atree is
 
       Orig_Nodes.Table (Old_Node) := Old_Node;
 
-      --  Finally delete the source, since it is now copied
+      --  Invoke the reporting procedure (if available)
 
-      Delete_Node (New_Node);
+      if Reporting_Proc /= null then
+         Reporting_Proc.all (Target => Old_Node, Source => New_Node);
+      end if;
    end Replace;
 
    -------------
@@ -2202,11 +1638,13 @@ package body Atree is
    -------------
 
    procedure Rewrite (Old_Node, New_Node : Node_Id) is
-
       Old_Error_P : constant Boolean  := Nodes.Table (Old_Node).Error_Posted;
-      --  This fields is always preserved in the new node
+      --  This field is always preserved in the new node
+
+      Old_Has_Aspects : constant Boolean := Nodes.Table (Old_Node).Has_Aspects;
+      --  This field is always preserved in the new node
 
-      Old_Paren_Count     : Paren_Count_Type;
+      Old_Paren_Count     : Nat;
       Old_Must_Not_Freeze : Boolean;
       --  These fields are preserved in the new node only if the new node
       --  and the old node are both subexpression nodes.
@@ -2219,14 +1657,15 @@ package body Atree is
    begin
       pragma Assert
         (not Has_Extension (Old_Node)
-           and not Has_Extension (New_Node)
-           and not Nodes.Table (New_Node).In_List);
+          and not Has_Extension (New_Node)
+          and not Nodes.Table (New_Node).In_List);
+      pragma Debug (Rewrite_Debugging_Output (Old_Node, New_Node));
 
       if Nkind (Old_Node) in N_Subexpr then
          Old_Paren_Count     := Paren_Count (Old_Node);
          Old_Must_Not_Freeze := Must_Not_Freeze (Old_Node);
       else
-         Old_Paren_Count := 0;
+         Old_Paren_Count     := 0;
          Old_Must_Not_Freeze := False;
       end if;
 
@@ -2240,21 +1679,67 @@ package body Atree is
          Sav_Node := New_Copy (Old_Node);
          Orig_Nodes.Table (Sav_Node) := Sav_Node;
          Orig_Nodes.Table (Old_Node) := Sav_Node;
+
+         --  Both the old and new copies of the node will share the same list
+         --  of aspect specifications if aspect specifications are present.
+
+         if Has_Aspects (Sav_Node) then
+            Set_Has_Aspects (Sav_Node, False);
+            Set_Aspect_Specifications
+              (Sav_Node, Aspect_Specifications (Old_Node));
+         end if;
       end if;
 
       --  Copy substitute node into place, preserving old fields as required
 
       Copy_Node (Source => New_Node, Destination => Old_Node);
       Nodes.Table (Old_Node).Error_Posted := Old_Error_P;
+      Nodes.Table (Old_Node).Has_Aspects  := Old_Has_Aspects;
 
       if Nkind (New_Node) in N_Subexpr then
          Set_Paren_Count     (Old_Node, Old_Paren_Count);
          Set_Must_Not_Freeze (Old_Node, Old_Must_Not_Freeze);
       end if;
 
-      Fix_Parents (New_Node, Old_Node);
+      Fix_Parents (Ref_Node => New_Node, Fix_Node => Old_Node);
+
+      --  Invoke the reporting procedure (if available)
+
+      if Reporting_Proc /= null then
+         Reporting_Proc.all (Target => Old_Node, Source => New_Node);
+      end if;
    end Rewrite;
 
+   -------------------------
+   -- Rewrite_Breakpoint --
+   -------------------------
+
+   procedure rr is
+   begin
+      Write_Str ("Watched node ");
+      Write_Int (Int (Watch_Node));
+      Write_Str (" rewritten");
+      Write_Eol;
+   end rr;
+
+   ------------------------------
+   -- Rewrite_Debugging_Output --
+   ------------------------------
+
+   procedure rrd (Old_Node, New_Node : Node_Id) is
+      Node_Is_Watched : constant Boolean := Old_Node = Watch_Node;
+
+   begin
+      if Debug_Flag_N or else Node_Is_Watched then
+         Node_Debug_Output ("Rewrite", Old_Node);
+         Node_Debug_Output ("into",    New_Node);
+
+         if Node_Is_Watched then
+            Rewrite_Breakpoint;
+         end if;
+      end if;
+   end rrd;
+
    ------------------
    -- Set_Analyzed --
    ------------------
@@ -2270,7 +1755,7 @@ package body Atree is
 
    procedure Set_Comes_From_Source (N : Node_Id; Val : Boolean) is
    begin
-      pragma Assert (N in Nodes.First .. Nodes.Last);
+      pragma Assert (N <= Nodes.Last);
       Nodes.Table (N).Comes_From_Source := Val;
    end Set_Comes_From_Source;
 
@@ -2283,19 +1768,6 @@ package body Atree is
       Default_Node.Comes_From_Source := Default;
    end Set_Comes_From_Source_Default;
 
-   --------------------
-   -- Set_Convention --
-   --------------------
-
-   procedure Set_Convention  (E : Entity_Id; Val : Convention_Id) is
-   begin
-      pragma Assert (Nkind (E) in N_Entity);
-      To_Flag_Word_Ptr
-        (Union_Id_Ptr'
-          (Nodes.Table (E + 2).Field12'Unrestricted_Access)).Convention :=
-                                                                        Val;
-   end Set_Convention;
-
    ---------------
    -- Set_Ekind --
    ---------------
@@ -2316,14 +1788,53 @@ package body Atree is
    end Set_Error_Posted;
 
    ---------------------
+   -- Set_Has_Aspects --
+   ---------------------
+
+   procedure Set_Has_Aspects (N : Node_Id; Val : Boolean := True) is
+   begin
+      pragma Assert (N <= Nodes.Last);
+      Nodes.Table (N).Has_Aspects := Val;
+   end Set_Has_Aspects;
+
+   -----------------------
+   -- Set_Original_Node --
+   -----------------------
+
+   procedure Set_Original_Node (N : Node_Id; Val : Node_Id) is
+   begin
+      Orig_Nodes.Table (N) := Val;
+   end Set_Original_Node;
+
+   ---------------------
    -- Set_Paren_Count --
    ---------------------
 
-   procedure Set_Paren_Count (N : Node_Id; Val : Paren_Count_Type) is
+   procedure Set_Paren_Count (N : Node_Id; Val : Nat) is
    begin
       pragma Assert (Nkind (N) in N_Subexpr);
-      Nodes.Table (N).Pflag1 := (Val mod 2 /= 0);
-      Nodes.Table (N).Pflag2 := (Val >= 2);
+
+      --  Value of 0,1,2 stored as is
+
+      if Val <= 2 then
+         Nodes.Table (N).Pflag1 := (Val mod 2 /= 0);
+         Nodes.Table (N).Pflag2 := (Val = 2);
+
+      --  Value of 3 or greater stores 3 in node and makes table entry
+
+      else
+         Nodes.Table (N).Pflag1 := True;
+         Nodes.Table (N).Pflag2 := True;
+
+         for J in Paren_Counts.First .. Paren_Counts.Last loop
+            if N = Paren_Counts.Table (J).Nod then
+               Paren_Counts.Table (J).Count := Val;
+               return;
+            end if;
+         end loop;
+
+         Paren_Counts.Append ((Nod => N, Count => Val));
+      end if;
    end Set_Paren_Count;
 
    ----------------
@@ -2358,12 +1869,12 @@ package body Atree is
    -- Traverse_Func --
    -------------------
 
-   function Traverse_Func (Node : Node_Id) return Traverse_Result is
+   function Traverse_Func (Node : Node_Id) return Traverse_Final_Result is
 
       function Traverse_Field
         (Nod : Node_Id;
          Fld : Union_Id;
-         FN  : Field_Num) return Traverse_Result;
+         FN  : Field_Num) return Traverse_Final_Result;
       --  Fld is one of the fields of Nod. If the field points to syntactic
       --  node or list, then this node or list is traversed, and the result is
       --  the result of this traversal. Otherwise a value of True is returned
@@ -2376,7 +1887,7 @@ package body Atree is
       function Traverse_Field
         (Nod : Node_Id;
          Fld : Union_Id;
-         FN  : Field_Num) return Traverse_Result
+         FN  : Field_Num) return Traverse_Final_Result
       is
       begin
          if Fld = Union_Id (Empty) then
@@ -2431,10 +1942,21 @@ package body Atree is
          end if;
       end Traverse_Field;
 
+      Cur_Node : Node_Id := Node;
+
    --  Start of processing for Traverse_Func
 
    begin
-      case Process (Node) is
+      --  We walk Field2 last, and if it is a node, we eliminate the tail
+      --  recursion by jumping back to this label. This is because Field2 is
+      --  where the Left_Opnd field of N_Op_Concat is stored, and in practice
+      --  concatenations are sometimes deeply nested, as in X1&X2&...&XN. This
+      --  trick prevents us from running out of memory in that case. We don't
+      --  bother eliminating the tail recursion if Field2 is a list.
+
+      <<Tail_Recurse>>
+
+      case Process (Cur_Node) is
          when Abandon =>
             return Abandon;
 
@@ -2442,41 +1964,38 @@ package body Atree is
             return OK;
 
          when OK =>
-            if Traverse_Field (Node, Union_Id (Field1 (Node)), 1) = Abandon
-                 or else
-               Traverse_Field (Node, Union_Id (Field2 (Node)), 2) = Abandon
-                 or else
-               Traverse_Field (Node, Union_Id (Field3 (Node)), 3) = Abandon
-                 or else
-               Traverse_Field (Node, Union_Id (Field4 (Node)), 4) = Abandon
-                 or else
-               Traverse_Field (Node, Union_Id (Field5 (Node)), 5) = Abandon
-            then
-               return Abandon;
-            else
-               return OK;
-            end if;
+            null;
 
          when OK_Orig =>
-            declare
-               Onod : constant Node_Id := Original_Node (Node);
-            begin
-               if Traverse_Field (Onod, Union_Id (Field1 (Onod)), 1) = Abandon
-                    or else
-                  Traverse_Field (Onod, Union_Id (Field2 (Onod)), 2) = Abandon
-                    or else
-                  Traverse_Field (Onod, Union_Id (Field3 (Onod)), 3) = Abandon
-                    or else
-                  Traverse_Field (Onod, Union_Id (Field4 (Onod)), 4) = Abandon
-                    or else
-                  Traverse_Field (Onod, Union_Id (Field5 (Onod)), 5) = Abandon
-               then
-                  return Abandon;
-               else
-                  return OK_Orig;
-               end if;
-            end;
+            Cur_Node := Original_Node (Cur_Node);
       end case;
+
+      if Traverse_Field (Cur_Node, Field1 (Cur_Node), 1) = Abandon
+           or else  --  skip Field2 here
+         Traverse_Field (Cur_Node, Field3 (Cur_Node), 3) = Abandon
+           or else
+         Traverse_Field (Cur_Node, Field4 (Cur_Node), 4) = Abandon
+           or else
+         Traverse_Field (Cur_Node, Field5 (Cur_Node), 5) = Abandon
+      then
+         return Abandon;
+      end if;
+
+      if Field2 (Cur_Node) not in Node_Range then
+         return Traverse_Field (Cur_Node, Field2 (Cur_Node), 2);
+
+      elsif Is_Syntactic_Field (Nkind (Cur_Node), 2)
+        and then Field2 (Cur_Node) /= Empty_List_Or_Node
+      then
+         --  Here is the tail recursion step, we reset Cur_Node and jump back
+         --  to the start of the procedure, which has the same semantic effect
+         --  as a call.
+
+         Cur_Node := Node_Id (Field2 (Cur_Node));
+         goto Tail_Recurse;
+      end if;
+
+      return OK;
    end Traverse_Func;
 
    -------------------
@@ -2485,7 +2004,7 @@ package body Atree is
 
    procedure Traverse_Proc (Node : Node_Id) is
       function Traverse is new Traverse_Func (Process);
-      Discard : Traverse_Result;
+      Discard : Traverse_Final_Result;
       pragma Warnings (Off, Discard);
    begin
       Discard := Traverse (Node);
@@ -2500,6 +2019,7 @@ package body Atree is
       Tree_Read_Int (Node_Count);
       Nodes.Tree_Read;
       Orig_Nodes.Tree_Read;
+      Paren_Counts.Tree_Read;
    end Tree_Read;
 
    ----------------
@@ -2511,6 +2031,7 @@ package body Atree is
       Tree_Write_Int (Node_Count);
       Nodes.Tree_Write;
       Orig_Nodes.Tree_Write;
+      Paren_Counts.Tree_Write;
    end Tree_Write;
 
    ------------------------------
@@ -2521,31 +2042,31 @@ package body Atree is
 
       function Field1 (N : Node_Id) return Union_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Field1;
       end Field1;
 
       function Field2 (N : Node_Id) return Union_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Field2;
       end Field2;
 
       function Field3 (N : Node_Id) return Union_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Field3;
       end Field3;
 
       function Field4 (N : Node_Id) return Union_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Field4;
       end Field4;
 
       function Field5 (N : Node_Id) return Union_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Field5;
       end Field5;
 
@@ -2687,33 +2208,39 @@ package body Atree is
          return Nodes.Table (N + 4).Field10;
       end Field28;
 
+      function Field29 (N : Node_Id) return Union_Id is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return Nodes.Table (N + 4).Field11;
+      end Field29;
+
       function Node1 (N : Node_Id) return Node_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Node_Id (Nodes.Table (N).Field1);
       end Node1;
 
       function Node2 (N : Node_Id) return Node_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Node_Id (Nodes.Table (N).Field2);
       end Node2;
 
       function Node3 (N : Node_Id) return Node_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Node_Id (Nodes.Table (N).Field3);
       end Node3;
 
       function Node4 (N : Node_Id) return Node_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Node_Id (Nodes.Table (N).Field4);
       end Node4;
 
       function Node5 (N : Node_Id) return Node_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Node_Id (Nodes.Table (N).Field5);
       end Node5;
 
@@ -2855,33 +2382,39 @@ package body Atree is
          return Node_Id (Nodes.Table (N + 4).Field10);
       end Node28;
 
+      function Node29 (N : Node_Id) return Node_Id is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return Node_Id (Nodes.Table (N + 4).Field11);
+      end Node29;
+
       function List1 (N : Node_Id) return List_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return List_Id (Nodes.Table (N).Field1);
       end List1;
 
       function List2 (N : Node_Id) return List_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return List_Id (Nodes.Table (N).Field2);
       end List2;
 
       function List3 (N : Node_Id) return List_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return List_Id (Nodes.Table (N).Field3);
       end List3;
 
       function List4 (N : Node_Id) return List_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return List_Id (Nodes.Table (N).Field4);
       end List4;
 
       function List5 (N : Node_Id) return List_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return List_Id (Nodes.Table (N).Field5);
       end List5;
 
@@ -2897,8 +2430,25 @@ package body Atree is
          return List_Id (Nodes.Table (N + 2).Field7);
       end List14;
 
+      function List25 (N : Node_Id) return List_Id is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return List_Id (Nodes.Table (N + 4).Field7);
+      end List25;
+
+      function Elist1 (N : Node_Id) return Elist_Id is
+         pragma Assert (N <= Nodes.Last);
+         Value : constant Union_Id := Nodes.Table (N).Field1;
+      begin
+         if Value = 0 then
+            return No_Elist;
+         else
+            return Elist_Id (Value);
+         end if;
+      end Elist1;
+
       function Elist2 (N : Node_Id) return Elist_Id is
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Value : constant Union_Id := Nodes.Table (N).Field2;
       begin
          if Value = 0 then
@@ -2909,7 +2459,7 @@ package body Atree is
       end Elist2;
 
       function Elist3 (N : Node_Id) return Elist_Id is
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Value : constant Union_Id := Nodes.Table (N).Field3;
       begin
          if Value = 0 then
@@ -2920,7 +2470,7 @@ package body Atree is
       end Elist3;
 
       function Elist4 (N : Node_Id) return Elist_Id is
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Value : constant Union_Id := Nodes.Table (N).Field4;
       begin
          if Value = 0 then
@@ -2930,6 +2480,17 @@ package body Atree is
          end if;
       end Elist4;
 
+      function Elist5 (N : Node_Id) return Elist_Id is
+         pragma Assert (N <= Nodes.Last);
+         Value : constant Union_Id := Nodes.Table (N).Field5;
+      begin
+         if Value = 0 then
+            return No_Elist;
+         else
+            return Elist_Id (Value);
+         end if;
+      end Elist5;
+
       function Elist8 (N : Node_Id) return Elist_Id is
          pragma Assert (Nkind (N) in N_Entity);
          Value : constant Union_Id := Nodes.Table (N + 1).Field8;
@@ -2941,6 +2502,17 @@ package body Atree is
          end if;
       end Elist8;
 
+      function Elist10 (N : Node_Id) return Elist_Id is
+         pragma Assert (Nkind (N) in N_Entity);
+         Value : constant Union_Id := Nodes.Table (N + 1).Field10;
+      begin
+         if Value = 0 then
+            return No_Elist;
+         else
+            return Elist_Id (Value);
+         end if;
+      end Elist10;
+
       function Elist13 (N : Node_Id) return Elist_Id is
          pragma Assert (Nkind (N) in N_Entity);
          Value : constant Union_Id := Nodes.Table (N + 2).Field6;
@@ -3007,6 +2579,17 @@ package body Atree is
          end if;
       end Elist23;
 
+      function Elist24 (N : Node_Id) return Elist_Id is
+         pragma Assert (Nkind (N) in N_Entity);
+         Value : constant Union_Id := Nodes.Table (N + 4).Field6;
+      begin
+         if Value = 0 then
+            return No_Elist;
+         else
+            return Elist_Id (Value);
+         end if;
+      end Elist24;
+
       function Elist25 (N : Node_Id) return Elist_Id is
          pragma Assert (Nkind (N) in N_Entity);
          Value : constant Union_Id := Nodes.Table (N + 4).Field7;
@@ -3018,26 +2601,37 @@ package body Atree is
          end if;
       end Elist25;
 
+      function Elist26 (N : Node_Id) return Elist_Id is
+         pragma Assert (Nkind (N) in N_Entity);
+         Value : constant Union_Id := Nodes.Table (N + 4).Field8;
+      begin
+         if Value = 0 then
+            return No_Elist;
+         else
+            return Elist_Id (Value);
+         end if;
+      end Elist26;
+
       function Name1 (N : Node_Id) return Name_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Name_Id (Nodes.Table (N).Field1);
       end Name1;
 
       function Name2 (N : Node_Id) return Name_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Name_Id (Nodes.Table (N).Field2);
       end Name2;
 
       function Str3 (N : Node_Id) return String_Id is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return String_Id (Nodes.Table (N).Field3);
       end Str3;
 
       function Uint2 (N : Node_Id) return Uint is
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          U : constant Union_Id := Nodes.Table (N).Field2;
       begin
          if U = 0 then
@@ -3048,7 +2642,7 @@ package body Atree is
       end Uint2;
 
       function Uint3 (N : Node_Id) return Uint is
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          U : constant Union_Id := Nodes.Table (N).Field3;
       begin
          if U = 0 then
@@ -3059,7 +2653,7 @@ package body Atree is
       end Uint3;
 
       function Uint4 (N : Node_Id) return Uint is
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          U : constant Union_Id := Nodes.Table (N).Field4;
       begin
          if U = 0 then
@@ -3070,7 +2664,7 @@ package body Atree is
       end Uint4;
 
       function Uint5 (N : Node_Id) return Uint is
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          U : constant Union_Id := Nodes.Table (N).Field5;
       begin
          if U = 0 then
@@ -3203,7 +2797,7 @@ package body Atree is
 
       function Ureal3 (N : Node_Id) return Ureal is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return From_Union (Nodes.Table (N).Field3);
       end Ureal3;
 
@@ -3221,91 +2815,91 @@ package body Atree is
 
       function Flag4 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag4;
       end Flag4;
 
       function Flag5 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag5;
       end Flag5;
 
       function Flag6 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag6;
       end Flag6;
 
       function Flag7 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag7;
       end Flag7;
 
       function Flag8 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag8;
       end Flag8;
 
       function Flag9 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag9;
       end Flag9;
 
       function Flag10 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag10;
       end Flag10;
 
       function Flag11 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag11;
       end Flag11;
 
       function Flag12 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag12;
       end Flag12;
 
       function Flag13 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag13;
       end Flag13;
 
       function Flag14 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag14;
       end Flag14;
 
       function Flag15 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag15;
       end Flag15;
 
       function Flag16 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag16;
       end Flag16;
 
       function Flag17 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag17;
       end Flag17;
 
       function Flag18 (N : Node_Id) return Boolean is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          return Nodes.Table (N).Flag18;
       end Flag18;
 
@@ -3318,7 +2912,7 @@ package body Atree is
       function Flag20 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return Nodes.Table (N + 1).Unused_1;
+         return Nodes.Table (N + 1).Has_Aspects;
       end Flag20;
 
       function Flag21 (N : Node_Id) return Boolean is
@@ -3444,7 +3038,7 @@ package body Atree is
       function Flag41 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return Nodes.Table (N + 2).Unused_1;
+         return Nodes.Table (N + 2).Has_Aspects;
       end Flag41;
 
       function Flag42 (N : Node_Id) return Boolean is
@@ -3978,7 +3572,7 @@ package body Atree is
       function Flag130 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return Nodes.Table (N + 3).Unused_1;
+         return Nodes.Table (N + 3).Has_Aspects;
       end Flag130;
 
       function Flag131 (N : Node_Id) return Boolean is
@@ -4278,252 +3872,486 @@ package body Atree is
       function Flag180 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word3 (Nodes.Table (N + 3).Field11).Flag180;
-      end Flag180;
+         return To_Flag_Word3 (Nodes.Table (N + 3).Field11).Flag180;
+      end Flag180;
+
+      function Flag181 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word3 (Nodes.Table (N + 3).Field11).Flag181;
+      end Flag181;
+
+      function Flag182 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word3 (Nodes.Table (N + 3).Field11).Flag182;
+      end Flag182;
+
+      function Flag183 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word3 (Nodes.Table (N + 3).Field11).Flag183;
+      end Flag183;
+
+      function Flag184 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag184;
+      end Flag184;
+
+      function Flag185 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag185;
+      end Flag185;
+
+      function Flag186 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag186;
+      end Flag186;
+
+      function Flag187 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag187;
+      end Flag187;
+
+      function Flag188 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag188;
+      end Flag188;
+
+      function Flag189 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag189;
+      end Flag189;
+
+      function Flag190 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag190;
+      end Flag190;
+
+      function Flag191 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag191;
+      end Flag191;
+
+      function Flag192 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag192;
+      end Flag192;
+
+      function Flag193 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag193;
+      end Flag193;
+
+      function Flag194 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag194;
+      end Flag194;
+
+      function Flag195 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag195;
+      end Flag195;
+
+      function Flag196 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag196;
+      end Flag196;
+
+      function Flag197 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag197;
+      end Flag197;
+
+      function Flag198 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag198;
+      end Flag198;
+
+      function Flag199 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag199;
+      end Flag199;
+
+      function Flag200 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag200;
+      end Flag200;
+
+      function Flag201 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag201;
+      end Flag201;
+
+      function Flag202 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag202;
+      end Flag202;
+
+      function Flag203 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag203;
+      end Flag203;
+
+      function Flag204 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag204;
+      end Flag204;
+
+      function Flag205 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag205;
+      end Flag205;
+
+      function Flag206 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag206;
+      end Flag206;
+
+      function Flag207 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag207;
+      end Flag207;
+
+      function Flag208 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag208;
+      end Flag208;
+
+      function Flag209 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag209;
+      end Flag209;
+
+      function Flag210 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag210;
+      end Flag210;
+
+      function Flag211 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag211;
+      end Flag211;
+
+      function Flag212 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag212;
+      end Flag212;
+
+      function Flag213 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag213;
+      end Flag213;
+
+      function Flag214 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag214;
+      end Flag214;
+
+      function Flag215 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return To_Flag_Word4 (Nodes.Table (N + 4).Field12).Flag215;
+      end Flag215;
+
+      function Flag216 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return Nodes.Table (N + 4).In_List;
+      end Flag216;
+
+      function Flag217 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return Nodes.Table (N + 4).Has_Aspects;
+      end Flag217;
+
+      function Flag218 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return Nodes.Table (N + 4).Rewrite_Ins;
+      end Flag218;
+
+      function Flag219 (N : Node_Id) return Boolean is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         return Nodes.Table (N + 4).Analyzed;
+      end Flag219;
 
-      function Flag181 (N : Node_Id) return Boolean is
+      function Flag220 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word3 (Nodes.Table (N + 3).Field11).Flag181;
-      end Flag181;
+         return Nodes.Table (N + 4).Comes_From_Source;
+      end Flag220;
 
-      function Flag182 (N : Node_Id) return Boolean is
+      function Flag221 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word3 (Nodes.Table (N + 3).Field11).Flag182;
-      end Flag182;
+         return Nodes.Table (N + 4).Error_Posted;
+      end Flag221;
 
-      function Flag183 (N : Node_Id) return Boolean is
+      function Flag222 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word3 (Nodes.Table (N + 3).Field11).Flag183;
-      end Flag183;
+         return Nodes.Table (N + 4).Flag4;
+      end Flag222;
 
-      function Flag184 (N : Node_Id) return Boolean is
+      function Flag223 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag184;
-      end Flag184;
+         return Nodes.Table (N + 4).Flag5;
+      end Flag223;
 
-      function Flag185 (N : Node_Id) return Boolean is
+      function Flag224 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag185;
-      end Flag185;
+         return Nodes.Table (N + 4).Flag6;
+      end Flag224;
 
-      function Flag186 (N : Node_Id) return Boolean is
+      function Flag225 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag186;
-      end Flag186;
+         return Nodes.Table (N + 4).Flag7;
+      end Flag225;
 
-      function Flag187 (N : Node_Id) return Boolean is
+      function Flag226 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag187;
-      end Flag187;
+         return Nodes.Table (N + 4).Flag8;
+      end Flag226;
 
-      function Flag188 (N : Node_Id) return Boolean is
+      function Flag227 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag188;
-      end Flag188;
+         return Nodes.Table (N + 4).Flag9;
+      end Flag227;
 
-      function Flag189 (N : Node_Id) return Boolean is
+      function Flag228 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag189;
-      end Flag189;
+         return Nodes.Table (N + 4).Flag10;
+      end Flag228;
 
-      function Flag190 (N : Node_Id) return Boolean is
+      function Flag229 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag190;
-      end Flag190;
+         return Nodes.Table (N + 4).Flag11;
+      end Flag229;
 
-      function Flag191 (N : Node_Id) return Boolean is
+      function Flag230 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag191;
-      end Flag191;
+         return Nodes.Table (N + 4).Flag12;
+      end Flag230;
 
-      function Flag192 (N : Node_Id) return Boolean is
+      function Flag231 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag192;
-      end Flag192;
+         return Nodes.Table (N + 4).Flag13;
+      end Flag231;
 
-      function Flag193 (N : Node_Id) return Boolean is
+      function Flag232 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag193;
-      end Flag193;
+         return Nodes.Table (N + 4).Flag14;
+      end Flag232;
 
-      function Flag194 (N : Node_Id) return Boolean is
+      function Flag233 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag194;
-      end Flag194;
+         return Nodes.Table (N + 4).Flag15;
+      end Flag233;
 
-      function Flag195 (N : Node_Id) return Boolean is
+      function Flag234 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag195;
-      end Flag195;
+         return Nodes.Table (N + 4).Flag16;
+      end Flag234;
 
-      function Flag196 (N : Node_Id) return Boolean is
+      function Flag235 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag196;
-      end Flag196;
+         return Nodes.Table (N + 4).Flag17;
+      end Flag235;
 
-      function Flag197 (N : Node_Id) return Boolean is
+      function Flag236 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag197;
-      end Flag197;
+         return Nodes.Table (N + 4).Flag18;
+      end Flag236;
 
-      function Flag198 (N : Node_Id) return Boolean is
+      function Flag237 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag198;
-      end Flag198;
+         return Nodes.Table (N + 4).Pflag1;
+      end Flag237;
 
-      function Flag199 (N : Node_Id) return Boolean is
+      function Flag238 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag199;
-      end Flag199;
+         return Nodes.Table (N + 4).Pflag2;
+      end Flag238;
 
-      function Flag200 (N : Node_Id) return Boolean is
+      function Flag239 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag200;
-      end Flag200;
+         return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag239;
+      end Flag239;
 
-      function Flag201 (N : Node_Id) return Boolean is
+      function Flag240 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag201;
-      end Flag201;
+         return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag240;
+      end Flag240;
 
-      function Flag202 (N : Node_Id) return Boolean is
+      function Flag241 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag202;
-      end Flag202;
+         return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag241;
+      end Flag241;
 
-      function Flag203 (N : Node_Id) return Boolean is
+      function Flag242 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag203;
-      end Flag203;
+         return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag242;
+      end Flag242;
 
-      function Flag204 (N : Node_Id) return Boolean is
+      function Flag243 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag204;
-      end Flag204;
+         return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag243;
+      end Flag243;
 
-      function Flag205 (N : Node_Id) return Boolean is
+      function Flag244 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag205;
-      end Flag205;
+         return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag244;
+      end Flag244;
 
-      function Flag206 (N : Node_Id) return Boolean is
+      function Flag245 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag206;
-      end Flag206;
+         return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag245;
+      end Flag245;
 
-      function Flag207 (N : Node_Id) return Boolean is
+      function Flag246 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag207;
-      end Flag207;
+         return To_Flag_Byte2 (Nodes.Table (N + 3).Nkind).Flag246;
+      end Flag246;
 
-      function Flag208 (N : Node_Id) return Boolean is
+      function Flag247 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag208;
-      end Flag208;
+         return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag247;
+      end Flag247;
 
-      function Flag209 (N : Node_Id) return Boolean is
+      function Flag248 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag209;
-      end Flag209;
+         return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag248;
+      end Flag248;
 
-      function Flag210 (N : Node_Id) return Boolean is
+      function Flag249 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag210;
-      end Flag210;
+         return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag249;
+      end Flag249;
 
-      function Flag211 (N : Node_Id) return Boolean is
+      function Flag250 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag211;
-      end Flag211;
+         return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag250;
+      end Flag250;
 
-      function Flag212 (N : Node_Id) return Boolean is
+      function Flag251 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag212;
-      end Flag212;
+         return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag251;
+      end Flag251;
 
-      function Flag213 (N : Node_Id) return Boolean is
+      function Flag252 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag213;
-      end Flag213;
+         return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag252;
+      end Flag252;
 
-      function Flag214 (N : Node_Id) return Boolean is
+      function Flag253 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag214;
-      end Flag214;
+         return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag253;
+      end Flag253;
 
-      function Flag215 (N : Node_Id) return Boolean is
+      function Flag254 (N : Node_Id) return Boolean is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         return To_Flag_Word4 (Nodes.Table (N + 4).Field11).Flag215;
-      end Flag215;
+         return To_Flag_Byte3 (Nodes.Table (N + 4).Nkind).Flag254;
+      end Flag254;
 
       procedure Set_Nkind (N : Node_Id; Val : Node_Kind) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Nkind := Val;
       end Set_Nkind;
 
       procedure Set_Field1 (N : Node_Id; Val : Union_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field1 := Val;
       end Set_Field1;
 
       procedure Set_Field2 (N : Node_Id; Val : Union_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field2 := Val;
       end Set_Field2;
 
       procedure Set_Field3 (N : Node_Id; Val : Union_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field3 := Val;
       end Set_Field3;
 
       procedure Set_Field4 (N : Node_Id; Val : Union_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field4 := Val;
       end Set_Field4;
 
       procedure Set_Field5 (N : Node_Id; Val : Union_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field5 := Val;
       end Set_Field5;
 
@@ -4665,33 +4493,39 @@ package body Atree is
          Nodes.Table (N + 4).Field10 := Val;
       end Set_Field28;
 
+      procedure Set_Field29 (N : Node_Id; Val : Union_Id) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Field11 := Val;
+      end Set_Field29;
+
       procedure Set_Node1 (N : Node_Id; Val : Node_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field1 := Union_Id (Val);
       end Set_Node1;
 
       procedure Set_Node2 (N : Node_Id; Val : Node_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field2 := Union_Id (Val);
       end Set_Node2;
 
       procedure Set_Node3 (N : Node_Id; Val : Node_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field3 := Union_Id (Val);
       end Set_Node3;
 
       procedure Set_Node4 (N : Node_Id; Val : Node_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field4 := Union_Id (Val);
       end Set_Node4;
 
       procedure Set_Node5 (N : Node_Id; Val : Node_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field5 := Union_Id (Val);
       end Set_Node5;
 
@@ -4833,33 +4667,39 @@ package body Atree is
          Nodes.Table (N + 4).Field10 := Union_Id (Val);
       end Set_Node28;
 
+      procedure Set_Node29 (N : Node_Id; Val : Node_Id) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Field11 := Union_Id (Val);
+      end Set_Node29;
+
       procedure Set_List1 (N : Node_Id; Val : List_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field1 := Union_Id (Val);
       end Set_List1;
 
       procedure Set_List2 (N : Node_Id; Val : List_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field2 := Union_Id (Val);
       end Set_List2;
 
       procedure Set_List3 (N : Node_Id; Val : List_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field3 := Union_Id (Val);
       end Set_List3;
 
       procedure Set_List4 (N : Node_Id; Val : List_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field4 := Union_Id (Val);
       end Set_List4;
 
       procedure Set_List5 (N : Node_Id; Val : List_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field5 := Union_Id (Val);
       end Set_List5;
 
@@ -4875,6 +4715,17 @@ package body Atree is
          Nodes.Table (N + 2).Field7 := Union_Id (Val);
       end Set_List14;
 
+      procedure Set_List25 (N : Node_Id; Val : List_Id) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Field7 := Union_Id (Val);
+      end Set_List25;
+
+      procedure Set_Elist1 (N : Node_Id; Val : Elist_Id) is
+      begin
+         Nodes.Table (N).Field1 := Union_Id (Val);
+      end Set_Elist1;
+
       procedure Set_Elist2 (N : Node_Id; Val : Elist_Id) is
       begin
          Nodes.Table (N).Field2 := Union_Id (Val);
@@ -4890,12 +4741,23 @@ package body Atree is
          Nodes.Table (N).Field4 := Union_Id (Val);
       end Set_Elist4;
 
+      procedure Set_Elist5 (N : Node_Id; Val : Elist_Id) is
+      begin
+         Nodes.Table (N).Field5 := Union_Id (Val);
+      end Set_Elist5;
+
       procedure Set_Elist8 (N : Node_Id; Val : Elist_Id) is
       begin
          pragma Assert (Nkind (N) in N_Entity);
          Nodes.Table (N + 1).Field8 := Union_Id (Val);
       end Set_Elist8;
 
+      procedure Set_Elist10 (N : Node_Id; Val : Elist_Id) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 1).Field10 := Union_Id (Val);
+      end Set_Elist10;
+
       procedure Set_Elist13 (N : Node_Id; Val : Elist_Id) is
       begin
          pragma Assert (Nkind (N) in N_Entity);
@@ -4932,51 +4794,63 @@ package body Atree is
          Nodes.Table (N + 3).Field10 := Union_Id (Val);
       end Set_Elist23;
 
+      procedure Set_Elist24 (N : Node_Id; Val : Elist_Id) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Field6 := Union_Id (Val);
+      end Set_Elist24;
+
       procedure Set_Elist25 (N : Node_Id; Val : Elist_Id) is
       begin
          pragma Assert (Nkind (N) in N_Entity);
          Nodes.Table (N + 4).Field7 := Union_Id (Val);
       end Set_Elist25;
 
+      procedure Set_Elist26 (N : Node_Id; Val : Elist_Id) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Field8 := Union_Id (Val);
+      end Set_Elist26;
+
       procedure Set_Name1 (N : Node_Id; Val : Name_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field1 := Union_Id (Val);
       end Set_Name1;
 
       procedure Set_Name2 (N : Node_Id; Val : Name_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field2 := Union_Id (Val);
       end Set_Name2;
 
       procedure Set_Str3 (N : Node_Id; Val : String_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field3 := Union_Id (Val);
       end Set_Str3;
 
       procedure Set_Uint2 (N : Node_Id; Val : Uint) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field2 := To_Union (Val);
       end Set_Uint2;
 
       procedure Set_Uint3 (N : Node_Id; Val : Uint) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field3 := To_Union (Val);
       end Set_Uint3;
 
       procedure Set_Uint4 (N : Node_Id; Val : Uint) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field4 := To_Union (Val);
       end Set_Uint4;
 
       procedure Set_Uint5 (N : Node_Id; Val : Uint) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field5 := To_Union (Val);
       end Set_Uint5;
 
@@ -5048,7 +4922,7 @@ package body Atree is
 
       procedure Set_Ureal3 (N : Node_Id; Val : Ureal) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Field3 := To_Union (Val);
       end Set_Ureal3;
 
@@ -5066,91 +4940,91 @@ package body Atree is
 
       procedure Set_Flag4 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag4 := Val;
       end Set_Flag4;
 
       procedure Set_Flag5 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag5 := Val;
       end Set_Flag5;
 
       procedure Set_Flag6 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag6 := Val;
       end Set_Flag6;
 
       procedure Set_Flag7 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag7 := Val;
       end Set_Flag7;
 
       procedure Set_Flag8 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag8 := Val;
       end Set_Flag8;
 
       procedure Set_Flag9 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag9 := Val;
       end Set_Flag9;
 
       procedure Set_Flag10 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag10 := Val;
       end Set_Flag10;
 
       procedure Set_Flag11 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag11 := Val;
       end Set_Flag11;
 
       procedure Set_Flag12 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag12 := Val;
       end Set_Flag12;
 
       procedure Set_Flag13 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag13 := Val;
       end Set_Flag13;
 
       procedure Set_Flag14 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag14 := Val;
       end Set_Flag14;
 
       procedure Set_Flag15 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag15 := Val;
       end Set_Flag15;
 
       procedure Set_Flag16 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag16 := Val;
       end Set_Flag16;
 
       procedure Set_Flag17 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag17 := Val;
       end Set_Flag17;
 
       procedure Set_Flag18 (N : Node_Id; Val : Boolean) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          Nodes.Table (N).Flag18 := Val;
       end Set_Flag18;
 
@@ -5163,7 +5037,7 @@ package body Atree is
       procedure Set_Flag20 (N : Node_Id; Val : Boolean) is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         Nodes.Table (N + 1).Unused_1 := Val;
+         Nodes.Table (N + 1).Has_Aspects := Val;
       end Set_Flag20;
 
       procedure Set_Flag21 (N : Node_Id; Val : Boolean) is
@@ -5289,7 +5163,7 @@ package body Atree is
       procedure Set_Flag41 (N : Node_Id; Val : Boolean) is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         Nodes.Table (N + 2).Unused_1 := Val;
+         Nodes.Table (N + 2).Has_Aspects := Val;
       end Set_Flag41;
 
       procedure Set_Flag42 (N : Node_Id; Val : Boolean) is
@@ -5951,7 +5825,7 @@ package body Atree is
       procedure Set_Flag130 (N : Node_Id; Val : Boolean) is
       begin
          pragma Assert (Nkind (N) in N_Entity);
-         Nodes.Table (N + 3).Unused_1 := Val;
+         Nodes.Table (N + 3).Has_Aspects := Val;
       end Set_Flag130;
 
       procedure Set_Flag131 (N : Node_Id; Val : Boolean) is
@@ -6341,7 +6215,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag184 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag184 := Val;
       end Set_Flag184;
 
       procedure Set_Flag185 (N : Node_Id; Val : Boolean) is
@@ -6349,7 +6223,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag185 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag185 := Val;
       end Set_Flag185;
 
       procedure Set_Flag186 (N : Node_Id; Val : Boolean) is
@@ -6357,7 +6231,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag186 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag186 := Val;
       end Set_Flag186;
 
       procedure Set_Flag187 (N : Node_Id; Val : Boolean) is
@@ -6365,7 +6239,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag187 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag187 := Val;
       end Set_Flag187;
 
       procedure Set_Flag188 (N : Node_Id; Val : Boolean) is
@@ -6373,7 +6247,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag188 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag188 := Val;
       end Set_Flag188;
 
       procedure Set_Flag189 (N : Node_Id; Val : Boolean) is
@@ -6381,7 +6255,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag189 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag189 := Val;
       end Set_Flag189;
 
       procedure Set_Flag190 (N : Node_Id; Val : Boolean) is
@@ -6389,7 +6263,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag190 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag190 := Val;
       end Set_Flag190;
 
       procedure Set_Flag191 (N : Node_Id; Val : Boolean) is
@@ -6397,7 +6271,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag191 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag191 := Val;
       end Set_Flag191;
 
       procedure Set_Flag192 (N : Node_Id; Val : Boolean) is
@@ -6405,7 +6279,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag192 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag192 := Val;
       end Set_Flag192;
 
       procedure Set_Flag193 (N : Node_Id; Val : Boolean) is
@@ -6413,7 +6287,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag193 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag193 := Val;
       end Set_Flag193;
 
       procedure Set_Flag194 (N : Node_Id; Val : Boolean) is
@@ -6421,7 +6295,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag194 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag194 := Val;
       end Set_Flag194;
 
       procedure Set_Flag195 (N : Node_Id; Val : Boolean) is
@@ -6429,7 +6303,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag195 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag195 := Val;
       end Set_Flag195;
 
       procedure Set_Flag196 (N : Node_Id; Val : Boolean) is
@@ -6437,7 +6311,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag196 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag196 := Val;
       end Set_Flag196;
 
       procedure Set_Flag197 (N : Node_Id; Val : Boolean) is
@@ -6445,7 +6319,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag197 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag197 := Val;
       end Set_Flag197;
 
       procedure Set_Flag198 (N : Node_Id; Val : Boolean) is
@@ -6453,7 +6327,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag198 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag198 := Val;
       end Set_Flag198;
 
       procedure Set_Flag199 (N : Node_Id; Val : Boolean) is
@@ -6461,7 +6335,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag199 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag199 := Val;
       end Set_Flag199;
 
       procedure Set_Flag200 (N : Node_Id; Val : Boolean) is
@@ -6469,7 +6343,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag200 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag200 := Val;
       end Set_Flag200;
 
       procedure Set_Flag201 (N : Node_Id; Val : Boolean) is
@@ -6477,7 +6351,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag201 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag201 := Val;
       end Set_Flag201;
 
       procedure Set_Flag202 (N : Node_Id; Val : Boolean) is
@@ -6485,7 +6359,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag202 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag202 := Val;
       end Set_Flag202;
 
       procedure Set_Flag203 (N : Node_Id; Val : Boolean) is
@@ -6493,7 +6367,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag203 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag203 := Val;
       end Set_Flag203;
 
       procedure Set_Flag204 (N : Node_Id; Val : Boolean) is
@@ -6501,7 +6375,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag204 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag204 := Val;
       end Set_Flag204;
 
       procedure Set_Flag205 (N : Node_Id; Val : Boolean) is
@@ -6509,7 +6383,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag205 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag205 := Val;
       end Set_Flag205;
 
       procedure Set_Flag206 (N : Node_Id; Val : Boolean) is
@@ -6517,7 +6391,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag206 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag206 := Val;
       end Set_Flag206;
 
       procedure Set_Flag207 (N : Node_Id; Val : Boolean) is
@@ -6525,7 +6399,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag207 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag207 := Val;
       end Set_Flag207;
 
       procedure Set_Flag208 (N : Node_Id; Val : Boolean) is
@@ -6533,7 +6407,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag208 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag208 := Val;
       end Set_Flag208;
 
       procedure Set_Flag209 (N : Node_Id; Val : Boolean) is
@@ -6541,7 +6415,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag209 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag209 := Val;
       end Set_Flag209;
 
       procedure Set_Flag210 (N : Node_Id; Val : Boolean) is
@@ -6549,7 +6423,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag210 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag210 := Val;
       end Set_Flag210;
 
       procedure Set_Flag211 (N : Node_Id; Val : Boolean) is
@@ -6557,7 +6431,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag211 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag211 := Val;
       end Set_Flag211;
 
       procedure Set_Flag212 (N : Node_Id; Val : Boolean) is
@@ -6565,7 +6439,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag212 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag212 := Val;
       end Set_Flag212;
 
       procedure Set_Flag213 (N : Node_Id; Val : Boolean) is
@@ -6573,7 +6447,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag213 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag213 := Val;
       end Set_Flag213;
 
       procedure Set_Flag214 (N : Node_Id; Val : Boolean) is
@@ -6581,7 +6455,7 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag214 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag214 := Val;
       end Set_Flag214;
 
       procedure Set_Flag215 (N : Node_Id; Val : Boolean) is
@@ -6589,47 +6463,333 @@ package body Atree is
          pragma Assert (Nkind (N) in N_Entity);
          To_Flag_Word4_Ptr
            (Union_Id_Ptr'
-             (Nodes.Table (N + 4).Field11'Unrestricted_Access)).Flag215 := Val;
+             (Nodes.Table (N + 4).Field12'Unrestricted_Access)).Flag215 := Val;
       end Set_Flag215;
 
+      procedure Set_Flag216 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).In_List := Val;
+      end Set_Flag216;
+
+      procedure Set_Flag217 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Has_Aspects := Val;
+      end Set_Flag217;
+
+      procedure Set_Flag218 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Rewrite_Ins := Val;
+      end Set_Flag218;
+
+      procedure Set_Flag219 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Analyzed := Val;
+      end Set_Flag219;
+
+      procedure Set_Flag220 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Comes_From_Source := Val;
+      end Set_Flag220;
+
+      procedure Set_Flag221 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Error_Posted := Val;
+      end Set_Flag221;
+
+      procedure Set_Flag222 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag4 := Val;
+      end Set_Flag222;
+
+      procedure Set_Flag223 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag5 := Val;
+      end Set_Flag223;
+
+      procedure Set_Flag224 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag6 := Val;
+      end Set_Flag224;
+
+      procedure Set_Flag225 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag7 := Val;
+      end Set_Flag225;
+
+      procedure Set_Flag226 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag8 := Val;
+      end Set_Flag226;
+
+      procedure Set_Flag227 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag9 := Val;
+      end Set_Flag227;
+
+      procedure Set_Flag228 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag10 := Val;
+      end Set_Flag228;
+
+      procedure Set_Flag229 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag11 := Val;
+      end Set_Flag229;
+
+      procedure Set_Flag230 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag12 := Val;
+      end Set_Flag230;
+
+      procedure Set_Flag231 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag13 := Val;
+      end Set_Flag231;
+
+      procedure Set_Flag232 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag14 := Val;
+      end Set_Flag232;
+
+      procedure Set_Flag233 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag15 := Val;
+      end Set_Flag233;
+
+      procedure Set_Flag234 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag16 := Val;
+      end Set_Flag234;
+
+      procedure Set_Flag235 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag17 := Val;
+      end Set_Flag235;
+
+      procedure Set_Flag236 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Flag18 := Val;
+      end Set_Flag236;
+
+      procedure Set_Flag237 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Pflag1 := Val;
+      end Set_Flag237;
+
+      procedure Set_Flag238 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         Nodes.Table (N + 4).Pflag2 := Val;
+      end Set_Flag238;
+
+      procedure Set_Flag239 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte2_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag239 := Val;
+      end Set_Flag239;
+
+      procedure Set_Flag240 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte2_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag240 := Val;
+      end Set_Flag240;
+
+      procedure Set_Flag241 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte2_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag241 := Val;
+      end Set_Flag241;
+
+      procedure Set_Flag242 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte2_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag242 := Val;
+      end Set_Flag242;
+
+      procedure Set_Flag243 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte2_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag243 := Val;
+      end Set_Flag243;
+
+      procedure Set_Flag244 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte2_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag244 := Val;
+      end Set_Flag244;
+
+      procedure Set_Flag245 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte2_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag245 := Val;
+      end Set_Flag245;
+
+      procedure Set_Flag246 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte2_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 3).Nkind'Unrestricted_Access)).Flag246 := Val;
+      end Set_Flag246;
+
+      procedure Set_Flag247 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte3_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag247 := Val;
+      end Set_Flag247;
+
+      procedure Set_Flag248 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte3_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag248 := Val;
+      end Set_Flag248;
+
+      procedure Set_Flag249 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte3_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag249 := Val;
+      end Set_Flag249;
+
+      procedure Set_Flag250 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte3_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag250 := Val;
+      end Set_Flag250;
+
+      procedure Set_Flag251 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte3_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag251 := Val;
+      end Set_Flag251;
+
+      procedure Set_Flag252 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte3_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag252 := Val;
+      end Set_Flag252;
+
+      procedure Set_Flag253 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte3_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag253 := Val;
+      end Set_Flag253;
+
+      procedure Set_Flag254 (N : Node_Id; Val : Boolean) is
+      begin
+         pragma Assert (Nkind (N) in N_Entity);
+         To_Flag_Byte3_Ptr
+           (Node_Kind_Ptr'
+             (Nodes.Table (N + 4).Nkind'Unrestricted_Access)).Flag254 := Val;
+      end Set_Flag254;
+
       procedure Set_Node1_With_Parent (N : Node_Id; Val : Node_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
-         if Val > Error then Set_Parent (Val, N); end if;
+         pragma Assert (N <= Nodes.Last);
+
+         if Val > Error then
+            Set_Parent (N => Val, Val => N);
+         end if;
+
          Set_Node1 (N, Val);
       end Set_Node1_With_Parent;
 
       procedure Set_Node2_With_Parent (N : Node_Id; Val : Node_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
-         if Val > Error then Set_Parent (Val, N); end if;
+         pragma Assert (N <= Nodes.Last);
+
+         if Val > Error then
+            Set_Parent (N => Val, Val => N);
+         end if;
+
          Set_Node2 (N, Val);
       end Set_Node2_With_Parent;
 
       procedure Set_Node3_With_Parent (N : Node_Id; Val : Node_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
-         if Val > Error then Set_Parent (Val, N); end if;
+         pragma Assert (N <= Nodes.Last);
+
+         if Val > Error then
+            Set_Parent (N => Val, Val => N);
+         end if;
+
          Set_Node3 (N, Val);
       end Set_Node3_With_Parent;
 
       procedure Set_Node4_With_Parent (N : Node_Id; Val : Node_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
-         if Val > Error then Set_Parent (Val, N); end if;
+         pragma Assert (N <= Nodes.Last);
+
+         if Val > Error then
+            Set_Parent (N => Val, Val => N);
+         end if;
+
          Set_Node4 (N, Val);
       end Set_Node4_With_Parent;
 
       procedure Set_Node5_With_Parent (N : Node_Id; Val : Node_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
-         if Val > Error then Set_Parent (Val, N); end if;
+         pragma Assert (N <= Nodes.Last);
+
+         if Val > Error then
+            Set_Parent (N => Val, Val => N);
+         end if;
+
          Set_Node5 (N, Val);
       end Set_Node5_With_Parent;
 
       procedure Set_List1_With_Parent (N : Node_Id; Val : List_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          if Val /= No_List and then Val /= Error_List then
             Set_Parent (Val, N);
          end if;
@@ -6638,7 +6798,7 @@ package body Atree is
 
       procedure Set_List2_With_Parent (N : Node_Id; Val : List_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          if Val /= No_List and then Val /= Error_List then
             Set_Parent (Val, N);
          end if;
@@ -6647,7 +6807,7 @@ package body Atree is
 
       procedure Set_List3_With_Parent (N : Node_Id; Val : List_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          if Val /= No_List and then Val /= Error_List then
             Set_Parent (Val, N);
          end if;
@@ -6656,7 +6816,7 @@ package body Atree is
 
       procedure Set_List4_With_Parent (N : Node_Id; Val : List_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          if Val /= No_List and then Val /= Error_List then
             Set_Parent (Val, N);
          end if;
@@ -6665,7 +6825,7 @@ package body Atree is
 
       procedure Set_List5_With_Parent (N : Node_Id; Val : List_Id) is
       begin
-         pragma Assert (N in Nodes.First .. Nodes.Last);
+         pragma Assert (N <= Nodes.Last);
          if Val /= No_List and then Val /= Error_List then
             Set_Parent (Val, N);
          end if;
@@ -6674,4 +6834,14 @@ package body Atree is
 
    end Unchecked_Access;
 
+   ------------
+   -- Unlock --
+   ------------
+
+   procedure Unlock is
+   begin
+      Nodes.Locked := False;
+      Orig_Nodes.Locked := False;
+   end Unlock;
+
 end Atree;