This patch implements some efficiency improvements related to field
getters and setters, and implements some cleanups that make the
efficiency improvements easier.

Instead of just storing the Offset with each node, we store a node
header, which contains the Offset plus a small number of slots. Fields
with small offsets are stored in these slots.

Combine types Node_Field and Entity_Field into one enumeration type
Node_Or_Entity_Field. This allows us to avoid some code duplication.

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

gcc/ada/

        * gen_il-gen.adb: Generate getters and setters with much of the
        code inlined. Generate code for storing a few fields in the node
        header, to avoid the extra level of indirection for those
        fields. We generate the header type, so we don't have to
        duplicate hand-written Ada and C code to depend on the number of
        header fields.  Declare constants for slot size. Use short names
        because these are used all over.  Remove
        Put_Low_Level_Accessor_Instantiations, Put_Low_Level_C_Getter,
        which are no longer needed.  Rename
        Put_High_Level_C_Getter-->Put_C_Getter.
        * atree.ads, atree.adb: Take into account the header slots.
        Take into account the single Node_Or_Entity_Field type.  Remove
        "pragma Assertion_Policy (Ignore);", because the routines in
        this package are no longer efficiency critical.
        * atree.h: Remove low-level getters, which are no longer used by
        sinfo.h and einfo.h.
        * einfo-utils.adb: Avoid crash in Known_Alignment.
        * live.adb, sem_eval.adb: Remove code that prevents Node_Id from
        having a predicate.  We don't actually add a predicate to
        Node_Id, but we want to be able to for temporary debugging.
        * sinfo-utils.adb: Remove code that prevents Node_Id from having
        a predicate.  Take into account the single Node_Or_Entity_Field
        type.
        * sinfo-utils.ads: Minor.
        * table.ads (Table_Type): Make the components aliased, because
        low-level setters in Atree need to take 'Access.
        * treepr.adb: Take into account the single Node_Or_Entity_Field
        type.  Make some code more robust, so we can print out
        half-baked nodes.
        * types.ads: Move types here for visibility purposes.
        * gcc-interface/gigi.h, gcc-interface/trans.c: Take into account
        the Node_Header change in the GNAT front end.
        * gcc-interface/cuintp.c, gcc-interface/targtyps.c: Add because
        gigi.h now refers to type Node_Header, which is in sinfo.h.

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

Reply via email to