diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/atree.adb | 241 | ||||
-rw-r--r-- | gcc/ada/atree.ads | 35 | ||||
-rw-r--r-- | gcc/ada/debug.adb | 5 | ||||
-rw-r--r-- | gcc/ada/gen_il-fields.ads | 14 | ||||
-rw-r--r-- | gcc/ada/gen_il-gen.adb | 290 | ||||
-rw-r--r-- | gcc/ada/gen_il-internals.adb | 2 | ||||
-rw-r--r-- | gcc/ada/gen_il-internals.ads | 340 | ||||
-rw-r--r-- | gcc/ada/impunit.adb | 16 | ||||
-rw-r--r-- | gcc/ada/sinfo-utils.adb | 2 | ||||
-rw-r--r-- | gcc/ada/table.ads | 2 | ||||
-rw-r--r-- | gcc/ada/types.ads | 4 |
11 files changed, 590 insertions, 361 deletions
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index ce92548..98614e8 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -211,10 +211,6 @@ package body Atree is (Old_N : Entity_Id; New_Kind : Entity_Kind); -- Above are the same as the ones for nodes, but for entities - procedure Update_Kind_Statistics (Field : Node_Or_Entity_Field); - -- Increment Set_Count (Field). This is in a procedure so we can put it in - -- pragma Debug for efficiency. - procedure Init_Nkind (N : Node_Id; Val : Node_Kind); -- Initialize the Nkind field, which must not have been set already. This -- cannot be used to modify an already-initialized Nkind field. See also @@ -639,7 +635,7 @@ package body Atree is -- S is the slot at that offset. V is the amount to shift by. function In_NH (Slot_Off : Field_Offset) return Boolean is - (Slot_Off < Seinfo.N_Head); + (Slot_Off < N_Head); -- In_NH stands for "in Node_Header", not "in New Hampshire" function Get_Slot @@ -648,8 +644,13 @@ package body Atree is (if In_NH (Slot_Off) then Node_Offsets.Table (N).Slots (Slot_Off) else Slots.Table (Node_Offsets.Table (N).Offset + Slot_Off)); - -- Get the slot, either directly from the node header, or indirectly - -- from the Slots table. + -- Get the slot value, either directly from the node header, or + -- indirectly from the Slots table. + + procedure Set_Slot + (N : Node_Or_Entity_Id; Slot_Off : Field_Offset; S : Slot); + -- Set the slot value, either directly from the node header, or + -- indirectly from the Slots table, to S. function Get_1_Bit_Val (N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Size_1_Bit @@ -730,13 +731,15 @@ package body Atree is return Raw; end Get_32_Bit_Val; - type Slot_Ptr is access all Slot; - function Get_Slot_Ptr - (N : Node_Or_Entity_Id; Slot_Off : Field_Offset) - return Slot_Ptr is - (if In_NH (Slot_Off) then - Node_Offsets.Table (N).Slots (Slot_Off)'Access - else Slots.Table (Node_Offsets.Table (N).Offset + Slot_Off)'Access); + procedure Set_Slot + (N : Node_Or_Entity_Id; Slot_Off : Field_Offset; S : Slot) is + begin + if In_NH (Slot_Off) then + Node_Offsets.Table (N).Slots (Slot_Off) := S; + else + Slots.Table (Node_Offsets.Table (N).Offset + Slot_Off) := S; + end if; + end Set_Slot; procedure Set_1_Bit_Val (N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Size_1_Bit) @@ -745,12 +748,13 @@ package body Atree is Mask : constant := 2**F_Size - 1; F_Per_Slot : constant Field_Offset := Slot_Size / F_Size; Slot_Off : constant Field_Offset := Offset / F_Per_Slot; - Ptr : constant Slot_Ptr := Get_Slot_Ptr (N, Slot_Off); - S : Slot renames Ptr.all; + S : constant Slot := Get_Slot (N, Slot_Off); V : constant Natural := Natural ((Offset mod F_Per_Slot) * F_Size); pragma Debug (Validate_Node_And_Offset_Write (N, Slot_Off)); begin - S := (S and not Shift_Left (Mask, V)) or Shift_Left (Slot (Val), V); + Set_Slot + (N, Slot_Off, + (S and not Shift_Left (Mask, V)) or Shift_Left (Slot (Val), V)); end Set_1_Bit_Val; procedure Set_2_Bit_Val @@ -760,12 +764,13 @@ package body Atree is Mask : constant := 2**F_Size - 1; F_Per_Slot : constant Field_Offset := Slot_Size / F_Size; Slot_Off : constant Field_Offset := Offset / F_Per_Slot; - Ptr : constant Slot_Ptr := Get_Slot_Ptr (N, Slot_Off); - S : Slot renames Ptr.all; + S : constant Slot := Get_Slot (N, Slot_Off); V : constant Natural := Natural ((Offset mod F_Per_Slot) * F_Size); pragma Debug (Validate_Node_And_Offset_Write (N, Slot_Off)); begin - S := (S and not Shift_Left (Mask, V)) or Shift_Left (Slot (Val), V); + Set_Slot + (N, Slot_Off, + (S and not Shift_Left (Mask, V)) or Shift_Left (Slot (Val), V)); end Set_2_Bit_Val; procedure Set_4_Bit_Val @@ -775,12 +780,13 @@ package body Atree is Mask : constant := 2**F_Size - 1; F_Per_Slot : constant Field_Offset := Slot_Size / F_Size; Slot_Off : constant Field_Offset := Offset / F_Per_Slot; - Ptr : constant Slot_Ptr := Get_Slot_Ptr (N, Slot_Off); - S : Slot renames Ptr.all; + S : constant Slot := Get_Slot (N, Slot_Off); V : constant Natural := Natural ((Offset mod F_Per_Slot) * F_Size); pragma Debug (Validate_Node_And_Offset_Write (N, Slot_Off)); begin - S := (S and not Shift_Left (Mask, V)) or Shift_Left (Slot (Val), V); + Set_Slot + (N, Slot_Off, + (S and not Shift_Left (Mask, V)) or Shift_Left (Slot (Val), V)); end Set_4_Bit_Val; procedure Set_8_Bit_Val @@ -790,26 +796,25 @@ package body Atree is Mask : constant := 2**F_Size - 1; F_Per_Slot : constant Field_Offset := Slot_Size / F_Size; Slot_Off : constant Field_Offset := Offset / F_Per_Slot; - Ptr : constant Slot_Ptr := Get_Slot_Ptr (N, Slot_Off); - S : Slot renames Ptr.all; + S : constant Slot := Get_Slot (N, Slot_Off); V : constant Natural := Natural ((Offset mod F_Per_Slot) * F_Size); pragma Debug (Validate_Node_And_Offset_Write (N, Slot_Off)); begin - S := (S and not Shift_Left (Mask, V)) or Shift_Left (Slot (Val), V); + Set_Slot + (N, Slot_Off, + (S and not Shift_Left (Mask, V)) or Shift_Left (Slot (Val), V)); end Set_8_Bit_Val; procedure Set_32_Bit_Val (N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Size_32_Bit) is F_Size : constant := 32; - -- No Mask needed + -- No Mask needed; this one doesn't do read-modify-write F_Per_Slot : constant Field_Offset := Slot_Size / F_Size; Slot_Off : constant Field_Offset := Offset / F_Per_Slot; - Ptr : constant Slot_Ptr := Get_Slot_Ptr (N, Slot_Off); - S : Slot renames Ptr.all; pragma Debug (Validate_Node_And_Offset_Write (N, Slot_Off)); begin - S := Slot (Val); + Set_Slot (N, Slot_Off, Slot (Val)); end Set_32_Bit_Val; ---------------------- @@ -836,9 +841,9 @@ package body Atree is end Atree_Private_Part; - --------------- - -- Set_Field -- - --------------- + --------------------- + -- Get_Field_Value -- + --------------------- function Get_Node_Field_Union is new Get_32_Bit_Field (Union_Id) with Inline; @@ -848,10 +853,10 @@ package body Atree is function Get_Field_Value (N : Node_Id; Field : Node_Or_Entity_Field) return Field_Size_32_Bit is - Desc : Seinfo.Field_Descriptor renames Field_Descriptors (Field); + Desc : Field_Descriptor renames Field_Descriptors (Field); begin - case Seinfo.Field_Size (Desc.Kind) is + case Field_Size (Desc.Kind) is when 1 => return Field_Size_32_Bit (Get_1_Bit_Val (N, Desc.Offset)); when 2 => return Field_Size_32_Bit (Get_2_Bit_Val (N, Desc.Offset)); when 4 => return Field_Size_32_Bit (Get_4_Bit_Val (N, Desc.Offset)); @@ -860,13 +865,17 @@ package body Atree is end case; end Get_Field_Value; + --------------------- + -- Set_Field_Value -- + --------------------- + procedure Set_Field_Value (N : Node_Id; Field : Node_Or_Entity_Field; Val : Field_Size_32_Bit) is - Desc : Seinfo.Field_Descriptor renames Field_Descriptors (Field); + Desc : Field_Descriptor renames Field_Descriptors (Field); begin - case Seinfo.Field_Size (Desc.Kind) is + case Field_Size (Desc.Kind) is when 1 => Set_1_Bit_Val (N, Desc.Offset, Field_Size_1_Bit (Val)); when 2 => Set_2_Bit_Val (N, Desc.Offset, Field_Size_2_Bit (Val)); when 4 => Set_4_Bit_Val (N, Desc.Offset, Field_Size_4_Bit (Val)); @@ -974,17 +983,15 @@ package body Atree is Nkind_Offset : constant Field_Offset := Field_Descriptors (F_Nkind).Offset; - procedure Update_Kind_Statistics (Field : Node_Or_Entity_Field) is - begin - Set_Count (Field) := Set_Count (Field) + 1; - end Update_Kind_Statistics; - procedure Set_Node_Kind_Type is new Set_8_Bit_Field (Node_Kind) with Inline; procedure Init_Nkind (N : Node_Id; Val : Node_Kind) is pragma Assert (Field_Is_Initial_Zero (N, F_Nkind)); begin - pragma Debug (Update_Kind_Statistics (F_Nkind)); + if Atree_Statistics_Enabled then + Set_Count (F_Nkind) := Set_Count (F_Nkind) + 1; + end if; + Set_Node_Kind_Type (N, Nkind_Offset, Val); end Init_Nkind; @@ -1016,7 +1023,7 @@ package body Atree is declare New_Off_F : constant Node_Offset := Alloc_Slots (New_Size); begin - All_Node_Offsets (N).Offset := New_Off_F - Seinfo.N_Head; + All_Node_Offsets (N).Offset := New_Off_F - N_Head; Copy_Dynamic_Slots (Old_Off_F, New_Off_F, Old_Size); pragma Debug (Zero_Dynamic_Slots (Old_Off_F, Old_Off_F + Old_Size - 1)); @@ -1027,7 +1034,10 @@ package body Atree is Zero_Dynamic_Slots (Off_F (N) + Old_Size, Slots.Last); end if; - pragma Debug (Update_Kind_Statistics (F_Nkind)); + if Atree_Statistics_Enabled then + Set_Count (F_Nkind) := Set_Count (F_Nkind) + 1; + end if; + Set_Node_Kind_Type (N, Nkind_Offset, Val); pragma Debug (Validate_Node_Write (N)); @@ -1060,7 +1070,10 @@ package body Atree is -- For now, we are allocating all entities with the same size, so we -- don't need to reallocate slots here. - pragma Debug (Update_Kind_Statistics (F_Ekind)); + if Atree_Statistics_Enabled then + Set_Count (F_Nkind) := Set_Count (F_Ekind) + 1; + end if; + Set_Entity_Kind_Type (N, Ekind_Offset, Val); pragma Debug (Validate_Node_Write (N)); @@ -1078,7 +1091,7 @@ package body Atree is Sz : constant Slot_Count := Size_In_Slots_To_Alloc (Kind); Sl : constant Node_Offset := Alloc_Slots (Sz); begin - Node_Offsets.Table (Result).Offset := Sl - Seinfo.N_Head; + Node_Offsets.Table (Result).Offset := Sl - N_Head; Zero_Dynamic_Slots (Sl, Sl + Sz - 1); Zero_Header_Slots (Result); end; @@ -1141,7 +1154,7 @@ package body Atree is New_Offset : constant Field_Offset := Alloc_Slots (New_Size); begin pragma Debug (Zero_Slots (N)); - Node_Offsets.Table (N).Offset := New_Offset - Seinfo.N_Head; + Node_Offsets.Table (N).Offset := New_Offset - N_Head; Zero_Dynamic_Slots (New_Offset, New_Offset + New_Size - 1); Zero_Header_Slots (N); end; @@ -1229,7 +1242,7 @@ package body Atree is if D_Size < S_Size then pragma Debug (Zero_Slots (Destination)); -- destroy old slots Node_Offsets.Table (Destination).Offset := - Alloc_Slots (S_Size) - Seinfo.N_Head; + Alloc_Slots (S_Size) - N_Head; end if; Copy_Slots (Source, Destination); @@ -1447,7 +1460,7 @@ package body Atree is (Is_Entity (E1) and then Is_Entity (E2) and then not In_List (E1) and then not In_List (E2)); - Old_E1 : constant Seinfo.Node_Header := Node_Offsets.Table (E1); + Old_E1 : constant Node_Header := Node_Offsets.Table (E1); begin Node_Offsets.Table (E1) := Node_Offsets.Table (E2); @@ -1546,7 +1559,6 @@ package body Atree is begin for J in Fields'Range loop declare - use Seinfo; Desc : Field_Descriptor renames Field_Descriptors (Fields (J)); begin if Desc.Kind in Node_Id_Field | List_Id_Field then @@ -1698,7 +1710,7 @@ package body Atree is return New_Id : constant Node_Id := Alloc_Node_Id do Node_Offsets.Table (New_Id).Offset := - Alloc_Slots (S_Size) - Seinfo.N_Head; + Alloc_Slots (S_Size) - N_Head; Orig_Nodes.Append (New_Id); Copy_Slots (Source, New_Id); @@ -1858,7 +1870,7 @@ package body Atree is function Off_F (N : Node_Id) return Node_Offset is begin - return Off_0 (N) + Seinfo.N_Head; + return Off_0 (N) + N_Head; end Off_F; ----------- @@ -1881,6 +1893,9 @@ package body Atree is function Original_Node (Node : Node_Id) return Node_Id is begin pragma Debug (Validate_Node (Node)); + if Atree_Statistics_Enabled then + Get_Original_Node_Count := Get_Original_Node_Count + 1; + end if; return Orig_Nodes.Table (Node); end Original_Node; @@ -2176,6 +2191,9 @@ package body Atree is procedure Set_Original_Node (N : Node_Id; Val : Node_Id) is begin pragma Debug (Validate_Node_Write (N)); + if Atree_Statistics_Enabled then + Set_Original_Node_Count := Set_Original_Node_Count + 1; + end if; Orig_Nodes.Table (N) := Val; end Set_Original_Node; @@ -2271,7 +2289,7 @@ package body Atree is begin return (if Kind in N_Entity then Einfo.Entities.Max_Entity_Size - else Sinfo.Nodes.Size (Kind)) - Seinfo.N_Head; + else Sinfo.Nodes.Size (Kind)) - N_Head; -- Unfortunately, we don't know the Entity_Kind, so we have to use the -- max. end Size_In_Slots_To_Alloc; @@ -2300,7 +2318,7 @@ package body Atree is function Size_In_Slots_Dynamic (N : Node_Or_Entity_Id) return Slot_Count is begin - return Size_In_Slots (N) - Seinfo.N_Head; + return Size_In_Slots (N) - N_Head; end Size_In_Slots_Dynamic; ------------------- @@ -2492,9 +2510,104 @@ package body Atree is -- Print_Statistics -- ---------------------- - procedure Print_Statistics is + procedure Print_Node_Statistics; + procedure Print_Field_Statistics; + -- Helpers for Print_Statistics + + procedure Write_Ratio (X : Nat_64; Y : Pos_64); + -- Write the value of (X/Y) without using 'Image (approximately) + + procedure Write_Ratio (X : Nat_64; Y : Pos_64) is + pragma Assert (X <= Y); + Ratio : constant Nat := Nat ((Long_Float (X) / Long_Float (Y)) * 1000.0); + begin + Write_Str (" ("); + + if Ratio = 0 then + Write_Str ("0.000"); + elsif Ratio in 1 .. 9 then + Write_Str ("0.00"); + Write_Int (Ratio); + elsif Ratio in 10 .. 99 then + Write_Str ("0.0"); + Write_Int (Ratio); + elsif Ratio in 100 .. 999 then + Write_Str ("0."); + Write_Int (Ratio); + else + Write_Int (Ratio / 1000); + end if; + + Write_Str (")"); + end Write_Ratio; + + procedure Print_Node_Statistics is + subtype Count is Nat_64; + Node_Counts : array (Node_Kind) of Count := (others => 0); + Entity_Counts : array (Entity_Kind) of Count := (others => 0); + + All_Node_Offsets : Node_Offsets.Table_Type renames + Node_Offsets.Table (Node_Offsets.First .. Node_Offsets.Last); + begin + Write_Int (Int (Node_Offsets.Last)); + Write_Line (" nodes (including entities)"); + Write_Int (Int (Slots.Last)); + Write_Line (" non-header slots"); + + for N in All_Node_Offsets'Range loop + declare + K : constant Node_Kind := Nkind (N); + + begin + Node_Counts (K) := Node_Counts (K) + 1; + + if K in N_Entity then + Entity_Counts (Ekind (N)) := Entity_Counts (Ekind (N)) + 1; + end if; + end; + end loop; + + for K in Node_Kind loop + declare + Count : constant Nat_64 := Node_Counts (K); + begin + Write_Int_64 (Count); + Write_Ratio (Count, Int_64 (Node_Offsets.Last)); + Write_Str (" "); + Write_Str (Node_Kind'Image (K)); + Write_Str (" "); + Write_Int (Int (Sinfo.Nodes.Size (K))); + Write_Str (" slots"); + Write_Eol; + end; + end loop; + + for K in Entity_Kind loop + declare + Count : constant Nat_64 := Entity_Counts (K); + begin + Write_Int_64 (Count); + Write_Ratio (Count, Int_64 (Node_Offsets.Last)); + Write_Str (" "); + Write_Str (Entity_Kind'Image (K)); + Write_Str (" "); + Write_Int (Int (Einfo.Entities.Size (K))); + Write_Str (" slots"); + Write_Eol; + end; + end loop; + end Print_Node_Statistics; + + procedure Print_Field_Statistics is Total, G_Total, S_Total : Call_Count := 0; begin + Write_Int_64 (Get_Original_Node_Count); + Write_Str (" + "); + Write_Int_64 (Set_Original_Node_Count); + Write_Eol; + Write_Line (" Original_Node_Count getter and setter calls"); + Write_Eol; + Write_Line ("Frequency of field getter and setter calls:"); for Field in Node_Or_Entity_Field loop @@ -2520,19 +2633,13 @@ package body Atree is S : constant Call_Count := Set_Count (Field); GS : constant Call_Count := G + S; - Percent : constant Int := - Int ((Long_Float (GS) / Long_Float (Total)) * 100.0); - - use Seinfo; Desc : Field_Descriptor renames Field_Descriptors (Field); Slot : constant Field_Offset := (Field_Size (Desc.Kind) * Desc.Offset) / Slot_Size; begin Write_Int_64 (GS); - Write_Str (" ("); - Write_Int (Percent); - Write_Str ("%)"); + Write_Ratio (GS, Total); Write_Str (" = "); Write_Int_64 (G); Write_Str (" + "); @@ -2546,6 +2653,14 @@ package body Atree is Write_Eol; end; end loop; + end Print_Field_Statistics; + + procedure Print_Statistics is + begin + Write_Eol; + Write_Eol; + Print_Node_Statistics; + Print_Field_Statistics; end Print_Statistics; end Atree; diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads index 7120ecf..2f3ca40 100644 --- a/gcc/ada/atree.ads +++ b/gcc/ada/atree.ads @@ -48,7 +48,7 @@ with Alloc; with Sinfo.Nodes; use Sinfo.Nodes; with Einfo.Entities; use Einfo.Entities; with Types; use Types; -with Seinfo; +with Seinfo; use Seinfo; with System; use System; with Table; with Unchecked_Conversion; @@ -653,11 +653,30 @@ package Atree is -- table. We use zero-origin addressing, so the Offset into the Slots -- table will point 3 slots before slot 3. - pragma Assert (Seinfo.N_Head <= Min_Node_Size); - pragma Assert (Seinfo.N_Head <= Min_Entity_Size); + pragma Assert (N_Head <= Min_Node_Size); + pragma Assert (N_Head <= Min_Entity_Size); + + Slot_Size : constant := 32; + type Slot is mod 2**Slot_Size; + for Slot'Size use Slot_Size; + + -- The type Slot is defined in Types as a 32-bit modular integer. It + -- is logically split into the appropriate numbers of components of + -- appropriate size, but this splitting is not explicit because packed + -- arrays cannot be properly interfaced in C/C++ and packed records are + -- way too slow. + + type Node_Header_Slots is + array (Field_Offset range 0 .. N_Head - 1) of Slot; + type Node_Header is record + Slots : Node_Header_Slots; + Offset : Node_Offset'Base; + end record; + pragma Assert (Node_Header'Size = (N_Head + 1) * Slot_Size); + pragma Assert (Node_Header'Size = 16 * 8); package Node_Offsets is new Table.Table - (Table_Component_Type => Seinfo.Node_Header, + (Table_Component_Type => Node_Header, Table_Index_Type => Node_Id'Base, Table_Low_Bound => First_Node_Id, Table_Initial => Alloc.Node_Offsets_Initial, @@ -671,12 +690,6 @@ package Atree is -- Short names for use in gdb, not used in real code. Note that gdb -- can't find Node_Offsets.Table without a full expanded name. - -- The type Slot is defined in Types as a 32-bit modular integer. It - -- is logically split into the appropriate numbers of components of - -- appropriate size, but this splitting is not explicit because packed - -- arrays cannot be properly interfaced in C/C++ and packed records are - -- way too slow. - function Shift_Left (S : Slot; V : Natural) return Slot; pragma Import (Intrinsic, Shift_Left); @@ -870,6 +883,8 @@ package Atree is -- Number of calls to each getter and setter. See documentaton for -- -gnatd.A. + Get_Original_Node_Count, Set_Original_Node_Count : Call_Count := 0; + procedure Print_Statistics; end Atree; diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 2c07e94..7b2b147 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -831,8 +831,9 @@ package body Debug is -- targets that do not use the GCC back end, this switch is ignored. -- d.A Enable statistics printing in Atree. First set Statistics_Enabled - -- in gen_il-gen.adb to True, then rebuild, then run the compiler with - -- -gnatd.A. You might want to apply "sort -nr" to the output. + -- in gen_il-gen.adb to True, then rebuild, then run the compiler + -- with -gnatd.A. You might want to apply "sort -nr" to parts of the + -- output. -- d.B Generate a bug box when we see an abort_statement, even though -- there is no bug. Useful for testing Comperr.Compiler_Abort: write diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index 24f57b4..f8bfe6e 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -23,8 +23,6 @@ -- -- ------------------------------------------------------------------------------ -with Gen_IL.Types; - package Gen_IL.Fields is -- The following is "optional field enumeration" -- i.e. it is Field_Enum @@ -36,8 +34,7 @@ package Gen_IL.Fields is -- which might need to be kept in sync when modifying this. -- Be sure to put new fields in the appropriate subrange (Field_Enum, - -- Node_Header_Field, Node_Field, Entity_Field -- search for comments - -- below). + -- Node_Field, Entity_Field -- search for comments below). type Opt_Field_Enum is (No_Field, @@ -943,13 +940,4 @@ package Gen_IL.Fields is -- Enumeration of fields -- Opt_Field_Enum without the special null value -- No_Field. - subtype Node_Header_Field is Field_Enum with Predicate => - Node_Header_Field in Nkind .. Link | Ekind; - - use Gen_IL.Types; - - subtype Node_Header_Type is Type_Enum range - Node_Kind_Type .. Union_Id; - -- Types of node header fields - end Gen_IL.Fields; diff --git a/gcc/ada/gen_il-gen.adb b/gcc/ada/gen_il-gen.adb index dd8487d..305a99a 100644 --- a/gcc/ada/gen_il-gen.adb +++ b/gcc/ada/gen_il-gen.adb @@ -503,8 +503,6 @@ package body Gen_IL.Gen is Min_Entity_Size : Field_Offset := Field_Offset'Last; Max_Entity_Size : Field_Offset := 0; - Average_Node_Size_In_Slots : Long_Float; - Node_Field_Types_Used, Entity_Field_Types_Used : Type_Set; Setter_Needs_Parent : Field_Set := @@ -1001,16 +999,16 @@ package body Gen_IL.Gen is Image (Gen_IL.Internals.Bit_Offset'Last) & " is too small)"; end Choose_Offset; - Num_Concrete_Have_Field : array (Field_Enum) of Type_Count := + Weighted_Node_Frequency : array (Field_Enum) of Type_Count := (others => 0); -- Number of concrete types that have each field function More_Types_Have_Field (F1, F2 : Field_Enum) return Boolean is - (Num_Concrete_Have_Field (F1) > Num_Concrete_Have_Field (F2)); + (Weighted_Node_Frequency (F1) > Weighted_Node_Frequency (F2)); -- True if F1 appears in more concrete types than F2 function Sort_Less (F1, F2 : Field_Enum) return Boolean is - (if Num_Concrete_Have_Field (F1) = Num_Concrete_Have_Field (F2) then + (if Weighted_Node_Frequency (F1) = Weighted_Node_Frequency (F2) then F1 < F2 else More_Types_Have_Field (F1, F2)); @@ -1019,15 +1017,18 @@ package body Gen_IL.Gen is All_Fields : Field_Vector; + -- Start of processing for Compute_Field_Offsets + begin - -- Compute the number of types that have each field + -- Compute the number of types that have each field, weighted by the + -- frequency of such nodes. for T in Concrete_Type loop for F in Field_Enum loop if Fields_Per_Node (T) (F) then - Num_Concrete_Have_Field (F) := - Num_Concrete_Have_Field (F) + 1; + Weighted_Node_Frequency (F) := + Weighted_Node_Frequency (F) + Type_Frequency (T); end if; end loop; end loop; @@ -1042,13 +1043,6 @@ package body Gen_IL.Gen is Append (All_Fields, F); end loop; - -- Force Homonym to be at offset zero, which speeds up the - -- compiler. The Sort below will place Homonym first in - -- All_Fields. - - Num_Concrete_Have_Field (Homonym) := - Num_Concrete_Have_Field (Nkind) + 1; - -- Sort All_Fields based on how many concrete types have the field. -- This is for efficiency; we want to choose the offsets of the most -- common fields first, so they get low numbers. @@ -1069,7 +1063,22 @@ package body Gen_IL.Gen is -- get low offsets, so they will wind up in the node header for -- faster access. + Choose_Offset (Nkind); + pragma Assert (Field_Table (Nkind).Offset = 0); + Choose_Offset (Ekind); + pragma Assert (Field_Table (Ekind).Offset = 1); Choose_Offset (Homonym); + pragma Assert (Field_Table (Homonym).Offset = 1); + Choose_Offset (Is_Immediately_Visible); + pragma Assert (Field_Table (Is_Immediately_Visible).Offset = 16); + Choose_Offset (From_Limited_With); + pragma Assert (Field_Table (From_Limited_With).Offset = 17); + Choose_Offset (Is_Potentially_Use_Visible); + pragma Assert (Field_Table (Is_Potentially_Use_Visible).Offset = 18); + Choose_Offset (Is_Generic_Instance); + pragma Assert (Field_Table (Is_Generic_Instance).Offset = 19); + Choose_Offset (Scope); + pragma Assert (Field_Table (Scope).Offset = 2); -- Then loop through them all, skipping the ones we did above @@ -1086,231 +1095,6 @@ package body Gen_IL.Gen is ------------------------ procedure Compute_Type_Sizes is - -- Node_Counts is the number of nodes of each kind created during - -- compilation of a large example. This is used purely to compute an - -- estimate of the average node size. New node types can default to - -- "others => 0". At some point we can instrument Atree to print out - -- accurate size statistics, and remove this code. - - Node_Counts : constant array (Concrete_Node) of Natural := - (N_Identifier => 429298, - N_Defining_Identifier => 231636, - N_Integer_Literal => 90892, - N_Parameter_Specification => 62811, - N_Attribute_Reference => 47150, - N_Expanded_Name => 37375, - N_Selected_Component => 30699, - N_Subprogram_Declaration => 20744, - N_Freeze_Entity => 20314, - N_Procedure_Specification => 18901, - N_Object_Declaration => 18023, - N_Function_Specification => 16570, - N_Range => 16216, - N_Explicit_Dereference => 12198, - N_Component_Association => 11188, - N_Unchecked_Type_Conversion => 11165, - N_Subtype_Indication => 10727, - N_Procedure_Call_Statement => 10056, - N_Subtype_Declaration => 8141, - N_Handled_Sequence_Of_Statements => 8078, - N_Null => 7288, - N_Aggregate => 7222, - N_String_Literal => 7152, - N_Function_Call => 6958, - N_Simple_Return_Statement => 6911, - N_And_Then => 6867, - N_Op_Eq => 6845, - N_Call_Marker => 6683, - N_Pragma_Argument_Association => 6525, - N_Component_Definition => 6487, - N_Assignment_Statement => 6483, - N_With_Clause => 6480, - N_Null_Statement => 5917, - N_Index_Or_Discriminant_Constraint => 5877, - N_Generic_Association => 5667, - N_Full_Type_Declaration => 5573, - N_If_Statement => 5553, - N_Subprogram_Body => 5455, - N_Op_Add => 5443, - N_Type_Conversion => 5260, - N_Component_Declaration => 5059, - N_Raise_Constraint_Error => 4840, - N_Formal_Concrete_Subprogram_Declaration => 4602, - N_Expression_With_Actions => 4598, - N_Op_Ne => 3854, - N_Indexed_Component => 3834, - N_Op_Subtract => 3777, - N_Package_Specification => 3490, - N_Subprogram_Renaming_Declaration => 3445, - N_Pragma => 3427, - N_Case_Statement_Alternative => 3272, - N_Block_Statement => 3239, - N_Parameter_Association => 3213, - N_Op_Lt => 3020, - N_Op_Not => 2926, - N_Character_Literal => 2914, - N_Others_Choice => 2769, - N_Or_Else => 2576, - N_Itype_Reference => 2511, - N_Defining_Operator_Symbol => 2487, - N_Component_List => 2470, - N_Formal_Object_Declaration => 2262, - N_Generic_Subprogram_Declaration => 2227, - N_Real_Literal => 2156, - N_Op_Gt => 2156, - N_Access_To_Object_Definition => 1984, - N_Op_Le => 1975, - N_Op_Ge => 1942, - N_Package_Renaming_Declaration => 1811, - N_Formal_Type_Declaration => 1756, - N_Qualified_Expression => 1746, - N_Package_Declaration => 1729, - N_Record_Definition => 1651, - N_Allocator => 1521, - N_Op_Concat => 1377, - N_Access_Definition => 1358, - N_Case_Statement => 1322, - N_Number_Declaration => 1316, - N_Generic_Package_Declaration => 1311, - N_Slice => 1078, - N_Constrained_Array_Definition => 1068, - N_Exception_Renaming_Declaration => 1011, - N_Implicit_Label_Declaration => 978, - N_Exception_Handler => 966, - N_Private_Type_Declaration => 898, - N_Operator_Symbol => 872, - N_Formal_Private_Type_Definition => 867, - N_Range_Constraint => 849, - N_Aspect_Specification => 837, - N_Variant => 834, - N_Discriminant_Specification => 746, - N_Loop_Statement => 744, - N_Derived_Type_Definition => 731, - N_Freeze_Generic_Entity => 702, - N_Iteration_Scheme => 686, - N_Package_Instantiation => 658, - N_Loop_Parameter_Specification => 632, - N_Attribute_Definition_Clause => 608, - N_Compilation_Unit_Aux => 599, - N_Compilation_Unit => 599, - N_Label => 572, - N_Goto_Statement => 572, - N_In => 564, - N_Enumeration_Type_Definition => 523, - N_Object_Renaming_Declaration => 482, - N_If_Expression => 476, - N_Exception_Declaration => 472, - N_Reference => 455, - N_Incomplete_Type_Declaration => 438, - N_Use_Package_Clause => 401, - N_Unconstrained_Array_Definition => 360, - N_Variant_Part => 340, - N_Defining_Program_Unit_Name => 336, - N_Op_And => 334, - N_Raise_Program_Error => 329, - N_Formal_Discrete_Type_Definition => 319, - N_Contract => 311, - N_Not_In => 305, - N_Designator => 285, - N_Component_Clause => 247, - N_Formal_Signed_Integer_Type_Definition => 244, - N_Raise_Statement => 214, - N_Op_Expon => 205, - N_Op_Minus => 202, - N_Op_Multiply => 158, - N_Exit_Statement => 130, - N_Function_Instantiation => 129, - N_Discriminant_Association => 123, - N_Private_Extension_Declaration => 119, - N_Extended_Return_Statement => 117, - N_Op_Divide => 107, - N_Op_Or => 103, - N_Signed_Integer_Type_Definition => 101, - N_Record_Representation_Clause => 76, - N_Unchecked_Expression => 70, - N_Op_Abs => 63, - N_Elsif_Part => 62, - N_Formal_Floating_Point_Definition => 59, - N_Formal_Package_Declaration => 58, - N_Modular_Type_Definition => 55, - N_Abstract_Subprogram_Declaration => 52, - N_Validate_Unchecked_Conversion => 49, - N_Defining_Character_Literal => 36, - N_Raise_Storage_Error => 33, - N_Compound_Statement => 29, - N_Procedure_Instantiation => 28, - N_Access_Procedure_Definition => 25, - N_Floating_Point_Definition => 20, - N_Use_Type_Clause => 19, - N_Op_Plus => 14, - N_Package_Body => 13, - N_Op_Rem => 13, - N_Enumeration_Representation_Clause => 13, - N_Access_Function_Definition => 11, - N_Extension_Aggregate => 11, - N_Formal_Ordinary_Fixed_Point_Definition => 10, - N_Op_Mod => 10, - N_Expression_Function => 9, - N_Delay_Relative_Statement => 9, - N_Quantified_Expression => 7, - N_Formal_Derived_Type_Definition => 7, - N_Free_Statement => 7, - N_Iterator_Specification => 5, - N_Op_Shift_Left => 5, - N_Formal_Modular_Type_Definition => 4, - N_Generic_Package_Renaming_Declaration => 1, - N_Empty => 1, - N_Real_Range_Specification => 1, - N_Ordinary_Fixed_Point_Definition => 1, - N_Op_Shift_Right => 1, - N_Error => 1, - N_Mod_Clause => 1, - others => 0); - - Total_Node_Count : constant Long_Float := 1370676.0; - - type Node_Frequency_Table is array (Concrete_Node) of Long_Float; - - function Init_Node_Frequency return Node_Frequency_Table; - -- Compute the value of the Node_Frequency table - - function Average_Type_Size_In_Slots return Long_Float; - -- Compute the average over all concrete node types of the size, - -- weighted by the frequency of that node type. - - function Init_Node_Frequency return Node_Frequency_Table is - Result : Node_Frequency_Table := (others => 0.0); - - begin - for T in Concrete_Node loop - Result (T) := Long_Float (Node_Counts (T)) / Total_Node_Count; - end loop; - - return Result; - end Init_Node_Frequency; - - Node_Frequency : constant Node_Frequency_Table := Init_Node_Frequency; - -- Table mapping concrete node types to the relative frequency of - -- that node, in our large example. The sum of these values should - -- add up to approximately 1.0. For example, if Node_Frequency(K) = - -- 0.02, then that means that approximately 2% of all nodes are K - -- nodes. - - function Average_Type_Size_In_Slots return Long_Float is - -- We don't have data on entities, so we leave those out - - Result : Long_Float := 0.0; - begin - for T in Concrete_Node loop - Result := Result + - Node_Frequency (T) * Long_Float (Type_Size_In_Slots (T)); - end loop; - - return Result; - end Average_Type_Size_In_Slots; - - -- Start of processing for Compute_Type_Sizes - begin for T in Concrete_Type loop declare @@ -1351,8 +1135,6 @@ package body Gen_IL.Gen is Max_Node_Size := To_Size_In_Slots (Max_Node_Bit_Size); Min_Entity_Size := To_Size_In_Slots (Min_Entity_Bit_Size); Max_Entity_Size := To_Size_In_Slots (Max_Entity_Bit_Size); - - Average_Node_Size_In_Slots := Average_Type_Size_In_Slots; end Compute_Type_Sizes; ---------------------------------------- @@ -1573,7 +1355,7 @@ package body Gen_IL.Gen is case Root is when Node_Kind => Put_Getter_Decl (S, Nkind); - Put (S, "function K (N : Node_Id) return Node_Kind renames Nkind;" & LF); + Put (S, "function K (N : Node_Id) return Node_Kind renames " & Image (Nkind) & ";" & LF); Put (S, "-- Shorthand for use in predicates and preconditions below" & LF); Put (S, "-- There is no procedure Set_Nkind." & LF); Put (S, "-- See Init_Nkind and Mutate_Nkind in Atree." & LF & LF); @@ -1767,7 +1549,6 @@ package body Gen_IL.Gen is Put (S, " with " & Inline); Increase_Indent (S, 2); Put_Precondition (S, F); - Decrease_Indent (S, 2); Put (S, ";" & LF); end Put_Getter_Decl; @@ -1781,8 +1562,8 @@ package body Gen_IL.Gen is is Rec : Field_Info renames Field_Table (F).all; - Off : constant Field_Offset := Rec.Offset; F_Size : constant Bit_Offset := Field_Size (Rec.Field_Type); + Off : constant Field_Offset := Rec.Offset; F_Per_Slot : constant Field_Offset := SS / Field_Offset (Field_Size (Rec.Field_Type)); Slot_Off : constant Field_Offset := Off / F_Per_Slot; @@ -2215,8 +1996,7 @@ package body Gen_IL.Gen is Image (Min_Node_Size) & ";" & LF); Put (S, "Max_Node_Size : constant Field_Offset := " & Image (Max_Node_Size) & ";" & LF & LF); - Put (S, "Average_Node_Size_In_Slots : constant := " & - Average_Node_Size_In_Slots'Img & ";" & LF & LF); + when Entity_Kind => Put (S, LF & "Min_Entity_Size : constant Field_Offset := " & Image (Min_Entity_Size) & ";" & LF); @@ -2468,22 +2248,16 @@ package body Gen_IL.Gen is Put (S, "Kind : Field_Kind;" & LF); Put (S, "Offset : Field_Offset;" & LF); Decrease_Indent (S, 3); - Put (S, "end record;" & LF); + Put (S, "end record;" & LF & LF); -- Print out the node header types. Note that the Offset field is of -- the base type, because we are using zero-origin addressing in -- Atree. - Put (S, "" & LF); - Put (S, "N_Head : constant Field_Offset := " & N_Head & ";" & LF); - Put (S, "type Node_Header_Slots is" & LF); - Put (S, " array (Field_Offset range 0 .. N_Head - 1) of aliased Slot;" & LF); - Put (S, "type Node_Header is record" & LF); - Put (S, " Slots : Node_Header_Slots;" & LF); - Put (S, " Offset : Node_Offset'Base;" & LF); - Put (S, "end record;" & LF); - Put (S, "pragma Assert (Node_Header'Size = (" & N_Head & - " + 1) * " & SSS & ");" & LF); + Put (S, "N_Head : constant Field_Offset := " & N_Head & ";" & LF & LF); + + Put (S, "Atree_Statistics_Enabled : constant Boolean := " & + Capitalize (Boolean'Image (Statistics_Enabled)) & ";" & LF); Decrease_Indent (S, 3); Put (S, LF & "end Seinfo;" & LF); diff --git a/gcc/ada/gen_il-internals.adb b/gcc/ada/gen_il-internals.adb index d77fe7a..fe1af78 100644 --- a/gcc/ada/gen_il-internals.adb +++ b/gcc/ada/gen_il-internals.adb @@ -255,7 +255,7 @@ package body Gen_IL.Internals is begin case F is -- Special cases for the same reason as in the above Image - -- function. + -- function for Opt_Type_Enum. when Alloc_For_BIP_Return => return "Alloc_For_BIP_Return"; diff --git a/gcc/ada/gen_il-internals.ads b/gcc/ada/gen_il-internals.ads index 11a9912..a811e0b4 100644 --- a/gcc/ada/gen_il-internals.ads +++ b/gcc/ada/gen_il-internals.ads @@ -277,4 +277,344 @@ package Gen_IL.Internals is -- Return "Node" or "Entity" depending on whether Root = Node_Kind or -- Entity_Kind. + pragma Style_Checks (Off); + -- We don't want warnings about wrong casing in the Type_Frequency table; + -- this table is not intended to be particularly readable. + + -- The Type_Frequency table shows the frequency of nodes and entity kinds + -- printed by -gnatd.A for a large example. It is used in the field offset + -- computations for efficiency. Note that N_Defining_Identifier, + -- N_Defining_Operator_Symbol, and N_Defining_Character_Literal are set to + -- zero, because the Ekind is what matters for those. + + Type_Frequency : constant array (Concrete_Type) of Type_Count := + (N_Identifier => 3496964, -- (0.354) 7 slots + N_Defining_Identifier => 0, -- 1468484, -- (0.149) 8 slots + N_Integer_Literal => 455415, -- (0.046) 6 slots + E_In_Parameter => 391008, -- (0.040) 42 slots + N_Attribute_Reference => 330825, -- (0.033) 9 slots + N_Expanded_Name => 329509, -- (0.033) 8 slots + N_Selected_Component => 328862, -- (0.033) 8 slots + N_Parameter_Specification => 321313, -- (0.033) 7 slots + E_Void => 173019, -- (0.018) 59 slots + N_Explicit_Dereference => 155113, -- (0.016) 8 slots + N_Procedure_Call_Statement => 125403, -- (0.013) 8 slots + N_Object_Declaration => 115610, -- (0.012) 8 slots + E_Component => 108208, -- (0.011) 49 slots + N_Procedure_Specification => 106277, -- (0.011) 7 slots + E_Procedure => 104063, -- (0.011) 62 slots + N_Unchecked_Type_Conversion => 94477, -- (0.010) 7 slots + N_Range => 91413, -- (0.009) 6 slots + E_Function => 90035, -- (0.009) 62 slots + N_Handled_Sequence_Of_Statements => 87930, -- (0.009) 8 slots + N_Subprogram_Declaration => 85248, -- (0.009) 7 slots + N_Parameter_Association => 81464, -- (0.008) 8 slots + N_Indexed_Component => 80049, -- (0.008) 7 slots + N_Freeze_Entity => 79904, -- (0.008) 8 slots + N_Call_Marker => 79521, -- (0.008) 4 slots + N_Assignment_Statement => 76554, -- (0.008) 8 slots + N_Function_Specification => 76052, -- (0.008) 7 slots + N_Function_Call => 75028, -- (0.008) 9 slots + N_Op_Eq => 74874, -- (0.008) 8 slots + E_Constant => 66667, -- (0.007) 47 slots + N_If_Statement => 60066, -- (0.006) 8 slots + N_Component_Association => 54642, -- (0.006) 7 slots + N_Subprogram_Body => 53805, -- (0.005) 10 slots + N_Type_Conversion => 53383, -- (0.005) 7 slots + E_In_Out_Parameter => 52936, -- (0.005) 38 slots + N_Simple_Return_Statement => 52436, -- (0.005) 7 slots + N_Subtype_Indication => 49535, -- (0.005) 6 slots + N_Raise_Constraint_Error => 49069, -- (0.005) 6 slots + N_Null => 46850, -- (0.005) 5 slots + N_Itype_Reference => 45422, -- (0.005) 4 slots + E_Anonymous_Access_Type => 45149, -- (0.005) 44 slots + N_And_Then => 44721, -- (0.005) 8 slots + N_Block_Statement => 44328, -- (0.004) 10 slots + N_Subtype_Declaration => 43149, -- (0.004) 6 slots + N_Op_Not => 40531, -- (0.004) 7 slots + E_Array_Subtype => 40051, -- (0.004) 50 slots + N_Expression_With_Actions => 36726, -- (0.004) 7 slots + E_Access_Subprogram_Type => 36700, -- (0.004) 45 slots + E_Signed_Integer_Subtype => 36659, -- (0.004) 43 slots + N_String_Literal => 34815, -- (0.004) 7 slots + N_Aggregate => 33899, -- (0.003) 8 slots + N_Index_Or_Discriminant_Constraint => 33546, -- (0.003) 4 slots + E_Variable => 33102, -- (0.003) 55 slots + E_Block => 32829, -- (0.003) 58 slots + N_Op_Ne => 32127, -- (0.003) 8 slots + N_Pragma_Argument_Association => 31504, -- (0.003) 7 slots + N_Null_Statement => 30816, -- (0.003) 5 slots + N_Aspect_Specification => 29667, -- (0.003) 9 slots + N_Pragma => 28317, -- (0.003) 9 slots + N_Generic_Association => 26297, -- (0.003) 8 slots + N_Formal_Concrete_Subprogram_Declaration => 25843, -- (0.003) 6 slots + N_Op_Lt => 25328, -- (0.003) 8 slots + E_String_Literal_Subtype => 25272, -- (0.003) 48 slots + N_Full_Type_Declaration => 25258, -- (0.003) 7 slots + N_With_Clause => 24370, -- (0.002) 9 slots + N_Op_Add => 23839, -- (0.002) 8 slots + E_Subprogram_Body => 23790, -- (0.002) 42 slots + E_Return_Statement => 23098, -- (0.002) 51 slots + N_Or_Else => 22858, -- (0.002) 8 slots + N_Implicit_Label_Declaration => 21687, -- (0.002) 5 slots + N_Others_Choice => 21579, -- (0.002) 4 slots + E_Out_Parameter => 21513, -- (0.002) 38 slots + N_Op_Subtract => 21441, -- (0.002) 8 slots + N_Op_Ge => 21116, -- (0.002) 8 slots + N_Component_Definition => 21075, -- (0.002) 7 slots + N_Case_Statement_Alternative => 19664, -- (0.002) 8 slots + N_Loop_Statement => 19507, -- (0.002) 9 slots + E_Package => 19029, -- (0.002) 53 slots + N_Op_Gt => 18619, -- (0.002) 8 slots + N_Op_Le => 16564, -- (0.002) 8 slots + N_Formal_Object_Declaration => 16219, -- (0.002) 7 slots + E_Discriminant => 16091, -- (0.002) 56 slots + N_Component_Declaration => 15858, -- (0.002) 7 slots + N_Iteration_Scheme => 15719, -- (0.002) 8 slots + N_Access_To_Object_Definition => 14875, -- (0.002) 5 slots + E_Record_Subtype => 14569, -- (0.001) 52 slots + N_Generic_Subprogram_Declaration => 14320, -- (0.001) 7 slots + N_Package_Specification => 13323, -- (0.001) 8 slots + N_Exception_Handler => 12841, -- (0.001) 8 slots + E_Enumeration_Literal => 11608, -- (0.001) 42 slots + N_Subprogram_Renaming_Declaration => 10991, -- (0.001) 9 slots + N_In => 10794, -- (0.001) 8 slots + E_Allocator_Type => 10751, -- (0.001) 44 slots + E_General_Access_Type => 10451, -- (0.001) 44 slots + E_Generic_Procedure => 9837, -- (0.001) 41 slots + N_Package_Renaming_Declaration => 9395, -- (0.001) 8 slots + N_Access_Definition => 9388, -- (0.001) 6 slots + N_Qualified_Expression => 9012, -- (0.001) 7 slots + E_Enumeration_Subtype => 8560, -- (0.001) 46 slots + N_Allocator => 8474, -- (0.001) 8 slots + N_Package_Declaration => 8099, -- (0.001) 10 slots + N_Formal_Type_Declaration => 7964, -- (0.001) 7 slots + N_Exit_Statement => 7960, -- (0.001) 8 slots + N_Component_List => 7829, -- (0.001) 5 slots + N_Defining_Operator_Symbol => 0, -- 7525, -- (0.001) 8 slots + N_Case_Statement => 7271, -- (0.001) 7 slots + N_Expression_Function => 7242, -- (0.001) 9 slots + N_Loop_Parameter_Specification => 7042, -- (0.001) 7 slots + N_Character_Literal => 6842, -- (0.001) 7 slots + N_Op_Concat => 6565, -- (0.001) 8 slots + N_Not_In => 6341, -- (0.001) 8 slots + N_Label => 6133, -- (0.001) 9 slots + N_Goto_Statement => 6133, -- (0.001) 8 slots + E_Label => 6133, -- (0.001) 57 slots + E_Loop => 6008, -- (0.001) 41 slots + N_Generic_Package_Declaration => 5808, -- (0.001) 10 slots + N_If_Expression => 5800, -- (0.001) 7 slots + N_Record_Definition => 5628, -- (0.001) 7 slots + N_Slice => 5461, -- (0.001) 7 slots + N_Reference => 5332, -- (0.001) 7 slots + E_Generic_Package => 5268, -- (0.001) 59 slots + E_Record_Type => 4838, -- (0.000) 51 slots + N_Raise_Program_Error => 4675, -- (0.000) 6 slots + N_Raise_Statement => 4628, -- (0.000) 8 slots + N_Use_Type_Clause => 4487, -- (0.000) 9 slots + E_Array_Type => 4325, -- (0.000) 48 slots + E_Operator => 4308, -- (0.000) 55 slots + N_Freeze_Generic_Entity => 4249, -- (0.000) 4 slots + N_Constrained_Array_Definition => 4244, -- (0.000) 5 slots + N_Object_Renaming_Declaration => 4067, -- (0.000) 8 slots + N_Formal_Private_Type_Definition => 4018, -- (0.000) 8 slots + E_Loop_Parameter => 3870, -- (0.000) 38 slots + N_Real_Literal => 3759, -- (0.000) 7 slots + N_Attribute_Definition_Clause => 3724, -- (0.000) 8 slots + N_Exception_Renaming_Declaration => 3697, -- (0.000) 8 slots + E_Class_Wide_Type => 3674, -- (0.000) 48 slots + E_Exception => 3632, -- (0.000) 24 slots + N_Range_Constraint => 3506, -- (0.000) 4 slots + E_Access_Type => 3487, -- (0.000) 44 slots + E_Subprogram_Type => 3248, -- (0.000) 47 slots + N_Package_Instantiation => 3005, -- (0.000) 8 slots + E_Access_Attribute_Type => 2959, -- (0.000) 44 slots + N_Op_And => 2957, -- (0.000) 8 slots + E_Generic_In_Parameter => 2704, -- (0.000) 31 slots + N_Derived_Type_Definition => 2688, -- (0.000) 7 slots + N_Variant => 2535, -- (0.000) 8 slots + E_Record_Subtype_With_Private => 2327, -- (0.000) 50 slots + N_Private_Type_Declaration => 2287, -- (0.000) 6 slots + E_Private_Type => 1890, -- (0.000) 48 slots + N_Discriminant_Specification => 1864, -- (0.000) 7 slots + N_Procedure_Instantiation => 1659, -- (0.000) 8 slots + N_Op_Multiply => 1634, -- (0.000) 8 slots + E_Access_Subtype => 1606, -- (0.000) 44 slots + N_Defining_Program_Unit_Name => 1463, -- (0.000) 8 slots + N_Number_Declaration => 1461, -- (0.000) 7 slots + E_Named_Integer => 1430, -- (0.000) 19 slots + N_Use_Package_Clause => 1369, -- (0.000) 9 slots + N_Compilation_Unit_Aux => 1341, -- (0.000) 8 slots + N_Compilation_Unit => 1341, -- (0.000) 8 slots + N_Elsif_Part => 1331, -- (0.000) 7 slots + N_Operator_Symbol => 1305, -- (0.000) 7 slots + E_Limited_Private_Type => 1299, -- (0.000) 48 slots + E_Generic_Function => 1292, -- (0.000) 41 slots + E_Enumeration_Type => 1186, -- (0.000) 47 slots + N_Enumeration_Type_Definition => 1169, -- (0.000) 6 slots + N_Unchecked_Expression => 1112, -- (0.000) 7 slots + N_Op_Or => 1107, -- (0.000) 8 slots + N_Designator => 1100, -- (0.000) 9 slots + N_Formal_Discrete_Type_Definition => 1086, -- (0.000) 4 slots + N_Variant_Part => 1072, -- (0.000) 8 slots + N_Formal_Package_Declaration => 1047, -- (0.000) 8 slots + N_Quantified_Expression => 1033, -- (0.000) 8 slots + E_Record_Type_With_Private => 1017, -- (0.000) 51 slots + N_Package_Body => 999, -- (0.000) 9 slots + N_Unconstrained_Array_Definition => 973, -- (0.000) 5 slots + E_Private_Subtype => 971, -- (0.000) 48 slots + N_Incomplete_Type_Declaration => 863, -- (0.000) 6 slots + E_Incomplete_Type => 863, -- (0.000) 48 slots + N_Contract => 859, -- (0.000) 6 slots + E_Package_Body => 852, -- (0.000) 46 slots + N_Extended_Return_Statement => 801, -- (0.000) 8 slots + N_Op_Divide => 724, -- (0.000) 8 slots + N_Extension_Aggregate => 718, -- (0.000) 8 slots + N_Function_Instantiation => 642, -- (0.000) 8 slots + N_Exception_Declaration => 594, -- (0.000) 7 slots + N_Discriminant_Association => 552, -- (0.000) 7 slots + N_Iterator_Specification => 543, -- (0.000) 8 slots + N_Private_Extension_Declaration => 540, -- (0.000) 8 slots + N_Formal_Signed_Integer_Type_Definition => 512, -- (0.000) 4 slots + E_Modular_Integer_Subtype => 490, -- (0.000) 44 slots + N_Component_Clause => 468, -- (0.000) 7 slots + E_Signed_Integer_Type => 399, -- (0.000) 43 slots + N_Op_Minus => 356, -- (0.000) 7 slots + N_Raise_Expression => 337, -- (0.000) 8 slots + N_Case_Expression_Alternative => 336, -- (0.000) 8 slots + N_Op_Expon => 280, -- (0.000) 8 slots + N_Abstract_Subprogram_Declaration => 250, -- (0.000) 6 slots + E_Modular_Integer_Type => 232, -- (0.000) 44 slots + N_Modular_Type_Definition => 214, -- (0.000) 7 slots + N_Compound_Statement => 212, -- (0.000) 6 slots + N_Free_Statement => 209, -- (0.000) 8 slots + N_Record_Representation_Clause => 197, -- (0.000) 9 slots + N_Access_Procedure_Definition => 195, -- (0.000) 6 slots + E_Limited_Private_Subtype => 178, -- (0.000) 48 slots + N_Access_Function_Definition => 172, -- (0.000) 7 slots + N_Op_Mod => 163, -- (0.000) 8 slots + N_Validate_Unchecked_Conversion => 156, -- (0.000) 5 slots + E_Anonymous_Access_Subprogram_Type => 155, -- (0.000) 44 slots + N_Op_Rem => 147, -- (0.000) 8 slots + N_Formal_Incomplete_Type_Definition => 140, -- (0.000) 4 slots + N_Signed_Integer_Type_Definition => 137, -- (0.000) 6 slots + N_Case_Expression => 132, -- (0.000) 7 slots + N_Op_Plus => 129, -- (0.000) 7 slots + E_Incomplete_Subtype => 129, -- (0.000) 48 slots + N_Op_Abs => 119, -- (0.000) 7 slots + N_Op_Shift_Right => 109, -- (0.000) 8 slots + E_Floating_Point_Subtype => 94, -- (0.000) 43 slots + N_Op_Shift_Left => 72, -- (0.000) 8 slots + E_Floating_Point_Type => 59, -- (0.000) 43 slots + N_Formal_Derived_Type_Definition => 53, -- (0.000) 7 slots + N_Formal_Floating_Point_Definition => 40, -- (0.000) 4 slots + N_Defining_Character_Literal => 0, -- 36, -- (0.000) 8 slots + N_Formal_Modular_Type_Definition => 27, -- (0.000) 4 slots + E_Ordinary_Fixed_Point_Subtype => 23, -- (0.000) 44 slots + E_Abstract_State => 22, -- (0.000) 48 slots + E_Named_Real => 20, -- (0.000) 19 slots + N_Floating_Point_Definition => 19, -- (0.000) 6 slots + N_Subunit => 17, -- (0.000) 8 slots + N_Enumeration_Representation_Clause => 17, -- (0.000) 9 slots + N_Entry_Declaration => 17, -- (0.000) 7 slots + N_Subprogram_Body_Stub => 16, -- (0.000) 8 slots + N_Unused_At_Start => 15, -- (0.000) 4 slots + E_Entry => 14, -- (0.000) 42 slots + N_Formal_Ordinary_Fixed_Point_Definition => 12, -- (0.000) 4 slots + E_Class_Wide_Subtype => 9, -- (0.000) 52 slots + E_Protected_Subtype => 8, -- (0.000) 48 slots + E_Ordinary_Fixed_Point_Type => 8, -- (0.000) 44 slots + N_Op_Xor => 7, -- (0.000) 8 slots + E_Generic_In_Out_Parameter => 7, -- (0.000) 31 slots + N_Protected_Type_Declaration => 6, -- (0.000) 8 slots + N_Protected_Definition => 6, -- (0.000) 8 slots + N_Task_Type_Declaration => 4, -- (0.000) 8 slots + N_Task_Definition => 4, -- (0.000) 8 slots + N_Protected_Body => 4, -- (0.000) 9 slots + E_Task_Subtype => 4, -- (0.000) 50 slots + E_Protected_Type => 4, -- (0.000) 49 slots + E_Access_Protected_Subprogram_Type => 4, -- (0.000) 45 slots + N_Entry_Call_Statement => 3, -- (0.000) 8 slots + E_Task_Type => 3, -- (0.000) 50 slots + N_Raise_Storage_Error => 2, -- (0.000) 6 slots + N_Package_Body_Stub => 2, -- (0.000) 8 slots + N_Generic_Procedure_Renaming_Declaration => 2, -- (0.000) 8 slots + N_Task_Body => 1, -- (0.000) 10 slots + N_Single_Protected_Declaration => 1, -- (0.000) 8 slots + N_Real_Range_Specification => 1, -- (0.000) 6 slots + N_Ordinary_Fixed_Point_Definition => 1, -- (0.000) 6 slots + N_Error => 1, -- (0.000) 6 slots + N_Entry_Body_Formal_Part => 1, -- (0.000) 6 slots + N_Entry_Body => 1, -- (0.000) 10 slots + N_Empty => 1, -- (0.000) 6 slots + N_Delay_Relative_Statement => 1, -- (0.000) 7 slots + E_Protected_Body => 1, -- (0.000) 35 slots + + Between_Concrete_Node_And_Concrete_Entity_Types => 0, + + -- The rest had frequency 0 (i.e. no such nodes were created in the + -- example), but we set them to 1, so we won't lose information when + -- multiplying. We use "others", so that if new node types are added, + -- we don't have to modify the table; new node types are unlikely to + -- be very common. + + others => 1 + -- N_Variable_Reference_Marker => 0, (0.000) 4 slots + -- N_Unused_At_End => 0, (0.000) 4 slots + -- N_Triggering_Alternative => 0, (0.000) 6 slots + -- N_Timed_Entry_Call => 0, (0.000) 5 slots + -- N_Terminate_Alternative => 0, (0.000) 6 slots + -- N_Task_Body_Stub => 0, (0.000) 8 slots + -- N_Target_Name => 0, (0.000) 5 slots + -- N_Single_Task_Declaration => 0, (0.000) 8 slots + -- N_Selective_Accept => 0, (0.000) 5 slots + -- N_Scil_Membership_Test => 0, (0.000) 5 slots + -- N_Scil_Dispatch_Table_Tag_Init => 0, (0.000) 4 slots + -- N_Scil_Dispatching_Call => 0, (0.000) 6 slots + -- N_Return_When_Statement => 0, (0.000) 7 slots + -- N_Requeue_Statement => 0, (0.000) 8 slots + -- N_Raise_When_Statement => 0, (0.000) 8 slots + -- N_Push_Storage_Error_Label => 0, (0.000) 4 slots + -- N_Push_Program_Error_Label => 0, (0.000) 4 slots + -- N_Push_Constraint_Error_Label => 0, (0.000) 4 slots + -- N_Protected_Body_Stub => 0, (0.000) 8 slots + -- N_Pop_Storage_Error_Label => 0, (0.000) 4 slots + -- N_Pop_Program_Error_Label => 0, (0.000) 4 slots + -- N_Pop_Constraint_Error_Label => 0, (0.000) 4 slots + -- N_Op_Shift_Right_Arithmetic => 0, (0.000) 8 slots + -- N_Op_Rotate_Right => 0, (0.000) 8 slots + -- N_Op_Rotate_Left => 0, (0.000) 8 slots + -- N_Mod_Clause => 0, (0.000) 7 slots + -- N_Iterated_Element_Association => 0, (0.000) 8 slots + -- N_Iterated_Component_Association => 0, (0.000) 8 slots + -- N_Goto_When_Statement => 0, (0.000) 8 slots + -- N_Generic_Package_Renaming_Declaration => 0, (0.000) 8 slots + -- N_Generic_Function_Renaming_Declaration => 0, (0.000) 8 slots + -- N_Formal_Decimal_Fixed_Point_Definition => 0, (0.000) 4 slots + -- N_Formal_Abstract_Subprogram_Declaration => 0, (0.000) 6 slots + -- N_Entry_Index_Specification => 0, (0.000) 7 slots + -- N_Entry_Call_Alternative => 0, (0.000) 6 slots + -- N_Digits_Constraint => 0, (0.000) 6 slots + -- N_Delta_Constraint => 0, (0.000) 6 slots + -- N_Delta_Aggregate => 0, (0.000) 8 slots + -- N_Delay_Until_Statement => 0, (0.000) 7 slots + -- N_Delay_Alternative => 0, (0.000) 7 slots + -- N_Decimal_Fixed_Point_Definition => 0, (0.000) 6 slots + -- N_Conditional_Entry_Call => 0, (0.000) 5 slots + -- N_Code_Statement => 0, (0.000) 7 slots + -- N_At_Clause => 0, (0.000) 9 slots + -- N_Asynchronous_Select => 0, (0.000) 5 slots + -- N_Accept_Statement => 0, (0.000) 8 slots + -- N_Accept_Alternative => 0, (0.000) 8 slots + -- N_Abort_Statement => 0, (0.000) 4 slots + -- N_Abortable_Part => 0, (0.000) 5 slots + -- E_Task_Body => 0, (0.000) 39 slots + -- E_Exception_Type => 0, (0.000) 45 slots + -- E_Entry_Index_Parameter => 0, (0.000) 19 slots + -- E_Entry_Family => 0, (0.000) 42 slots + -- E_Decimal_Fixed_Point_Type => 0, (0.000) 52 slots + -- E_Decimal_Fixed_Point_Subtype => 0, (0.000) 52 slots + -- E_Anonymous_Access_Protected_Subprogram_Type => 0, (0.000) 45 slots + ); -- Type_Frequency + end Gen_IL.Internals; diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb index b99f3fd..5fe1353 100644 --- a/gcc/ada/impunit.adb +++ b/gcc/ada/impunit.adb @@ -23,14 +23,14 @@ -- -- ------------------------------------------------------------------------------ -with Errout; use Errout; -with Sinfo; use Sinfo; -with Sinfo.Nodes; use Sinfo.Nodes; -with Fname.UF; use Fname.UF; -with Lib; use Lib; -with Namet; use Namet; -with Opt; use Opt; -with Uname; use Uname; +with Errout; use Errout; +with Sinfo; use Sinfo; +with Sinfo.Nodes; use Sinfo.Nodes; +with Fname.UF; use Fname.UF; +with Lib; use Lib; +with Namet; use Namet; +with Opt; use Opt; +with Uname; use Uname; -- Note: this package body is used by GNAT Studio and GNATBench to supply a -- list of entries for help on available library routines. diff --git a/gcc/ada/sinfo-utils.adb b/gcc/ada/sinfo-utils.adb index 55d0e40..cf0ecc1 100644 --- a/gcc/ada/sinfo-utils.adb +++ b/gcc/ada/sinfo-utils.adb @@ -23,7 +23,7 @@ -- -- ------------------------------------------------------------------------------ -with Atree; +with Atree; use Atree; with Debug; use Debug; with Output; use Output; with Seinfo; diff --git a/gcc/ada/table.ads b/gcc/ada/table.ads index 07f2ae8..e934c27 100644 --- a/gcc/ada/table.ads +++ b/gcc/ada/table.ads @@ -102,7 +102,7 @@ package Table is -- mode parameters with scalar values. type Table_Type is - array (Table_Index_Type range <>) of aliased Table_Component_Type; + array (Table_Index_Type range <>) of Table_Component_Type; subtype Big_Table_Type is Table_Type (Table_Low_Bound .. Table_Index_Type'Last); diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads index 32194e8..673f7c6 100644 --- a/gcc/ada/types.ads +++ b/gcc/ada/types.ads @@ -1014,8 +1014,4 @@ package Types is type Offset_Array is array (Offset_Array_Index range <>) of Opt_Field_Offset; - Slot_Size : constant := 32; - type Slot is mod 2**Slot_Size; - for Slot'Size use Slot_Size; - end Types; |