public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Bob Duff <duff@adacore.com>
Subject: [Ada] Follow-on efficiency improvements
Date: Thu, 23 Sep 2021 13:12:37 +0000	[thread overview]
Message-ID: <20210923131237.GA2727175@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

This patch improves compiler efficiency by placing the Homonym attribute
at offset zero. Homonym is a heavily used field.

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

gcc/ada/

	* gen_il-gen.adb: Set the number of concrete nodes that have the
	Homonym field to a higher number than any other field. This
	isn't true, but it forces Homonym's offset to be chosen first,
	so it will be at offset zero and hence slot zero.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 712 bytes --]

diff --git a/gcc/ada/gen_il-gen.adb b/gcc/ada/gen_il-gen.adb
--- a/gcc/ada/gen_il-gen.adb
+++ b/gcc/ada/gen_il-gen.adb
@@ -1036,6 +1036,13 @@ 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.



                 reply	other threads:[~2021-09-23 13:12 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=20210923131237.GA2727175@adacore.com \
    --to=derodat@adacore.com \
    --cc=duff@adacore.com \
    --cc=gcc-patches@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).