From patchwork Tue Jun 20 07:46:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 110310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3496895vqr; Tue, 20 Jun 2023 00:55:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5+SJZj1s/jMrKv6SBpGPhSuZ/BcB9XNNck19Cw5dFJzmGXCJjO0mCEJMvvjAAaum5LRS1l X-Received: by 2002:a17:907:a01:b0:987:fe18:1c56 with SMTP id bb1-20020a1709070a0100b00987fe181c56mr6567792ejc.47.1687247739714; Tue, 20 Jun 2023 00:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687247739; cv=none; d=google.com; s=arc-20160816; b=ez4Fy0wMkjpHMXO/sJgZ6ydyNaVyY4MA9x+iSDzriVMfluGpndvlgvV2+BycE6AKwr M3P+7L2f3ntQ2kapJ0TIsxMsRaHMmSiNP4zpjw23UGp/FP/2r49r7fa3DEmxHXwnC96Y wC8s3GbfibKaCls9nurMnTYZnTzgqCAmGnGbEI9a0Hiu9rYZiwIDxwpFTdaFfNct9Yv3 Kx3Ewuc50lJyHwecvmeMI5RWjOasnU3NdBO3CacHRQsUoLg195AfU96QaBinWxT1miXw styKRqKmB2PAWZVSRxCrOh40A/RwlwGJWkIi7gCxMFIbSu/NLUcjbNI7tr8MGyktKBPm Kcig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=umBFwoOn2Gfar/pcVkyTLEOYRTjwuhntReXrU/8Dmu0=; b=roPIJ3OfwLC7wQHD/u2ljd080tamFNM/mipHyWPkwdJCttcxG56gFEaZJnwWQbzM1N TaiiZ3pYH1Wm+6TNCu7XjOWEi2Rg74qOXMs9+fT283f4+dpuLCd82FHbWNxO8rdpnO2z QRkfiUi8FDfXSwHK9bwPZ4RI/knUo8mpZ6U5iFeiI3uRn0p1sSNUG/qneaRG3lva98mm uUP5VSbM/sg1lT6OwZKWzYsK9I3e8cwpFMQ8LBSNMiNxdALs6D8f/eZ1+uvrN5KBl2RZ A7CrewcGHfm38FFBTimUFtWdCKAs1MOY3oPGO6I/qlRBsR2pFCqbzZWsRJRlYdC3pJFB Uryg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Vj5JPE5G; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ce4-20020a170906b24400b00977e729a2f7si900822ejb.951.2023.06.20.00.55.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:55:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Vj5JPE5G; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 16736385480C for ; Tue, 20 Jun 2023 07:50:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16736385480C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687247456; bh=umBFwoOn2Gfar/pcVkyTLEOYRTjwuhntReXrU/8Dmu0=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Vj5JPE5G3uGNsA4Zn0WMbFqy7oEwCX6E3mDaREELAk16twqi1VXqXwqw4r7CAbKmr FRq6LU3tQDeijiW/2rWuJ900qfMHIHKj+hAO3hphMRahc+6t6U+J2A6rSvahuCpuFU CH6RghUg9q/fzuwl/4rJ7HCenI4XVPnQm5t0CqkQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 5C1623857B9B for ; Tue, 20 Jun 2023 07:46:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C1623857B9B Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-30fcda210cfso4146296f8f.3 for ; Tue, 20 Jun 2023 00:46:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247214; x=1689839214; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=umBFwoOn2Gfar/pcVkyTLEOYRTjwuhntReXrU/8Dmu0=; b=WfJMDaCzH4WNVcs0AuewQjWXI/pA3VWNBwONVpEi9H1N0eki8dkV7eolHIN5x+QO40 r7vrDeG/wtWyImIW/Ea85qDsE7KnTSBNWLGhs7FS6y51D+v0kx4jq9tWdDqYi8hYEre+ xwrTYMRvSKI1Xnt1djAJFvosnVYHPSj/5KS329q42aOq+GsP+h0O8K54n35O82q3T7CZ s/ult2FBhDsb6ciPjBYpAyH9+3lFwm7hjdyx3ohrAOb7jLEKiGSY4e9+QCb5jlvSnJzd qgbX6/xBoRiO6ZrHqONre5P0i++7Jpb1zMjOOFT0Y5gLAbYONv9hUG2r+5sBrGw5JmW1 TJww== X-Gm-Message-State: AC+VfDx3+LDFpPw4OnOyeqKNp1AIagJ1kbCvj03ygHIZBXDkHlqzPwJf LBL8B9Jxd+fVTDiLPPVErfX+PsaZomOA7giqCz7CpQ== X-Received: by 2002:a05:6000:1008:b0:311:17ae:ddbf with SMTP id a8-20020a056000100800b0031117aeddbfmr9116573wrx.51.1687247214109; Tue, 20 Jun 2023 00:46:54 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:4c16:36ea:1b76:c001]) by smtp.gmail.com with ESMTPSA id x8-20020a5d54c8000000b0030fae360f14sm1330378wrv.68.2023.06.20.00.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:46:53 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Introduce -gnateH switch to force reverse Bit_Order threshold to 64 Date: Tue, 20 Jun 2023 09:46:52 +0200 Message-Id: <20230620074652.1252564-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769207485654259408?= X-GMAIL-MSGID: =?utf-8?q?1769207485654259408?= From: Eric Botcazou This can be helpful for legacy code that still makes use of an original reverse Bit_Order clause, i.e. without a Scalar_Storage_Order clause. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Compiler Switches): Document -gnateH. * opt.ads (Reverse_Bit_Order_Threshold): New variable. * sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order): Use its value if it is nonnegative instead of System_Max_Integer_Size. * switch-c.adb (Scan_Front_End_Switches): Deal with -gnateH. * usage.adb (Usage): Print -gnateH. * gnat_ugn.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../building_executable_programs_with_gnat.rst | 8 ++++++++ gcc/ada/gnat_ugn.texi | 14 +++++++++++++- gcc/ada/opt.ads | 5 +++++ gcc/ada/sem_ch13.adb | 4 +++- gcc/ada/switch-c.adb | 6 ++++++ gcc/ada/usage.adb | 5 +++++ 6 files changed, 40 insertions(+), 2 deletions(-) diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst index 20e003d4ac7..8e479679ec1 100644 --- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst +++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst @@ -1612,6 +1612,14 @@ Alphabetical List of All Switches Save result of preprocessing in a text file. +.. index:: -gnateH (gcc) + +:switch:`-gnateH` + Set the threshold from which the RM 13.5.1(13.3/2) clause applies to 64. + This is useful only on 64-bit plaforms where this threshold is 128, but + used to be 64 in earlier versions of the compiler. + + .. index:: -gnatei (gcc) :switch:`-gnatei{nnn}` diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 88123df4332..021c2672bae 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -19,7 +19,7 @@ @copying @quotation -GNAT User's Guide for Native Platforms , Jun 01, 2023 +GNAT User's Guide for Native Platforms , Jun 16, 2023 AdaCore @@ -9075,6 +9075,18 @@ information. Save result of preprocessing in a text file. @end table +@geindex -gnateH (gcc) + + +@table @asis + +@item @code{-gnateH} + +Set the threshold from which the RM 13.5.1(13.3/2) clause applies to 64. +This is useful only on 64-bit plaforms where this threshold is 128, but +used to be 64 in earlier versions of the compiler. +@end table + @geindex -gnatei (gcc) diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index bcafba9e57d..87399c8a9d3 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -1342,6 +1342,11 @@ package Opt is -- GNATPREP -- Set to True if -C switch used. + Reverse_Bit_Order_Threshold : Int := -1; + -- GNAT + -- Set to the threshold from which the RM 13.5.1(13.3/2) clause applies, + -- or -1 if the size of the largest machine scalar is to be used. + RTS_Lib_Path_Name : String_Ptr := null; RTS_Src_Path_Name : String_Ptr := null; -- GNAT diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 65627321ffe..c3ea8d63566 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -426,7 +426,9 @@ package body Sem_Ch13 is procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id) is Max_Machine_Scalar_Size : constant Uint := - UI_From_Int (System_Max_Integer_Size); + UI_From_Int (if Reverse_Bit_Order_Threshold >= 0 + then Reverse_Bit_Order_Threshold + else System_Max_Integer_Size); -- We use this as the maximum machine scalar size SSU : constant Uint := UI_From_Int (System_Storage_Unit); diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index f6207e42f62..bbbb536903b 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -635,6 +635,12 @@ package body Switch.C is Generate_Processed_File := True; Ptr := Ptr + 1; + -- -gnateH (set reverse Bit_Order threshold to 64) + + when 'H' => + Reverse_Bit_Order_Threshold := 64; + Ptr := Ptr + 1; + -- -gnatei (max number of instantiations) when 'i' => diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index 58cfa786efa..681ece5d921 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -199,6 +199,11 @@ begin Write_Switch_Char ("eG"); Write_Line ("Generate preprocessed source"); + -- Line for -gnateH switch + + Write_Switch_Char ("eH"); + Write_Line ("Set reverse Bit_Order threshold to 64"); + -- Line for -gnatei switch Write_Switch_Char ("einn");