From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 455C83857C4E for ; Thu, 23 Sep 2021 13:12:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 455C83857C4E Received: by mail-wr1-x434.google.com with SMTP id u18so17094892wrg.5 for ; Thu, 23 Sep 2021 06:12:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=Kqboq2K30She79Kbb1zlIqOknqo9sDKZgQQgRihKZnc=; b=7XVzcDQ2EkT+aL+mQbHOa99uMjpA0lDD3qr5u6UnWmCvHF6tUGT1iP0Qzm/Xf+ITXm 7+bIO5xyH/qdQf60EVHryjxfj6NOl2c7Gy42n/CfKxVGI6xX4OcjP5g48f4QhW3317HC tAJcWV3dITLVX3r5Dp/e1hR4AusDFpa8ddGPseNLJRHisZtft51Hg4P6cCtNJn3jP0/s bCsPdFRCmzixvO9LySakflImFdxAJRNrYCODrr+PCpZLDI2Xzf9odRoElREOc9Ye7bEU 4rzyYaqLRzi7LJ0hlQXZZ3nHBxOYlEMuHN51vCxHxIQa+Eg4IezAGHJCnhZ0V4SFfJjY sYKg== X-Gm-Message-State: AOAM530uJshvbxgTkUgLMryDOfmCX4YTMZbX5o+lzeZYoDX2ANZp8XMM 2UbOrl61jqJOwplEvM/6Vstc2qaEeXrfgg== X-Google-Smtp-Source: ABdhPJyyKRYF/rK5sKXFzp2RFtZ2I7obdBUvC0we1/L3FCKl/6U5/hVPnP0SLrLs6GUKQ5B9NE3JgQ== X-Received: by 2002:adf:f108:: with SMTP id r8mr5229043wro.180.1632402758407; Thu, 23 Sep 2021 06:12:38 -0700 (PDT) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id r4sm5627560wma.48.2021.09.23.06.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Sep 2021 06:12:37 -0700 (PDT) Date: Thu, 23 Sep 2021 13:12:37 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [Ada] Follow-on efficiency improvements Message-ID: <20210923131237.GA2727175@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 13:12:41 -0000 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --oyUTqETQ0mS9luUI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" 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. --oyUTqETQ0mS9luUI--