public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1638] [Ada] Minor comment cleanups
Date: Fri, 18 Jun 2021 08:39:57 +0000 (GMT)	[thread overview]
Message-ID: <20210618083957.A0E5139B4415@sourceware.org> (raw)

https://gcc.gnu.org/g:161e220201436a641df5f5d86fdbaebb599302fc

commit r12-1638-g161e220201436a641df5f5d86fdbaebb599302fc
Author: Bob Duff <duff@adacore.com>
Date:   Tue Mar 23 16:00:03 2021 -0400

    [Ada] Minor comment cleanups
    
    gcc/ada/
    
            * gen_il-gen.adb: Improve comments.
            * snames.ads-tmpl (Convention_Id): Remove "--  Plenty of space
            for expansion", because that's irrelevant now that we are no
            longer laying out node fields by hand.

Diff:
---
 gcc/ada/gen_il-gen.adb  | 37 +++++++++++++++++++++++++------------
 gcc/ada/snames.ads-tmpl |  1 -
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/gcc/ada/gen_il-gen.adb b/gcc/ada/gen_il-gen.adb
index 61d464c9ce0..7ef285ee458 100644
--- a/gcc/ada/gen_il-gen.adb
+++ b/gcc/ada/gen_il-gen.adb
@@ -837,20 +837,24 @@ package body Gen_IL.Gen is
 
           when Node_Kind_Type | Entity_Kind_Type | Convention_Id => 8,
 
-           when Mechanism_Type
-              | List_Id
-              | Elist_Id
-              | Name_Id
-              | String_Id
-              | Uint
-              | Ureal
-              | Source_Ptr
-              | Union_Id
-              | Node_Id
-              | Node_Or_Entity_Type => 32,
+          when Mechanism_Type
+             | List_Id
+             | Elist_Id
+             | Name_Id
+             | String_Id
+             | Uint
+             | Ureal
+             | Source_Ptr
+             | Union_Id
+             | Node_Id
+             | Node_Or_Entity_Type => 32,
 
          when Between_Special_And_Abstract_Node_Types => -- can't happen
            Bit_Offset'Last);
+         --  Size in bits of a a field of type T. It must be a power of 2, and
+         --  must match the size of the type in GNAT, which sometimes requires
+         --  a Size clause in GNAT.
+         --
          --  Note that this is not the same as Type_Bit_Size of the field's
          --  type. For one thing, Type_Bit_Size only covers concrete node and
          --  entity types, which does not include most of the above. For
@@ -1012,11 +1016,20 @@ package body Gen_IL.Gen is
          end loop;
 
          --  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.
 
          Sorting.Sort (All_Fields);
 
          --  Go through all the fields, and choose the lowest offset that is
-         --  free in all types that have the field.
+         --  free in all types that have the field. This is basically a
+         --  graph-coloring algorithm on the interference graph. The
+         --  interference graph is an undirected graph with the fields being
+         --  nodes (not nodes in the compiler!) in the graph, and an edge
+         --  between a pair of fields if they appear in the same node in the
+         --  compiler. The "colors" are fields offsets, except that a
+         --  complication compared to standard graph coloring is that fields
+         --  are different sizes.
 
          for F of All_Fields loop
             Field_Table (F).Offset := Choose_Offset (F);
diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl
index e5a019fc087..2611541dd78 100644
--- a/gcc/ada/snames.ads-tmpl
+++ b/gcc/ada/snames.ads-tmpl
@@ -1700,7 +1700,6 @@ package Snames is
       --  in Sem_Prag.
 
    for Convention_Id'Size use 8;
-   --  Plenty of space for expansion
 
    subtype Convention_C_Family is Convention_Id
      range Convention_C .. Convention_CPP;


                 reply	other threads:[~2021-06-18  8:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210618083957.A0E5139B4415@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).