]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Clean up Uint fields, remove unused routines
authorBob Duff <duff@adacore.com>
Sun, 27 Jun 2021 15:03:20 +0000 (11:03 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 20 Sep 2021 12:31:35 +0000 (12:31 +0000)
gcc/ada/

* einfo-utils.ads, einfo-utils.adb, fe.h, einfo.ads,
gen_il-fields.ads: Remove unused and no-longer-used routines.
Move related routines together.  Rewrite incorrect
documentation, and documentation that will be incorrect when
e.g. Esize-related routines are fixed.  Remove unused field
Normalized_Position_Max.
* cstand.adb, exp_pakd.adb, freeze.adb,
gen_il-gen-gen_entities.adb, itypes.adb, layout.adb,
sem_ch10.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb,
sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_prag.adb,
sem_util.adb, ttypes.ads: Update calls to routines removed from
or renamed in Einfo.Utils.
* uintp.ads (Upos): Fix this subtype, which was unintentionally
declared to include Uint_0.

22 files changed:
gcc/ada/cstand.adb
gcc/ada/einfo-utils.adb
gcc/ada/einfo-utils.ads
gcc/ada/einfo.ads
gcc/ada/exp_pakd.adb
gcc/ada/fe.h
gcc/ada/freeze.adb
gcc/ada/gen_il-fields.ads
gcc/ada/gen_il-gen-gen_entities.adb
gcc/ada/itypes.adb
gcc/ada/layout.adb
gcc/ada/sem_ch10.adb
gcc/ada/sem_ch12.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch7.adb
gcc/ada/sem_ch8.adb
gcc/ada/sem_ch9.adb
gcc/ada/sem_prag.adb
gcc/ada/sem_util.adb
gcc/ada/ttypes.ads
gcc/ada/uintp.ads

index 44cb69c8ccaf3b8c74d0a4e8f15e2d628ba6b7cf..e65751acce89c9b40bbb88e6caaba8bac92f430d 100644 (file)
@@ -205,7 +205,7 @@ package body CStand is
 
       Mutate_Ekind                   (E, E_Floating_Point_Type);
       Set_Etype                      (E, E);
-      Init_Digits_Value              (E, Digs);
+      Set_Digits_Value               (E, UI_From_Int (Digs));
       Set_Float_Rep                  (E, Rep);
       Init_Size                      (E, Siz);
       Set_Elem_Alignment             (E, Align);
@@ -578,6 +578,8 @@ package body CStand is
          Set_Has_Pragma_Pack (String_Type, True);
       end Pack_String_Type;
 
+      Char_Size : constant Unat := UI_From_Int (Standard_Character_Size);
+
    --  Start of processing for Create_Standard
 
    begin
@@ -652,8 +654,8 @@ package body CStand is
       Mutate_Ekind       (Standard_Boolean, E_Enumeration_Type);
       Set_First_Literal  (Standard_Boolean, Standard_False);
       Set_Etype          (Standard_Boolean, Standard_Boolean);
-      Init_Esize         (Standard_Boolean, Standard_Character_Size);
-      Init_RM_Size       (Standard_Boolean, 1);
+      Set_Esize          (Standard_Boolean, Char_Size);
+      Set_RM_Size        (Standard_Boolean, Uint_1);
       Set_Elem_Alignment (Standard_Boolean);
 
       Set_Is_Unsigned_Type           (Standard_Boolean);
@@ -757,8 +759,8 @@ package body CStand is
 
       Mutate_Ekind       (Standard_Character, E_Enumeration_Type);
       Set_Etype          (Standard_Character, Standard_Character);
-      Init_Esize         (Standard_Character, Standard_Character_Size);
-      Init_RM_Size       (Standard_Character, 8);
+      Set_Esize          (Standard_Character, Char_Size);
+      Set_RM_Size        (Standard_Character, Uint_8);
       Set_Elem_Alignment (Standard_Character);
 
       Set_Has_Pragma_Ordered         (Standard_Character);
@@ -912,7 +914,7 @@ package body CStand is
       Set_Etype           (Standard_String, Standard_String);
       Set_Component_Type  (Standard_String, Standard_Character);
       Set_Component_Size  (Standard_String, Uint_8);
-      Init_Size_Align     (Standard_String);
+      Reinit_Size_Align   (Standard_String);
       Set_Alignment       (Standard_String, Uint_1);
       Pack_String_Type    (Standard_String);
 
@@ -956,7 +958,7 @@ package body CStand is
       Set_Etype           (Standard_Wide_String, Standard_Wide_String);
       Set_Component_Type  (Standard_Wide_String, Standard_Wide_Character);
       Set_Component_Size  (Standard_Wide_String, Uint_16);
-      Init_Size_Align     (Standard_Wide_String);
+      Reinit_Size_Align   (Standard_Wide_String);
       Pack_String_Type    (Standard_Wide_String);
 
       --  Set index type of Wide_String
@@ -993,7 +995,7 @@ package body CStand is
       Set_Component_Type   (Standard_Wide_Wide_String,
                             Standard_Wide_Wide_Character);
       Set_Component_Size   (Standard_Wide_Wide_String, Uint_32);
-      Init_Size_Align      (Standard_Wide_Wide_String);
+      Reinit_Size_Align    (Standard_Wide_Wide_String);
       Set_Is_Ada_2005_Only (Standard_Wide_Wide_String);
       Pack_String_Type     (Standard_Wide_Wide_String);
 
@@ -1009,10 +1011,10 @@ package body CStand is
 
       --  Setup entity for Natural
 
-      Mutate_Ekind       (Standard_Natural, E_Signed_Integer_Subtype);
-      Set_Etype          (Standard_Natural, Base_Type (Standard_Integer));
-      Init_Esize         (Standard_Natural, Standard_Integer_Size);
-      Init_RM_Size       (Standard_Natural, Standard_Integer_Size - 1);
+      Mutate_Ekind (Standard_Natural, E_Signed_Integer_Subtype);
+      Set_Etype (Standard_Natural, Base_Type (Standard_Integer));
+      Set_Esize (Standard_Natural, UI_From_Int (Standard_Integer_Size));
+      Set_RM_Size  (Standard_Natural, UI_From_Int (Standard_Integer_Size - 1));
       Set_Elem_Alignment (Standard_Natural);
       Set_Size_Known_At_Compile_Time
                          (Standard_Natural);
@@ -1024,10 +1026,11 @@ package body CStand is
 
       --  Setup entity for Positive
 
-      Mutate_Ekind       (Standard_Positive, E_Signed_Integer_Subtype);
-      Set_Etype          (Standard_Positive, Base_Type (Standard_Integer));
-      Init_Esize         (Standard_Positive, Standard_Integer_Size);
-      Init_RM_Size       (Standard_Positive, Standard_Integer_Size - 1);
+      Mutate_Ekind (Standard_Positive, E_Signed_Integer_Subtype);
+      Set_Etype (Standard_Positive, Base_Type (Standard_Integer));
+      Set_Esize  (Standard_Positive, UI_From_Int (Standard_Integer_Size));
+      Set_RM_Size
+        (Standard_Positive, UI_From_Int (Standard_Integer_Size - 1));
       Set_Elem_Alignment (Standard_Positive);
 
       Set_Size_Known_At_Compile_Time (Standard_Positive);
@@ -1132,7 +1135,7 @@ package body CStand is
          Init_Size   (Standard_A_String, System_Address_Size * 2);
       end if;
 
-      Init_Alignment (Standard_A_String);
+      pragma Assert (not Known_Alignment (Standard_A_String));
 
       Set_Directly_Designated_Type
                      (Standard_A_String, Standard_String);
@@ -1156,14 +1159,16 @@ package body CStand is
       Mutate_Ekind (Standard_Debug_Renaming_Type, E_Signed_Integer_Subtype);
       Set_Scope (Standard_Debug_Renaming_Type, Standard_Standard);
       Set_Etype (Standard_Debug_Renaming_Type, Base_Type (Standard_Integer));
-      Init_Esize          (Standard_Debug_Renaming_Type, 0);
-      Init_RM_Size        (Standard_Debug_Renaming_Type, 0);
+      pragma Assert
+        (Field_Is_Initial_Zero (Standard_Debug_Renaming_Type, F_Esize));
+      pragma Assert
+        (Field_Is_Initial_Zero (Standard_Debug_Renaming_Type, F_RM_Size));
       Set_Size_Known_At_Compile_Time (Standard_Debug_Renaming_Type);
-      Set_Integer_Bounds  (Standard_Debug_Renaming_Type,
-        Typ => Base_Type  (Standard_Debug_Renaming_Type),
+      Set_Integer_Bounds (Standard_Debug_Renaming_Type,
+        Typ => Base_Type (Standard_Debug_Renaming_Type),
         Lb  => Uint_1,
         Hb  => Uint_0);
-      Set_Is_Constrained  (Standard_Debug_Renaming_Type);
+      Set_Is_Constrained (Standard_Debug_Renaming_Type);
       Set_Has_Size_Clause (Standard_Debug_Renaming_Type);
 
       --  Note on type names. The type names for the following special types
@@ -1186,8 +1191,8 @@ package body CStand is
       Mutate_Ekind          (Any_Id, E_Variable);
       Set_Scope             (Any_Id, Standard_Standard);
       Set_Etype             (Any_Id, Any_Type);
-      Init_Esize            (Any_Id);
-      Init_Alignment        (Any_Id);
+      pragma Assert (not Known_Esize (Any_Id));
+      pragma Assert (not Known_Alignment (Any_Id));
 
       Any_Access := New_Standard_Entity ("an access type");
       Mutate_Ekind          (Any_Access, E_Access_Type);
@@ -1204,8 +1209,8 @@ package body CStand is
       Set_Etype             (Any_Character, Any_Character);
       Set_Is_Unsigned_Type  (Any_Character);
       Set_Is_Character_Type (Any_Character);
-      Init_Esize            (Any_Character, Standard_Character_Size);
-      Init_RM_Size          (Any_Character, 8);
+      Set_Esize             (Any_Character, Char_Size);
+      Set_RM_Size           (Any_Character, Uint_8);
       Set_Elem_Alignment    (Any_Character);
       Set_Scalar_Range      (Any_Character, Scalar_Range (Standard_Character));
 
@@ -1214,15 +1219,15 @@ package body CStand is
       Set_Scope             (Any_Array, Standard_Standard);
       Set_Etype             (Any_Array, Any_Array);
       Set_Component_Type    (Any_Array, Any_Character);
-      Init_Size_Align       (Any_Array);
+      Reinit_Size_Align     (Any_Array);
       Make_Dummy_Index      (Any_Array);
 
       Any_Boolean := New_Standard_Entity ("a boolean type");
       Mutate_Ekind          (Any_Boolean, E_Enumeration_Type);
       Set_Scope             (Any_Boolean, Standard_Standard);
       Set_Etype             (Any_Boolean, Standard_Boolean);
-      Init_Esize            (Any_Boolean, Standard_Character_Size);
-      Init_RM_Size          (Any_Boolean, 1);
+      Set_Esize             (Any_Boolean, Char_Size);
+      Set_RM_Size           (Any_Boolean, Uint_1);
       Set_Elem_Alignment    (Any_Boolean);
       Set_Is_Unsigned_Type  (Any_Boolean);
       Set_Scalar_Range      (Any_Boolean, Scalar_Range (Standard_Boolean));
@@ -1233,7 +1238,7 @@ package body CStand is
       Set_Etype             (Any_Composite, Any_Composite);
       Set_Component_Size    (Any_Composite, Uint_0);
       Set_Component_Type    (Any_Composite, Standard_Integer);
-      Init_Size_Align       (Any_Composite);
+      Reinit_Size_Align     (Any_Composite);
 
       Any_Discrete := New_Standard_Entity ("a discrete type");
       Mutate_Ekind          (Any_Discrete, E_Signed_Integer_Type);
@@ -1297,7 +1302,7 @@ package body CStand is
       Set_Scope             (Any_String, Standard_Standard);
       Set_Etype             (Any_String, Any_String);
       Set_Component_Type    (Any_String, Any_Character);
-      Init_Size_Align       (Any_String);
+      Reinit_Size_Align     (Any_String);
       Make_Dummy_Index      (Any_String);
 
       Raise_Type := New_Standard_Entity ("raise type");
@@ -1506,7 +1511,7 @@ package body CStand is
          Set_Scope       (Standard_Exception_Type, Standard_Standard);
          Set_Stored_Constraint
                          (Standard_Exception_Type, No_Elist);
-         Init_Size_Align (Standard_Exception_Type);
+         Reinit_Size_Align (Standard_Exception_Type);
          Set_Size_Known_At_Compile_Time
                          (Standard_Exception_Type, True);
 
@@ -1726,7 +1731,7 @@ package body CStand is
       Mutate_Ekind                  (Id, E_Component);
       Set_Etype                     (Id, Typ);
       Set_Scope                     (Id, Rec);
-      Init_Component_Location       (Id);
+      Reinit_Component_Location     (Id);
       Set_Original_Record_Component (Id, Id);
       Set_Is_Aliased                (Id);
       Set_Is_Independent            (Id);
index 4690c8f349033905cfa1dcd986ebfa5a922af61c..5782bd602c9da11a46e8f6d9d68e31b62b99fc53 100644 (file)
@@ -358,131 +358,143 @@ package body Einfo.Utils is
       return Ekind (Id) in Type_Kind;
    end Is_Type;
 
-   -----------------------------------
-   -- Field Initialization Routines --
-   -----------------------------------
+   ------------------------------------------
+   -- Type Representation Attribute Fields --
+   ------------------------------------------
 
-   procedure Init_Alignment (Id : E) is
+   function Known_Alignment                       (E : Entity_Id) return B is
+      Result : constant B := not Field_Is_Initial_Zero (E, F_Alignment);
+   begin
+      return Result;
+   end Known_Alignment;
+
+   procedure Reinit_Alignment (Id : E) is
    begin
       Reinit_Field_To_Zero (Id, F_Alignment);
-   end Init_Alignment;
+   end Reinit_Alignment;
 
-   procedure Init_Alignment (Id : E; V : Int) is
+   procedure Copy_Alignment (To, From : E) is
    begin
-      Set_Alignment (Id, UI_From_Int (V));
-   end Init_Alignment;
+      if Known_Alignment (From) then
+         Set_Alignment (To, Alignment (From));
+      else
+         Reinit_Alignment (To);
+      end if;
+   end Copy_Alignment;
 
-   procedure Init_Component_Bit_Offset (Id : E) is
+   function Known_Component_Bit_Offset            (E : Entity_Id) return B is
    begin
-      Set_Component_Bit_Offset (Id, No_Uint);
-   end Init_Component_Bit_Offset;
+      return Component_Bit_Offset (E) /= No_Uint;
+   end Known_Component_Bit_Offset;
 
-   procedure Init_Component_Bit_Offset (Id : E; V : Int) is
+   function Known_Static_Component_Bit_Offset     (E : Entity_Id) return B is
    begin
-      Set_Component_Bit_Offset (Id, UI_From_Int (V));
-   end Init_Component_Bit_Offset;
+      return Component_Bit_Offset (E) /= No_Uint
+        and then Component_Bit_Offset (E) >= Uint_0;
+   end Known_Static_Component_Bit_Offset;
 
-   procedure Init_Component_Size (Id : E) is
+   function Known_Component_Size                  (E : Entity_Id) return B is
    begin
-      Set_Component_Size (Id, Uint_0);
-   end Init_Component_Size;
+      return Component_Size (E) /= Uint_0
+        and then Component_Size (E) /= No_Uint;
+   end Known_Component_Size;
 
-   procedure Init_Component_Size (Id : E; V : Int) is
+   function Known_Static_Component_Size           (E : Entity_Id) return B is
    begin
-      Set_Component_Size (Id, UI_From_Int (V));
-   end Init_Component_Size;
+      return Component_Size (E) > Uint_0;
+   end Known_Static_Component_Size;
 
-   procedure Init_Digits_Value (Id : E) is
+   function Known_Esize                           (E : Entity_Id) return B is
    begin
-      Set_Digits_Value (Id, Uint_0);
-   end Init_Digits_Value;
+      return Esize (E) /= Uint_0
+        and then Esize (E) /= No_Uint;
+   end Known_Esize;
 
-   procedure Init_Digits_Value (Id : E; V : Int) is
+   function Known_Static_Esize                    (E : Entity_Id) return B is
    begin
-      Set_Digits_Value (Id, UI_From_Int (V));
-   end Init_Digits_Value;
+      return Esize (E) > Uint_0
+        and then not Is_Generic_Type (E);
+   end Known_Static_Esize;
 
-   procedure Init_Esize (Id : E) is
+   procedure Reinit_Esize (Id : E) is
    begin
       Set_Esize (Id, Uint_0);
-   end Init_Esize;
+   end Reinit_Esize;
 
-   procedure Init_Esize (Id : E; V : Int) is
+   procedure Copy_Esize (To, From : E) is
    begin
-      Set_Esize (Id, UI_From_Int (V));
-   end Init_Esize;
+      raise Program_Error with "Copy_Esize not yet implemented";
+   end Copy_Esize;
 
-   procedure Init_Normalized_First_Bit (Id : E) is
+   function Known_Normalized_First_Bit            (E : Entity_Id) return B is
    begin
-      Set_Normalized_First_Bit (Id, No_Uint);
-   end Init_Normalized_First_Bit;
+      return Normalized_First_Bit (E) /= No_Uint;
+   end Known_Normalized_First_Bit;
 
-   procedure Init_Normalized_First_Bit (Id : E; V : Int) is
+   function Known_Static_Normalized_First_Bit     (E : Entity_Id) return B is
    begin
-      Set_Normalized_First_Bit (Id, UI_From_Int (V));
-   end Init_Normalized_First_Bit;
+      return Normalized_First_Bit (E) /= No_Uint
+        and then Normalized_First_Bit (E) >= Uint_0;
+   end Known_Static_Normalized_First_Bit;
 
-   procedure Init_Normalized_Position (Id : E) is
+   function Known_Normalized_Position             (E : Entity_Id) return B is
    begin
-      Set_Normalized_Position (Id, No_Uint);
-   end Init_Normalized_Position;
+      return Normalized_Position (E) /= No_Uint;
+   end Known_Normalized_Position;
 
-   procedure Init_Normalized_Position (Id : E; V : Int) is
+   function Known_Static_Normalized_Position      (E : Entity_Id) return B is
    begin
-      Set_Normalized_Position (Id, UI_From_Int (V));
-   end Init_Normalized_Position;
+      return Normalized_Position (E) /= No_Uint
+        and then Normalized_Position (E) >= Uint_0;
+   end Known_Static_Normalized_Position;
 
-   procedure Init_Normalized_Position_Max (Id : E) is
+   function Known_RM_Size                         (E : Entity_Id) return B is
    begin
-      Set_Normalized_Position_Max (Id, No_Uint);
-   end Init_Normalized_Position_Max;
+      return RM_Size (E) /= No_Uint
+        and then (RM_Size (E) /= Uint_0
+                    or else Is_Discrete_Type (E)
+                    or else Is_Fixed_Point_Type (E));
+   end Known_RM_Size;
 
-   procedure Init_Normalized_Position_Max (Id : E; V : Int) is
+   function Known_Static_RM_Size                  (E : Entity_Id) return B is
    begin
-      Set_Normalized_Position_Max (Id, UI_From_Int (V));
-   end Init_Normalized_Position_Max;
+      return (RM_Size (E) > Uint_0
+                or else Is_Discrete_Type (E)
+                or else Is_Fixed_Point_Type (E))
+        and then not Is_Generic_Type (E);
+   end Known_Static_RM_Size;
 
-   procedure Init_RM_Size (Id : E) is
+   procedure Reinit_RM_Size (Id : E) is
    begin
       Set_RM_Size (Id, Uint_0);
-   end Init_RM_Size;
+   end Reinit_RM_Size;
 
-   procedure Init_RM_Size (Id : E; V : Int) is
+   procedure Copy_RM_Size (To, From : E) is
    begin
-      Set_RM_Size (Id, UI_From_Int (V));
-   end Init_RM_Size;
+      raise Program_Error with "Copy_RM_Size not yet implemented";
+   end Copy_RM_Size;
 
-   procedure Copy_Alignment (To, From : E) is
-   begin
-      if Known_Alignment (From) then
-         Set_Alignment (To, Alignment (From));
-      else
-         Init_Alignment (To);
-      end if;
-   end Copy_Alignment;
-
-   -----------------------------
-   -- Init_Component_Location --
-   -----------------------------
+   -------------------------------
+   -- Reinit_Component_Location --
+   -------------------------------
 
-   procedure Init_Component_Location (Id : E) is
+   procedure Reinit_Component_Location (Id : E) is
    begin
-      Set_Normalized_First_Bit  (Id, No_Uint);
-      Set_Normalized_Position_Max (Id, No_Uint);
+      Set_Normalized_First_Bit (Id, No_Uint);
       Set_Component_Bit_Offset (Id, No_Uint);
-      Set_Esize (Id, Uint_0);
+      Reinit_Esize (Id);
       Set_Normalized_Position (Id, No_Uint);
-   end Init_Component_Location;
+   end Reinit_Component_Location;
 
-   ----------------------------
-   -- Init_Object_Size_Align --
-   ----------------------------
+   ------------------------------
+   -- Reinit_Object_Size_Align --
+   ------------------------------
 
-   procedure Init_Object_Size_Align (Id : E) is
+   procedure Reinit_Object_Size_Align (Id : E) is
    begin
-      Init_Esize (Id);
-      Init_Alignment (Id);
-   end Init_Object_Size_Align;
+      Reinit_Esize (Id);
+      Reinit_Alignment (Id);
+   end Reinit_Object_Size_Align;
 
    ---------------
    -- Init_Size --
@@ -501,110 +513,17 @@ package body Einfo.Utils is
       Set_RM_Size (Id, UI_From_Int (V));
    end Init_Size;
 
-   ---------------------
-   -- Init_Size_Align --
-   ---------------------
+   -----------------------
+   -- Reinit_Size_Align --
+   -----------------------
 
-   procedure Init_Size_Align (Id : E) is
+   procedure Reinit_Size_Align (Id : E) is
    begin
       pragma Assert (Ekind (Id) in Type_Kind | E_Void);
-      Init_Esize (Id);
-      Init_RM_Size (Id);
-      Init_Alignment (Id);
-   end Init_Size_Align;
-
-   ----------------------------------------------
-   -- Type Representation Attribute Predicates --
-   ----------------------------------------------
-
-   function Known_Alignment                       (E : Entity_Id) return B is
-      Result : constant B := not Field_Is_Initial_Zero (E, F_Alignment);
-   begin
-      return Result;
-   end Known_Alignment;
-
-   function Known_Component_Bit_Offset            (E : Entity_Id) return B is
-   begin
-      return Component_Bit_Offset (E) /= No_Uint;
-   end Known_Component_Bit_Offset;
-
-   function Known_Component_Size                  (E : Entity_Id) return B is
-   begin
-      return Component_Size (E) /= Uint_0
-        and then Component_Size (E) /= No_Uint;
-   end Known_Component_Size;
-
-   function Known_Esize                           (E : Entity_Id) return B is
-   begin
-      return Esize (E) /= Uint_0
-        and then Esize (E) /= No_Uint;
-   end Known_Esize;
-
-   function Known_Normalized_First_Bit            (E : Entity_Id) return B is
-   begin
-      return Normalized_First_Bit (E) /= No_Uint;
-   end Known_Normalized_First_Bit;
-
-   function Known_Normalized_Position             (E : Entity_Id) return B is
-   begin
-      return Normalized_Position (E) /= No_Uint;
-   end Known_Normalized_Position;
-
-   function Known_Normalized_Position_Max         (E : Entity_Id) return B is
-   begin
-      return Normalized_Position_Max (E) /= No_Uint;
-   end Known_Normalized_Position_Max;
-
-   function Known_RM_Size                         (E : Entity_Id) return B is
-   begin
-      return RM_Size (E) /= No_Uint
-        and then (RM_Size (E) /= Uint_0
-                    or else Is_Discrete_Type (E)
-                    or else Is_Fixed_Point_Type (E));
-   end Known_RM_Size;
-
-   function Known_Static_Component_Bit_Offset     (E : Entity_Id) return B is
-   begin
-      return Component_Bit_Offset (E) /= No_Uint
-        and then Component_Bit_Offset (E) >= Uint_0;
-   end Known_Static_Component_Bit_Offset;
-
-   function Known_Static_Component_Size           (E : Entity_Id) return B is
-   begin
-      return Component_Size (E) > Uint_0;
-   end Known_Static_Component_Size;
-
-   function Known_Static_Esize                    (E : Entity_Id) return B is
-   begin
-      return Esize (E) > Uint_0
-        and then not Is_Generic_Type (E);
-   end Known_Static_Esize;
-
-   function Known_Static_Normalized_First_Bit     (E : Entity_Id) return B is
-   begin
-      return Normalized_First_Bit (E) /= No_Uint
-        and then Normalized_First_Bit (E) >= Uint_0;
-   end Known_Static_Normalized_First_Bit;
-
-   function Known_Static_Normalized_Position      (E : Entity_Id) return B is
-   begin
-      return Normalized_Position (E) /= No_Uint
-        and then Normalized_Position (E) >= Uint_0;
-   end Known_Static_Normalized_Position;
-
-   function Known_Static_Normalized_Position_Max  (E : Entity_Id) return B is
-   begin
-      return Normalized_Position_Max (E) /= No_Uint
-        and then Normalized_Position_Max (E) >= Uint_0;
-   end Known_Static_Normalized_Position_Max;
-
-   function Known_Static_RM_Size                  (E : Entity_Id) return B is
-   begin
-      return (RM_Size (E) > Uint_0
-                or else Is_Discrete_Type (E)
-                or else Is_Fixed_Point_Type (E))
-        and then not Is_Generic_Type (E);
-   end Known_Static_RM_Size;
+      Reinit_Esize (Id);
+      Reinit_RM_Size (Id);
+      Reinit_Alignment (Id);
+   end Reinit_Size_Align;
 
    --------------------
    -- Address_Clause --
index a6517b99b88abcdff5be50b09c2770d971d3f44d..4eca35e1e5fe49514b34843a16aad9996dedae50 100644 (file)
@@ -310,75 +310,115 @@ package Einfo.Utils is
    pragma Inline (Type_High_Bound);
    pragma Inline (Type_Low_Bound);
 
-   ----------------------------------------------
-   -- Type Representation Attribute Predicates --
-   ----------------------------------------------
-
-   --  These predicates test the setting of the indicated attribute. The
-   --  Known predicate is True if and only if the value has been set. The
-   --  Known_Static predicate is True only if the value is set (Known) and is
-   --  set to a compile time known value. Note that in the case of Alignment
-   --  and Normalized_First_Bit, dynamic values are not possible, so we do not
-   --  need a separate Known_Static calls in these cases. The not set (unknown)
-   --  values are as follows:
-
-   --    Alignment               Uint_0 or No_Uint
-   --    Component_Size          Uint_0 or No_Uint
-   --    Component_Bit_Offset    No_Uint
-   --    Digits_Value            Uint_0 or No_Uint
-   --    Esize                   Uint_0 or No_Uint
-   --    Normalized_First_Bit    No_Uint
-   --    Normalized_Position     No_Uint
-   --    Normalized_Position_Max No_Uint
-   --    RM_Size                 Uint_0 or No_Uint
-
-   --  It would be cleaner to use No_Uint in all these cases, but historically
-   --  we chose to use Uint_0 at first, and the change over will take time ???
-   --  This is particularly true for the RM_Size field, where a value of zero
-   --  is legitimate. We deal with this by a considering that the value is
-   --  always known static for discrete types (and no other types can have
-   --  an RM_Size value of zero).
-
+   ------------------------------------------
+   -- Type Representation Attribute Fields --
+   ------------------------------------------
+
+   --  Each of the following fields can be in a "known" or "unknown" state:
+
+   --    Alignment
+   --    Component_Size
+   --    Component_Bit_Offset
+   --    Digits_Value
+   --    Esize
+   --    Normalized_First_Bit
+   --    Normalized_Position
+   --    RM_Size
+   --
+   --  NOTE: "known" here does not mean "known at compile time". It means that
+   --  the compiler has computed the value of the field (either by default, or
+   --  by noting some representation clauses), and the field has not been
+   --  reinitialized.
+   --
+   --  We document the Esize functions here; the others are analogous:
+   --
+   --     Known_Esize: True if Set_Esize has been called without a subsequent
+   --     Reinit_Esize.
+   --
+   --     Known_Static_Esize: True if Known_Esize and the Esize is known at
+   --     compile time. (We're not using "static" in the Ada RM sense here. We
+   --     are using it to mean "known at compile time.)
+   --
+   --     Reinit_Esize: Set the Esize field to its initial unknown state.
+   --
+   --     Copy_Esize: Copies the Esize from From to To; Known_Esize (From) may
+   --     be False, in which case Known_Esize (To) becomes False.
+   --
+   --     Esize: This is the normal automatially-generated getter for Esize,
+   --     declared elsewhere. It is an error to call this if Set_Esize has not
+   --     yet been called, or if Reinit_Esize has been called subsequently.
+   --
+   --     Set_Esize: This is the normal automatially-generated setter for
+   --     Esize. After a call to this, Known_Esize is True. It is an error
+   --     to call this with a No_Uint value.
+   --
+   --  Normally, we call Set_Esize first, and then query Esize (and similarly
+   --  for other fields). However in some cases, we need to check Known_Esize
+   --  before calling Esize, because the code is written in such a way that we
+   --  don't know whether Set_Esize has already been called.
+   --
+   --  We intend to use the initial zero value to represent "unknown". Note
+   --  that this value is different from No_Uint, and different from Uint_0.
+   --  However, this is work in progress; we are still using No_Uint or Uint_0
+   --  to represent "unknown" in some cases. Using Uint_0 leads to several
+   --  bugs, because zero is a legitimate value (T'Size can be zero bits) --
+   --  Uint_0 shouldn't mean two different things.
+   --
    --  In two cases, Known_Static_Esize and Known_Static_RM_Size, there is one
    --  more consideration, which is that we always return False for generic
-   --  types. Within a template, the size can look known, because of the fake
-   --  size values we put in template types, but they are not really known and
-   --  anyone testing if they are known within the template should get False as
-   --  a result to prevent incorrect assumptions.
-
-   function Known_Alignment                       (E : Entity_Id) return B;
-   function Known_Component_Bit_Offset            (E : Entity_Id) return B;
-   function Known_Component_Size                  (E : Entity_Id) return B;
-   function Known_Esize                           (E : Entity_Id) return B;
-   function Known_Normalized_First_Bit            (E : Entity_Id) return B;
-   function Known_Normalized_Position             (E : Entity_Id) return B;
-   function Known_Normalized_Position_Max         (E : Entity_Id) return B;
-   function Known_RM_Size                         (E : Entity_Id) return B;
-
-   function Known_Static_Component_Bit_Offset     (E : Entity_Id) return B;
-   function Known_Static_Component_Size           (E : Entity_Id) return B;
-   function Known_Static_Esize                    (E : Entity_Id) return B;
-   function Known_Static_Normalized_First_Bit     (E : Entity_Id) return B;
-   function Known_Static_Normalized_Position      (E : Entity_Id) return B;
-   function Known_Static_Normalized_Position_Max  (E : Entity_Id) return B;
-   function Known_Static_RM_Size                  (E : Entity_Id) return B;
-
-   pragma Inline (Known_Alignment);
-   pragma Inline (Known_Component_Bit_Offset);
-   pragma Inline (Known_Component_Size);
-   pragma Inline (Known_Esize);
-   pragma Inline (Known_Normalized_First_Bit);
-   pragma Inline (Known_Normalized_Position);
-   pragma Inline (Known_Normalized_Position_Max);
-   pragma Inline (Known_RM_Size);
-
-   pragma Inline (Known_Static_Component_Bit_Offset);
-   pragma Inline (Known_Static_Component_Size);
-   pragma Inline (Known_Static_Esize);
-   pragma Inline (Known_Static_Normalized_First_Bit);
-   pragma Inline (Known_Static_Normalized_Position);
-   pragma Inline (Known_Static_Normalized_Position_Max);
-   pragma Inline (Known_Static_RM_Size);
+   --  types. Within a template, the size can look Known_Static, because of the
+   --  fake size values we put in template types, but they are not really
+   --  Known_Static and anyone testing if they are Known_Static within the
+   --  template should get False as a result to prevent incorrect assumptions.
+
+   function Known_Alignment (E : Entity_Id) return B with Inline;
+   procedure Reinit_Alignment (Id : E) with Inline;
+   procedure Copy_Alignment (To, From : E);
+
+   function Known_Component_Bit_Offset (E : Entity_Id) return B with Inline;
+   function Known_Static_Component_Bit_Offset (E : Entity_Id) return B
+     with Inline;
+
+   function Known_Component_Size (E : Entity_Id) return B with Inline;
+   function Known_Static_Component_Size (E : Entity_Id) return B with Inline;
+
+   function Known_Esize (E : Entity_Id) return B with Inline;
+   function Known_Static_Esize (E : Entity_Id) return B with Inline;
+   procedure Reinit_Esize (Id : E) with Inline;
+   procedure Copy_Esize (To, From : E);
+
+   function Known_Normalized_First_Bit (E : Entity_Id) return B with Inline;
+   function Known_Static_Normalized_First_Bit (E : Entity_Id) return B
+     with Inline;
+
+   function Known_Normalized_Position (E : Entity_Id) return B with Inline;
+   function Known_Static_Normalized_Position (E : Entity_Id) return B
+     with Inline;
+
+   function Known_RM_Size (E : Entity_Id) return B with Inline;
+   function Known_Static_RM_Size (E : Entity_Id) return B with Inline;
+   procedure Reinit_RM_Size (Id : E) with Inline;
+   procedure Copy_RM_Size (To, From : E);
+
+   ---------------------------------------------------------
+   -- Procedures for setting multiple of the above fields --
+   ---------------------------------------------------------
+
+   procedure Reinit_Component_Location (Id : E);
+   --  Initializes all fields describing the location of a component
+   --  (Normalized_Position, Component_Bit_Offset, Normalized_First_Bit,
+   --  Esize) to all be Unknown.
+
+   procedure Init_Size (Id : E; V : Int);
+   --  Initialize both the Esize and RM_Size fields of E to V
+
+   procedure Reinit_Size_Align (Id : E);
+   --  This procedure initializes both size fields and the alignment
+   --  field to all be Unknown.
+
+   procedure Reinit_Object_Size_Align (Id : E);
+   --  Same as Reinit_Size_Align except RM_Size field (which is only for types)
+   --  is unaffected.
 
    ---------------------------------------------------
    -- Access to Subprograms in Subprograms_For_Type --
@@ -404,89 +444,6 @@ package Einfo.Utils is
    procedure Set_Predicate_Function              (Id : E; V : E);
    procedure Set_Predicate_Function_M            (Id : E; V : E);
 
-   -----------------------------------
-   -- Field Initialization Routines --
-   -----------------------------------
-
-   --  These routines are overloadings of some of the above Set procedures
-   --  where the argument is normally a Uint. The overloadings take an Int
-   --  parameter instead, and appropriately convert it. There are also
-   --  versions that implicitly initialize to the appropriate "not set"
-   --  value. The not set (unknown) values are as follows:
-
-   --    Alignment                 Uint_0
-   --    Component_Size            Uint_0
-   --    Component_Bit_Offset      No_Uint
-   --    Digits_Value              Uint_0
-   --    Esize                     Uint_0
-   --    Normalized_First_Bit      No_Uint
-   --    Normalized_Position       No_Uint
-   --    Normalized_Position_Max   No_Uint
-   --    RM_Size                   Uint_0
-
-   --  It would be cleaner to use No_Uint in all these cases, but historically
-   --  we chose to use Uint_0 at first, and the change over will take time ???
-   --  This is particularly true for the RM_Size field, where a value of zero
-   --  is legitimate and causes some special tests around the code.
-
-   --  Contrary to the corresponding Set procedures above, these routines
-   --  do NOT check the entity kind of their argument, instead they set the
-   --  underlying Uint fields directly (this allows them to be used for
-   --  entities whose Ekind has not been set yet).
-
-   procedure Init_Alignment                (Id : E; V : Int);
-   procedure Init_Component_Bit_Offset     (Id : E; V : Int);
-   procedure Init_Component_Size           (Id : E; V : Int);
-   procedure Init_Digits_Value             (Id : E; V : Int);
-   procedure Init_Esize                    (Id : E; V : Int);
-   procedure Init_Normalized_First_Bit     (Id : E; V : Int);
-   procedure Init_Normalized_Position      (Id : E; V : Int);
-   procedure Init_Normalized_Position_Max  (Id : E; V : Int);
-   procedure Init_RM_Size                  (Id : E; V : Int);
-
-   procedure Init_Alignment                (Id : E);
-   procedure Init_Component_Bit_Offset     (Id : E);
-   procedure Init_Component_Size           (Id : E);
-   procedure Init_Digits_Value             (Id : E);
-   procedure Init_Esize                    (Id : E);
-   procedure Init_Normalized_First_Bit     (Id : E);
-   procedure Init_Normalized_Position      (Id : E);
-   procedure Init_Normalized_Position_Max  (Id : E);
-   procedure Init_RM_Size                  (Id : E);
-
-   --  The following Copy_xxx procedures copy the value of xxx from From to
-   --  To. If xxx is set to its initial invalid (zero-bits) value, then it is
-   --  reset to invalid in To. We only have Copy_Alignment so far, but more are
-   --  planned.
-
-   procedure Copy_Alignment (To, From : E);
-
-   pragma Inline (Init_Alignment);
-   pragma Inline (Init_Component_Bit_Offset);
-   pragma Inline (Init_Component_Size);
-   pragma Inline (Init_Digits_Value);
-   pragma Inline (Init_Esize);
-   pragma Inline (Init_Normalized_First_Bit);
-   pragma Inline (Init_Normalized_Position);
-   pragma Inline (Init_Normalized_Position_Max);
-   pragma Inline (Init_RM_Size);
-
-   procedure Init_Component_Location (Id : E);
-   --  Initializes all fields describing the location of a component
-   --  (Normalized_Position, Component_Bit_Offset, Normalized_First_Bit,
-   --  Normalized_Position_Max, Esize) to all be Unknown.
-
-   procedure Init_Size (Id : E; V : Int);
-   --  Initialize both the Esize and RM_Size fields of E to V
-
-   procedure Init_Size_Align (Id : E);
-   --  This procedure initializes both size fields and the alignment
-   --  field to all be Unknown.
-
-   procedure Init_Object_Size_Align (Id : E);
-   --  Same as Init_Size_Align except RM_Size field (which is only for types)
-   --  is unaffected.
-
    ---------------
    -- Iterators --
    ---------------
index e87ce4c8ba29ae11d31aa8b0ad825fe05d412bcc..39ddd6686a4ee8fb5d7431203a4af6e74496be67 100644 (file)
@@ -3762,17 +3762,6 @@ package Einfo is
 --       units from the start of the record to the lowest addressed storage
 --       unit containing part or all of the field.
 
---    Normalized_Position_Max
---       Defined in components and discriminants. For almost all cases, this
---       is the same as Normalized_Position. The one exception is for the case
---       of a discriminated record containing one or more arrays whose length
---       depends on discriminants. In this case, the Normalized_Position_Max
---       field represents the maximum possible value of Normalized_Position
---       assuming min/max values for discriminant subscripts in all fields.
---       This is used by Layout in front end layout mode to properly compute
---       the maximum size of such records (needed for allocation purposes when
---       there are default discriminants, and also for the 'Size value).
-
 --    Number_Dimensions (synthesized)
 --       Applies to array types and subtypes. Returns the number of dimensions
 --       of the array type or subtype as a value of type Pos.
@@ -5228,7 +5217,6 @@ package Einfo is
    --    Linker_Section_Pragma $$$
    --    Normalized_First_Bit
    --    Current_Value                         (always Empty)
-   --    Normalized_Position_Max
    --    Component_Bit_Offset
    --    Esize
    --    Component_Clause
@@ -5328,7 +5316,6 @@ package Einfo is
    --  E_Discriminant
    --    Normalized_First_Bit
    --    Current_Value                         (always Empty)
-   --    Normalized_Position_Max
    --    Component_Bit_Offset
    --    Esize
    --    Component_Clause
index 88f86f4b79ab3f60b4609c124a5b4953aa0c8580..e27d00b05235a99695162a9732b85e72b737279f 100644 (file)
@@ -575,7 +575,7 @@ package body Exp_Pakd is
 
          --  Set remaining fields of packed array type
 
-         Init_Alignment                (PAT);
+         Reinit_Alignment              (PAT);
          Set_Parent                    (PAT, Empty);
          Set_Associated_Node_For_Itype (PAT, Typ);
          Set_Original_Array_Type       (PAT, Typ);
index 4517c5943e3782db5ba3e079e807f79d90b43a27..d956327ce9646244a9596e3ae230d50c38127374 100644 (file)
@@ -615,27 +615,6 @@ B Known_Normalized_Position_Max         (Entity_Id E);
 #define Known_RM_Size einfo__utils__known_rm_size
 B Known_RM_Size                         (Entity_Id E);
 
-#define Known_Static_Component_Bit_Offset einfo__utils__known_static_component_bit_offset
-B Known_Static_Component_Bit_Offset     (Entity_Id E);
-
-#define Known_Static_Component_Size einfo__utils__known_static_component_size
-B Known_Static_Component_Size           (Entity_Id E);
-
-#define Known_Static_Esize einfo__utils__known_static_esize
-B Known_Static_Esize                    (Entity_Id E);
-
-#define Known_Static_Normalized_First_Bit einfo__utils__known_static_normalized_first_bit
-B Known_Static_Normalized_First_Bit     (Entity_Id E);
-
-#define Known_Static_Normalized_Position einfo__utils__known_static_normalized_position
-B Known_Static_Normalized_Position      (Entity_Id E);
-
-#define Known_Static_Normalized_Position_Max einfo__utils__known_static_normalized_position_max
-B Known_Static_Normalized_Position_Max  (Entity_Id E);
-
-#define Known_Static_RM_Size einfo__utils__known_static_rm_size
-B Known_Static_RM_Size                  (Entity_Id E);
-
 #define Copy_Alignment einfo__utils__copy_alignment
 B Copy_Alignment(Entity_Id To, Entity_Id From);
 
index 84502d879e7f8ac2de9d5ee44ad11f24c4cc8ea8..170f667ba40dfbee50f4762947329de7f2f06397 100644 (file)
@@ -7467,7 +7467,7 @@ package body Freeze is
 
         and then not Target_Short_Enums
       then
-         Init_Esize (Typ, Standard_Integer_Size);
+         Set_Esize (Typ, UI_From_Int (Standard_Integer_Size));
          Set_Alignment (Typ, Alignment (Standard_Integer));
 
       --  Normal Ada case or size clause present or not Long_C_Enums on target
@@ -9076,7 +9076,7 @@ package body Freeze is
             Actual_Size := 128;
          end if;
 
-         Init_Esize (Typ, Actual_Size);
+         Set_Esize (Typ, UI_From_Int (Actual_Size));
          Adjust_Esize_For_Alignment (Typ);
       end if;
 
@@ -9132,7 +9132,7 @@ package body Freeze is
       --  Set Esize to calculated size if not set already
 
       if not Known_Esize (Typ) then
-         Init_Esize (Typ, Actual_Size);
+         Set_Esize (Typ, UI_From_Int (Actual_Size));
       end if;
 
       --  Set RM_Size if not already set. If already set, check value
index 0a3046eb52032048a73729a2770978d78f43ddd7..360e2e1e0eb1fde7d01cd3681bbf0f3e5a5c6fad 100644 (file)
@@ -828,7 +828,6 @@ package Gen_IL.Fields is
       Nonzero_Is_True,
       Normalized_First_Bit,
       Normalized_Position,
-      Normalized_Position_Max,
       OK_To_Rename,
       Optimize_Alignment_Space,
       Optimize_Alignment_Time,
index 41dd2327332a7fab80dbd19287f2a8d57ba22aaa..bca0549cc9797c16b2c5a42671468fa84f098e75 100644 (file)
@@ -316,7 +316,6 @@ begin -- Gen_IL.Gen.Gen_Entities
         Sm (Interface_Name, Node_Id),
         Sm (Normalized_First_Bit, Uint),
         Sm (Normalized_Position, Uint),
-        Sm (Normalized_Position_Max, Uint),
         Sm (Original_Record_Component, Node_Id)));
 
    Cc (E_Component, Record_Field_Kind,
index f51b44a44122717e9fbdde0314df288918a4ecb1..8cbc8d61a13908498a3f4a7073149cc336b862fa 100644 (file)
@@ -62,7 +62,7 @@ package body Itypes is
       end if;
 
       --  Make sure Esize (Typ) was properly initialized, it should be since
-      --  New_Internal_Entity/New_External_Entity call Init_Size_Align.
+      --  New_Internal_Entity/New_External_Entity call Reinit_Size_Align.
 
       pragma Assert (Esize (Typ) = Uint_0);
 
index e69386c81faf93e9571e0245702ea9415936b7ce..700ae799335ffeb391a7b26894b34e8c3784eeef 100644 (file)
@@ -155,7 +155,7 @@ package body Layout is
             exit when Esize (E) mod Abits = 0;
          end loop;
 
-         Init_Alignment (E, Abits / SSU);
+         Set_Alignment (E, UI_From_Int (Abits / SSU));
          return;
       end if;
 
@@ -243,8 +243,8 @@ package body Layout is
       --  like or need the size to be set.
 
       if Ekind (E) = E_String_Literal_Subtype then
-         Set_Esize (E, Uint_0);
-         Set_RM_Size (E, Uint_0);
+         Reinit_Esize (E);
+         Reinit_RM_Size (E);
          return;
       end if;
 
@@ -379,7 +379,7 @@ package body Layout is
                      --  If size is big enough, set it and exit
 
                      if S >= RM_Size (E) then
-                        Init_Esize (E, S);
+                        Set_Esize (E, UI_From_Int (S));
                         exit;
 
                      --  If the RM_Size is greater than System_Max_Integer_Size
@@ -624,13 +624,13 @@ package body Layout is
 
                if Is_Scalar_Type (E) then
                   if Size <= SSU then
-                     Init_Esize (E, SSU);
+                     Set_Esize (E, UI_From_Int (SSU));
                   elsif Size <= 16 then
-                     Init_Esize (E, 16);
+                     Set_Esize (E, Uint_16);
                   elsif Size <= 32 then
-                     Init_Esize (E, 32);
+                     Set_Esize (E, Uint_32);
                   else
-                     Set_Esize  (E, (Size + 63) / 64 * 64);
+                     Set_Esize (E, (Size + 63) / 64 * 64);
                   end if;
 
                   --  Finally, make sure that alignment is consistent with
@@ -899,7 +899,7 @@ package body Layout is
       --  nothing to do with code.
 
       if Is_Generic_Type (Root_Type (FST)) then
-         Set_RM_Size (Def_Id, Uint_0);
+         Reinit_RM_Size (Def_Id);
 
       --  If the subtype statically matches the first subtype, then it is
       --  required to have exactly the same layout. This is required by
@@ -1021,7 +1021,7 @@ package body Layout is
          --  this new calculated value.
 
          if not Known_Alignment (E) then
-            Init_Alignment (E, A);
+            Set_Alignment (E, UI_From_Int (A));
 
          --  Cases where we have inherited an alignment
 
@@ -1030,7 +1030,7 @@ package body Layout is
          --  sure that no constructed types have weird alignments.
 
          elsif not Comes_From_Source (E) then
-            Init_Alignment (E, A);
+            Set_Alignment (E, UI_From_Int (A));
 
          --  If this inherited alignment is the same as the one we computed,
          --  then obviously everything is fine, and we do not need to reset it.
@@ -1136,7 +1136,7 @@ package body Layout is
                   --  ACATS problem which seems to have disappeared anyway, and
                   --  in any case, this peculiarity was never documented.
 
-                  Init_Alignment (E, A);
+                  Set_Alignment (E, UI_From_Int (A));
 
                --  If no Size (or Object_Size) was specified, then we have
                --  inherited the object size, so we should also inherit the
index 1e7b93cc5b56e655e869a5498fd4675bdbb0a5b1..dd78501025a0579d31a5d9af092b8b4d0f190b1e 100644 (file)
@@ -5825,7 +5825,7 @@ package body Sem_Ch10 is
          Set_Is_First_Subtype   (Ent);
          Set_Scope              (Ent, Scop);
          Set_Stored_Constraint  (Ent, No_Elist);
-         Init_Size_Align        (Ent);
+         Reinit_Size_Align      (Ent);
 
          if From_Limited_With (Ent) then
             Set_Private_Dependents (Ent, New_Elmt_List);
@@ -5865,7 +5865,7 @@ package body Sem_Ch10 is
             Set_Is_Tagged_Type            (CW_Typ);
             Set_Materialize_Entity        (CW_Typ, Materialize);
             Set_Scope                     (CW_Typ, Scop);
-            Init_Size_Align               (CW_Typ);
+            Reinit_Size_Align             (CW_Typ);
          end if;
       end Decorate_Type;
 
index 85c854f19f387887b2b28e3ea8d1f19d6bbd2352..d816c070f990191187a83a8a2f6f686350f99817 100644 (file)
@@ -2495,7 +2495,7 @@ package body Sem_Ch12 is
       Mutate_Ekind        (T, E_Enumeration_Subtype);
       Set_Etype           (T, Base);
       Init_Size           (T, 8);
-      Init_Alignment      (T);
+      Reinit_Alignment    (T);
       Set_Is_Generic_Type (T);
       Set_Is_Constrained  (T);
 
@@ -2524,7 +2524,7 @@ package body Sem_Ch12 is
       Mutate_Ekind        (Base, E_Enumeration_Type);
       Set_Etype           (Base, Base);
       Init_Size           (Base, 8);
-      Init_Alignment      (Base);
+      Reinit_Alignment    (Base);
       Set_Is_Generic_Type (Base);
       Set_Scalar_Range    (Base, Scalar_Range (T));
       Set_Parent          (Base, Parent (Def));
index 469177c4ba2a53711a66e49385f922a5b4dd48d1..0fe6c52da28f337396280abdcacd7d2a0e3d3408 100644 (file)
@@ -862,7 +862,7 @@ package body Sem_Ch13 is
         and then not Has_Alignment_Clause (Typ)
         and then Size mod (Alignment (Typ) * SSU) /= 0
       then
-         Init_Alignment (Typ);
+         Reinit_Alignment (Typ);
       end if;
    end Alignment_Check_For_Size_Change;
 
@@ -6746,9 +6746,9 @@ package body Sem_Ch13 is
                   Analyze (Decl, Suppress => All_Checks);
 
                   Set_Has_Delayed_Freeze        (New_Ctyp, False);
-                  Init_Esize                    (New_Ctyp);
+                  Reinit_Esize                  (New_Ctyp);
                   Set_RM_Size                   (New_Ctyp, Csize);
-                  Init_Alignment                (New_Ctyp);
+                  Reinit_Alignment              (New_Ctyp);
                   Set_Is_Itype                  (New_Ctyp, True);
                   Set_Associated_Node_For_Itype (New_Ctyp, U_Ent);
 
@@ -7322,13 +7322,14 @@ package body Sem_Ch13 is
                      if Is_First_Subtype (U_Ent) then
                         if Is_Elementary_Type (U_Ent) then
                            if Size <= System_Storage_Unit then
-                              Init_Esize (U_Ent, System_Storage_Unit);
+                              Set_Esize
+                                (U_Ent, UI_From_Int (System_Storage_Unit));
                            elsif Size <= 16 then
-                              Init_Esize (U_Ent, 16);
+                              Set_Esize (U_Ent, Uint_16);
                            elsif Size <= 32 then
-                              Init_Esize (U_Ent, 32);
+                              Set_Esize (U_Ent, Uint_32);
                            else
-                              Set_Esize  (U_Ent, (Size + 63) / 64 * 64);
+                              Set_Esize (U_Ent, (Size + 63) / 64 * 64);
                            end if;
 
                            Alignment_Check_For_Size_Change
@@ -8652,9 +8653,6 @@ package body Sem_Ch13 is
                         Set_Normalized_First_Bit (Comp, Fbit mod SSU);
                         Set_Normalized_Position  (Comp, Fbit / SSU);
 
-                        Set_Normalized_Position_Max
-                          (Comp, Normalized_Position (Comp));
-
                         if Warn_On_Overridden_Size
                           and then Has_Size_Clause (Etype (Comp))
                           and then RM_Size (Etype (Comp)) /= Esize (Comp)
@@ -8686,9 +8684,6 @@ package body Sem_Ch13 is
                            Set_Normalized_First_Bit (Ocomp, Fbit mod SSU);
                            Set_Normalized_Position  (Ocomp, Fbit / SSU);
 
-                           Set_Normalized_Position_Max
-                             (Ocomp, Normalized_Position (Ocomp));
-
                            --  Note: we don't use Set_Biased here, because we
                            --  already gave a warning above if needed, and we
                            --  would get a duplicate for the same name here.
@@ -12104,8 +12099,7 @@ package body Sem_Ch13 is
          Set_Component_Bit_Offset    (Fent, Uint_0);
          Set_Normalized_Position     (Fent, Uint_0);
          Set_Normalized_First_Bit    (Fent, Uint_0);
-         Set_Normalized_Position_Max (Fent, Uint_0);
-         Init_Esize                  (Fent, System_Address_Size);
+         Set_Esize                   (Fent, UI_From_Int (System_Address_Size));
 
          Set_Component_Clause (Fent,
            Make_Component_Clause (Loc,
@@ -16133,10 +16127,10 @@ package body Sem_Ch13 is
    procedure Set_Enum_Esize (T : Entity_Id) is
       Lo : Uint;
       Hi : Uint;
-      Sz : Nat;
+      Sz : Unat;
 
    begin
-      Init_Alignment (T);
+      Reinit_Alignment (T);
 
       --  Find the minimum standard size (8,16,32,64,128) that fits
 
@@ -16144,37 +16138,38 @@ package body Sem_Ch13 is
       Hi := Enumeration_Rep (Entity (Type_High_Bound (T)));
 
       if Lo < 0 then
-         if Lo >= -Uint_2**07 and then Hi < Uint_2**07 then
-            Sz := Standard_Character_Size;  -- May be > 8 on some targets
+         if Lo >= -Uint_2**7 and then Hi < Uint_2**7 then
+            Sz := UI_From_Int (Standard_Character_Size);
+            --  Might be > 8 on some targets
 
          elsif Lo >= -Uint_2**15 and then Hi < Uint_2**15 then
-            Sz := 16;
+            Sz := Uint_16;
 
          elsif Lo >= -Uint_2**31 and then Hi < Uint_2**31 then
-            Sz := 32;
+            Sz := Uint_32;
 
          elsif Lo >= -Uint_2**63 and then Hi < Uint_2**63 then
-            Sz := 64;
+            Sz := Uint_64;
 
          else pragma Assert (Lo >= -Uint_2**127 and then Hi < Uint_2**127);
-            Sz := 128;
+            Sz := Uint_128;
          end if;
 
       else
-         if Hi < Uint_2**08 then
-            Sz := Standard_Character_Size;  -- May be > 8 on some targets
+         if Hi < Uint_2**8 then
+            Sz := UI_From_Int (Standard_Character_Size);
 
          elsif Hi < Uint_2**16 then
-            Sz := 16;
+            Sz := Uint_16;
 
          elsif Hi < Uint_2**32 then
-            Sz := 32;
+            Sz := Uint_32;
 
          elsif Hi < Uint_2**64 then
-            Sz := 64;
+            Sz := Uint_64;
 
          else pragma Assert (Hi < Uint_2**128);
-            Sz := 128;
+            Sz := Uint_128;
          end if;
       end if;
 
@@ -16190,9 +16185,9 @@ package body Sem_Ch13 is
 
         and then not Target_Short_Enums
       then
-         Init_Esize (T, Standard_Integer_Size);
+         Set_Esize (T, UI_From_Int (Standard_Integer_Size));
       else
-         Init_Esize (T, Sz);
+         Set_Esize (T, Sz);
       end if;
    end Set_Enum_Esize;
 
index 7ab72aff06dfc848c1a0d3f63a1abc9a58224bdd..6a938706968ad4041b6ceb4d973081198f274ab6 100644 (file)
@@ -1299,7 +1299,7 @@ package body Sem_Ch3 is
       Set_Can_Use_Internal_Rep     (T_Name,
                                       not Always_Compatible_Rep_On_Target);
       Set_Etype                    (T_Name, T_Name);
-      Init_Size_Align              (T_Name);
+      Reinit_Size_Align            (T_Name);
       Set_Directly_Designated_Type (T_Name, Desig_Type);
 
       --  If the access_to_subprogram is not declared at the library level,
@@ -1465,7 +1465,7 @@ package body Sem_Ch3 is
       --  and the pointer size is already set. Else, initialize.
 
       if not From_Limited_With (T) then
-         Init_Size_Align (T);
+         Reinit_Size_Align (T);
       end if;
 
       --  Note that Has_Task is always false, since the access type itself
@@ -1551,7 +1551,7 @@ package body Sem_Ch3 is
          Set_Is_Aliased          (Tag);
          Set_Is_Independent      (Tag);
          Set_Related_Type        (Tag, Iface);
-         Init_Component_Location (Tag);
+         Reinit_Component_Location (Tag);
 
          pragma Assert (Is_Frozen (Iface));
 
@@ -1591,7 +1591,7 @@ package body Sem_Ch3 is
             Set_Is_Aliased          (Offset);
             Set_Is_Independent      (Offset);
             Set_Related_Type        (Offset, Iface);
-            Init_Component_Location (Offset);
+            Reinit_Component_Location (Offset);
             Insert_After (Last_Tag, Decl);
             Last_Tag := Decl;
          end if;
@@ -3492,7 +3492,7 @@ package body Sem_Ch3 is
       Mutate_Ekind         (T, E_Incomplete_Type);
       Set_Etype            (T, T);
       Set_Is_First_Subtype (T);
-      Init_Size_Align      (T);
+      Reinit_Size_Align    (T);
 
       --  Set the SPARK mode from the current context
 
@@ -4891,8 +4891,8 @@ package body Sem_Ch3 is
 
       --  Initialize alignment and size and capture alignment setting
 
-      Init_Alignment               (Id);
-      Init_Esize                   (Id);
+      Reinit_Alignment             (Id);
+      Reinit_Esize                 (Id);
       Set_Optimize_Alignment_Flags (Id);
 
       --  Deal with aliased case
@@ -5225,7 +5225,7 @@ package body Sem_Ch3 is
       Set_Is_Pure          (T, Is_Pure (Current_Scope));
       Set_Scope            (T, Current_Scope);
       Mutate_Ekind         (T, E_Record_Type_With_Private);
-      Init_Size_Align      (T);
+      Reinit_Size_Align    (T);
       Set_Default_SSO      (T);
       Set_No_Reordering    (T, No_Component_Reordering);
 
@@ -5390,7 +5390,7 @@ package body Sem_Ch3 is
    begin
       Generate_Definition (Id);
       Set_Is_Pure (Id, Is_Pure (Current_Scope));
-      Init_Size_Align (Id);
+      Reinit_Size_Align (Id);
 
       --  The following guard condition on Enter_Name is to handle cases where
       --  the defining identifier has already been entered into the scope but
@@ -6332,7 +6332,7 @@ package body Sem_Ch3 is
          --  The constrained array type is a subtype of the unconstrained one
 
          Mutate_Ekind           (T, E_Array_Subtype);
-         Init_Size_Align        (T);
+         Reinit_Size_Align      (T);
          Set_Etype              (T, Implicit_Base);
          Set_Scope              (T, Current_Scope);
          Set_Is_Constrained     (T);
@@ -6368,7 +6368,7 @@ package body Sem_Ch3 is
          end if;
 
          Mutate_Ekind                 (T, E_Array_Type);
-         Init_Size_Align              (T);
+         Reinit_Size_Align            (T);
          Set_Etype                    (T, T);
          Set_Scope                    (T, Current_Scope);
          Set_Component_Size           (T, Uint_0);
@@ -8987,7 +8987,7 @@ package body Sem_Ch3 is
 
       if Is_Tagged then
          Set_Is_Tagged_Type (Derived_Type);
-         Init_Size_Align    (Derived_Type);
+         Reinit_Size_Align  (Derived_Type);
       end if;
 
       --  STEP 0a: figure out what kind of derived type declaration we have
@@ -10616,7 +10616,7 @@ package body Sem_Ch3 is
       end if;
 
       Set_Etype             (Def_Id, T);
-      Init_Size_Align       (Def_Id);
+      Reinit_Size_Align     (Def_Id);
       Set_Has_Discriminants (Def_Id, Has_Discrs);
       Set_Is_Constrained    (Def_Id, Constrained);
 
@@ -15738,7 +15738,7 @@ package body Sem_Ch3 is
 
                   --  Set remaining characterstics of anonymous access type
 
-                  Init_Alignment (Acc_Type);
+                  Reinit_Alignment (Acc_Type);
                   Set_Directly_Designated_Type (Acc_Type, Derived_Type);
 
                   Set_Etype (New_Id, Acc_Type);
@@ -19812,10 +19812,10 @@ package body Sem_Ch3 is
                Siz := Siz * 2;
             end loop;
 
-            Init_Esize (T, Siz);
+            Set_Esize (T, UI_From_Int (Siz));
 
          else
-            Init_Esize (T, System_Max_Binary_Modulus_Power);
+            Set_Esize (T, UI_From_Int (System_Max_Binary_Modulus_Power));
          end if;
 
          if not Non_Binary_Modulus (T) and then Esize (T) = RM_Size (T) then
@@ -19850,7 +19850,7 @@ package body Sem_Ch3 is
 
       Set_Etype (T, T);
       Mutate_Ekind (T, E_Modular_Integer_Type);
-      Init_Alignment (T);
+      Reinit_Alignment (T);
       Set_Is_Constrained (T);
 
       if not Is_OK_Static_Expression (Mod_Expr) then
@@ -19929,7 +19929,7 @@ package body Sem_Ch3 is
       Error_Msg_F ("modulus exceeds limit (2 '*'*^)", Mod_Expr);
 
       Set_Modular_Size (System_Max_Binary_Modulus_Power);
-      Init_Alignment (T);
+      Reinit_Alignment (T);
 
    end Modular_Type_Declaration;
 
@@ -20251,7 +20251,7 @@ package body Sem_Ch3 is
 
       Mutate_Ekind           (T, E_Ordinary_Fixed_Point_Subtype);
       Set_Etype              (T, Implicit_Base);
-      Init_Size_Align        (T);
+      Reinit_Size_Align      (T);
       Inherit_Rep_Item_Chain (T, Implicit_Base);
       Set_Small_Value        (T, Small_Val);
       Set_Delta_Value        (T, Delta_Val);
@@ -20653,8 +20653,8 @@ package body Sem_Ch3 is
          end if;
 
          Mutate_Ekind (Id, E_Discriminant);
-         Init_Component_Location (Id);
-         Init_Esize (Id);
+         Reinit_Component_Location (Id);
+         Reinit_Esize (Id);
          Set_Discriminant_Number (Id, Discr_Number);
 
          --  Make sure this is always set, even in illegal programs
@@ -22322,7 +22322,7 @@ package body Sem_Ch3 is
 
       Mutate_Ekind          (T, E_Record_Type);
       Set_Etype             (T, T);
-      Init_Size_Align       (T);
+      Reinit_Size_Align     (T);
       Set_Interfaces        (T, No_Elist);
       Set_Stored_Constraint (T, No_Elist);
       Set_Default_SSO       (T);
@@ -22431,7 +22431,7 @@ package body Sem_Ch3 is
             Set_Etype                     (Tag_Comp, RTE (RE_Tag));
             Set_DT_Entry_Count            (Tag_Comp, No_Uint);
             Set_Original_Record_Component (Tag_Comp, Tag_Comp);
-            Init_Component_Location       (Tag_Comp);
+            Reinit_Component_Location     (Tag_Comp);
 
             --  Ada 2005 (AI-251): Addition of the Tag corresponding to all the
             --  implemented interfaces.
@@ -22535,7 +22535,7 @@ package body Sem_Ch3 is
            and then not Is_Itype (Component)
          then
             Mutate_Ekind (Component, E_Component);
-            Init_Component_Location (Component);
+            Reinit_Component_Location (Component);
          end if;
 
          Propagate_Concurrent_Flags (T, Etype (Component));
index 30eade2cb3b8eb20f4332e743df78df8c0502500..5b38c7da4d76f932325ce15c17108b7eaf9bf611 100644 (file)
@@ -1896,7 +1896,7 @@ package body Sem_Ch7 is
    begin
       Generate_Definition (Id);
       Set_Is_Pure         (Id, PF);
-      Init_Size_Align     (Id);
+      Reinit_Size_Align   (Id);
 
       if not Is_Package_Or_Generic_Package (Current_Scope)
         or else In_Private_Part (Current_Scope)
@@ -2573,7 +2573,7 @@ package body Sem_Ch7 is
       Set_Etype              (Id, Id);
       Set_Has_Delayed_Freeze (Id);
       Set_Is_First_Subtype   (Id);
-      Init_Size_Align        (Id);
+      Reinit_Size_Align      (Id);
 
       Set_Is_Constrained (Id,
         No (Discriminant_Specifications (N))
index 78d2426610cdef34bcccc4b0a5675adfb6ceb2ff..a9f0f13e1e2a7ac40c4599ef76297ea845c9c217 100644 (file)
@@ -1461,7 +1461,7 @@ package body Sem_Ch8 is
          Mutate_Ekind (Id, E_Variable);
       end if;
 
-      Init_Object_Size_Align (Id);
+      Reinit_Object_Size_Align (Id);
 
       --  If N comes from source then check that the original node is an
       --  object reference since there may have been several rewritting and
index ab25dd0143a929197c8cf57007f7b7487855ef67..5293efb8beb8725d5a7fcc69f4c793dd6127c7e7 100644 (file)
@@ -2024,7 +2024,7 @@ package body Sem_Ch9 is
 
       Mutate_Ekind           (T, E_Protected_Type);
       Set_Is_First_Subtype   (T);
-      Init_Size_Align        (T);
+      Reinit_Size_Align      (T);
       Set_Etype              (T, T);
       Set_Has_Delayed_Freeze (T);
       Set_Stored_Constraint  (T, No_Elist);
@@ -2143,7 +2143,7 @@ package body Sem_Ch9 is
       while Present (E) loop
          if Ekind (E) = E_Void then
             Mutate_Ekind (E, E_Component);
-            Init_Component_Location (E);
+            Reinit_Component_Location (E);
          end if;
 
          Next_Entity (E);
@@ -3151,7 +3151,7 @@ package body Sem_Ch9 is
       Mutate_Ekind           (T, E_Task_Type);
       Set_Is_First_Subtype   (T, True);
       Set_Has_Task           (T, True);
-      Init_Size_Align        (T);
+      Reinit_Size_Align      (T);
       Set_Etype              (T, T);
       Set_Has_Delayed_Freeze (T, True);
       Set_Stored_Constraint  (T, No_Elist);
index 78af03720cf6d815be611416d4035cd84aa38434..9cad55d9cc23233fa218540e34f5dfbe72826dc2 100644 (file)
@@ -7562,7 +7562,7 @@ package body Sem_Prag is
             end if;
 
             if not Has_Alignment_Clause (Ent) then
-               Init_Alignment (Ent);
+               Reinit_Alignment (Ent);
             end if;
          end Set_Atomic_VFA;
 
index 78cf674aee34eeb6e13a7864b5b0af4dd682cb5f..a3d6ff81439bfe916640ebff62236f125503964c 100644 (file)
@@ -24986,7 +24986,7 @@ package body Sem_Util is
       Set_Public_Status (N);
 
       if Kind in Type_Kind then
-         Init_Size_Align (N);
+         Reinit_Size_Align (N);
       end if;
 
       return N;
@@ -25010,7 +25010,7 @@ package body Sem_Util is
       Append_Entity   (N, Scope_Id);
 
       if Kind in Type_Kind then
-         Init_Size_Align (N);
+         Reinit_Size_Align (N);
       end if;
 
       return N;
index 5f596070042a4e29243ea53c64b5f32c2a907736..62a1c4f59608be6c7d3c9a6b13f325726a688832 100644 (file)
@@ -25,7 +25,7 @@
 
 --  This package contains constants describing target properties
 
-with Types;    use Types;
+with Types; use Types;
 with Set_Targ;
 
 package Ttypes is
index b2f2315effe2b9b06a21e7abae7070f1aaa21b93..70caf490f75019345b451b78099d897960280397 100644 (file)
@@ -92,7 +92,7 @@ package Uintp is
 
    subtype Valid_Uint is Uint with Predicate => Valid_Uint /= No_Uint;
    subtype Unat is Valid_Uint with Predicate => Unat >= Uint_0;
-   subtype Upos is Valid_Uint with Predicate => Upos >= Uint_0;
+   subtype Upos is Valid_Uint with Predicate => Upos >= Uint_1;
    subtype Nonzero_Uint is Valid_Uint with Predicate => Nonzero_Uint /= Uint_0;
 
    type UI_Vector is array (Pos range <>) of Int;