Gather more statistics, and make some minor efficiency improvements.

Adjust the heuristic for the order in which we choose field offsets.
This reduces the maximum size of a node from 10 slots to 9 slots, and
makes the compiler a little bit faster.

Add more special cases for fields whose offsets should be chosen early.
This is a substantial efficiency win.

Adjustments to statistics gathering code.

Misc cleanup.

Tested on x86_64-pc-linux-gnu, committed on trunk

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.

Attachment: patch.diff.gz
Description: application/gzip

Reply via email to