aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/einfo-utils.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2021-06-27 11:03:20 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-09-20 12:31:35 +0000
commit8e5a8832632eecf5786dff295d073938aeb6d6d8 (patch)
tree151ee136e01c3cd355f2094f034674a75fabf25b /gcc/ada/einfo-utils.adb
parente97dd2ae763d8c1e78c3b82fc2add4c078fb2357 (diff)
downloadgcc-8e5a8832632eecf5786dff295d073938aeb6d6d8.zip
gcc-8e5a8832632eecf5786dff295d073938aeb6d6d8.tar.gz
gcc-8e5a8832632eecf5786dff295d073938aeb6d6d8.tar.bz2
[Ada] Clean up Uint fields, remove unused routines
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.
Diffstat (limited to 'gcc/ada/einfo-utils.adb')
-rw-r--r--gcc/ada/einfo-utils.adb277
1 files changed, 98 insertions, 179 deletions
diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb
index 4690c8f..5782bd6 100644
--- a/gcc/ada/einfo-utils.adb
+++ b/gcc/ada/einfo-utils.adb
@@ -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 --