[Ada] More work on efficiency improvements
authorBob Duff <duff@adacore.com>
Thu, 12 Aug 2021 20:49:16 +0000 (16:49 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 1 Oct 2021 06:13:39 +0000 (06:13 +0000)
commit3f561db7ca1fba70a90c3ff9f7682b7841585258
tree632c7498e7dd06afbfad5bc717c05f2a695f68b9
parent3a81dbb618e3ac6cd42ac6f296a96296e099ac1f
[Ada] More work on efficiency improvements

gcc/ada/

* table.ads (Table_Type): Remove "aliased"; no longer needed by
Atree.  Besides it contradicted the comment a few lines above,
"--  Note: We do not make the table components aliased...".
* types.ads: Move type Slot to Atree.
* atree.ads: Move type Slot fromt Types to here.  Move type
Node_Header from Seinfo to here.
* atree.adb: Avoid the need for aliased components of the Slots
table.  Instead of 'Access, use a getter and setter.  Misc
cleanups.
(Print_Statistics): Print statistics about node and entity kind
frequencies. Give 3 digit fractions instead of percentages.
* (Get_Original_Node_Count, Set_Original_Node_Count): Statistics
for calls to Original_Node and Set_Original_Node.
(Original_Node, Set_Original_Node): Gather statistics by calling
the above.
(Print_Field_Statistics): Print Original_Node statistics.
(Update_Kind_Statistics): Remove, and put all statistics
gathering under "if Atree_Statistics_Enabled", which is a flag
generated in Seinfo by Gen_IL.
* gen_il-gen.adb (Compute_Field_Offsets): Choose offsets of
Nkind, Ekind, and Homonym first. This causes a slight efficiency
improvement.  Misc cleanups.  Do not generate Node_Header; it is
now hand-written in Atree.  When choosing the order in which to
assign offsets, weight by the frequency of the node type, so the
more common nodes get their field offsets assigned earlier.  Add
more special cases.
(Compute_Type_Sizes): Remove this and related things.
There was a comment: "At some point we can instrument Atree to
print out accurate size statistics, and remove this code." We
have Atree statistics, so we now remove this code.
(Put_Seinfo): Generate Atree_Statistics_Enabled, which is equal
to Statistics_Enabled. This allows Atree to say "if
Atree_Statistics_Enabled then <gather statistics>" for
efficiency. When Atree_Statistics_Enabled is False, the "if ..."
will be optimized away.
* gen_il-internals.ads (Type_Frequency): New table of kind
frequencies.
* gen_il-internals.adb: Minor comment improvement.
* gen_il-fields.ads: Remove unused subtypes.  Suppress style
checks in the Type_Frequency table.  If we regenerate this
table (see -gnatd.A) we don't want to have to fiddle with
casing.
* impunit.adb: Minor.
* sinfo-utils.adb: Minor.
* debug.adb: Minor comment improvement.
gcc/ada/atree.adb
gcc/ada/atree.ads
gcc/ada/debug.adb
gcc/ada/gen_il-fields.ads
gcc/ada/gen_il-gen.adb
gcc/ada/gen_il-internals.adb
gcc/ada/gen_il-internals.ads
gcc/ada/impunit.adb
gcc/ada/sinfo-utils.adb
gcc/ada/table.ads
gcc/ada/types.ads