From patchwork Thu Aug 17 10:37:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 135872 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp603303vqi; Thu, 17 Aug 2023 03:39:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrgEb03zLd3pP2aHuTWYasCnu39SGelUqEY6HEnBidU5fAdJyYB/lUG7KTO2gebgP71+mP X-Received: by 2002:aa7:c2c5:0:b0:523:2e0e:5462 with SMTP id m5-20020aa7c2c5000000b005232e0e5462mr3170470edp.42.1692268755780; Thu, 17 Aug 2023 03:39:15 -0700 (PDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id i25-20020aa7c719000000b005256da0bd99si5344752edq.195.2023.08.17.03.39.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 03:39:15 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=PxG8u1Rn; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 9FC4D38555B3 for ; Thu, 17 Aug 2023 10:39:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9FC4D38555B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692268754; bh=cFOf4HUlRVMKq8dFe/t0VW/NiQKoi2hAZYP1jxlgyy4=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=PxG8u1Rn+AA4kgnfoaX17ipdRiFl7mHdB9f+HfEEtb7UCyP+9jI6tMUsESr1aCPJ0 EKo+hlLPDIhCl/FOB5lhheEXKlLAuwO5V5Xk7nmv76ZAKp+iWzvpY9TBKuT+bNe2KY vLN53gyDUI1cCt+odK4WUocjPLthhyYdEMXSDQ78= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2087.outbound.protection.outlook.com [40.107.21.87]) by sourceware.org (Postfix) with ESMTPS id 431B83856973 for ; Thu, 17 Aug 2023 10:38:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 431B83856973 Received: from AS4P189CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5db::19) by AS4PR08MB8047.eurprd08.prod.outlook.com (2603:10a6:20b:587::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.30; Thu, 17 Aug 2023 10:38:14 +0000 Received: from AM7EUR03FT007.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:5db:cafe::47) by AS4P189CA0018.outlook.office365.com (2603:10a6:20b:5db::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.33 via Frontend Transport; Thu, 17 Aug 2023 10:38:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT007.mail.protection.outlook.com (100.127.140.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.17 via Frontend Transport; Thu, 17 Aug 2023 10:38:14 +0000 Received: ("Tessian outbound 169aaa6bf2b7:v175"); Thu, 17 Aug 2023 10:38:13 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b436442f43174ac8 X-CR-MTA-TID: 64aa7808 Received: from 885fe3b317d6.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6DA0F1B5-5E4E-4F0B-A279-0F8B7BC197B3.1; Thu, 17 Aug 2023 10:38:02 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 885fe3b317d6.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 17 Aug 2023 10:38:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NzJSszos6XgCikl5S6XbEAsYf6FEW/F+A8CABLcEwtRguJmPnOaursY1n59z1c1DEAj0rYNRyGly+gEwY6h8gNSBvjbSGFH2kdxYwR/aK4rrGxiuDlEXQLDsvIHhR4GTug7NX2NiJM31Z5Evp0yjBgJi0wXpi+N/RaesweFhJ/CveGSWFYKf6hRAT2A5EfX/wgXgZzvnwaepKnJXeB8nUDKgX2VVVDhVaISZIjhfdS7mBcAcNKjctqbCcQPwNl+WTBmYBK87wcas2CCt41OpTl9+ROdrMHotqdkA3MzLX0A6fMS2BhyNzdOaeWT1DlMc4kbTadE6LM1CIdpxq9QTEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cFOf4HUlRVMKq8dFe/t0VW/NiQKoi2hAZYP1jxlgyy4=; b=X6fsvy8frp4sHpYG7gQbaWOgrA8couOHJmmCwOJ6wZTLz0JAzZ3QA3YvSVgLPSm7V9G6Tnj4e5Hm9VGexqGrUIzyLei0wxnzqhWq5usQxv+yD84guKimDnKUkwHt/TWAsOIrKMZwGbydbOFHf5I9K3K2m5mm6ffXKy6X5YC2Yn7WmbCI7bOhZX6Aosay/zTdBdi5v2o2STTvKdORD3vqeGKeTtwm3g8ivCxOdFrfRBntMvTJlpShUBkQYVF8dUUMrc8Iyv0/++BQzd2yUYAShlUeoYvJlykIlRLUj0eojcvRshq0nA/2IDq2XU0IVa1vvrqhf4Zz3tJBfV/sRtspiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) by AS8PR08MB6616.eurprd08.prod.outlook.com (2603:10a6:20b:319::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.31; Thu, 17 Aug 2023 10:37:58 +0000 Received: from PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::f352:a0c5:bddf:2510]) by PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::f352:a0c5:bddf:2510%7]) with mapi id 15.20.6678.029; Thu, 17 Aug 2023 10:37:58 +0000 Date: Thu, 17 Aug 2023 11:37:48 +0100 To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford Subject: [PATCH] doc: Fixes to RTL-SSA sample code Message-ID: Content-Disposition: inline X-ClientProxiedBy: PN3PR01CA0182.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:be::18) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|AS8PR08MB6616:EE_|AM7EUR03FT007:EE_|AS4PR08MB8047:EE_ X-MS-Office365-Filtering-Correlation-Id: 56166697-8c7b-44f6-e440-08db9f0e0f75 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: fyhfOb9MvoJGKn0jalwjzKklzqGhKZape5apE+NOOfIU9JsC4oxIJxzl8mkw+eEppT7cK1z4HRqvljt2RvOerpgI8rqOAuRQub3kXXKXqEt2n8rYTRtAiIlIsphZR/zLhLrrLc7TR6FS+O5dH5x9pDqjlHT7rWMiVny2NwLkk/3EPU7Qpio7u1W1W3Z1pgqayj+1Gl0okMyv6is+h+z4vcd1rRukNCl5kgnfwT7idNFbqicaRanOJrdmoErOr2UeeJft5cPmJJZSPnsB5hFt8cpl0HRVd+7+q+/DunFXIff+5SwPkFBTdbKsGRgiqzN+XwPdS3NCptFb7GoU+afVa6ynYJey5kzhCg9eO4os2r4ntQamBGPUjUPnikAWbBaLrWfzEykJ57wz6pf7SKqkBbaFXp5wynVVoEKgcpK4S590h+3K7BADnuJgBnnbj4WYOdUwl6BA87oCp2OFn+1jS2daMAIWuFLR2rOb/tuZ73G6SdOYxCoSwwFxqjtHB8otEtRnavQUPv16x9wwnIEv2WDGwMppJAp6Ok9uHij+r55EHvEBSegtCRcdVl8sH5sfYn6eyCMe+JSqt5svIq6tbzRDZ4RWD9gcpIWr8Ieaf1XFzFJvS1jsk3t+ZBGbs8G9 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAWPR08MB8958.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(1800799009)(186009)(451199024)(21480400003)(235185007)(83380400001)(2906002)(478600001)(66556008)(66476007)(66946007)(6666004)(33964004)(6506007)(6486002)(6916009)(316002)(44144004)(44832011)(2616005)(5660300002)(26005)(6512007)(41300700001)(4326008)(8936002)(8676002)(36756003)(86362001)(38100700002)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6616 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT007.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 15e6c549-74a6-4f52-e35c-08db9f0e061f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zJxuy2KpEo1quXayntotxU79cMOFAv9EjjBMoqXlrPtt76+40k49tbfb8lJ9pwKaC5JMibH7IdApXU/cbGsgmnKMbxMIKzfcEAgo0ieYH2+yS5UXChfd7k3ehUzIlCjApkzXmK5VY0udiaI7go23ToS4Dxu/3BFRCBXIK64s1BGnLth75od8GnwjcjAIVQ37GQuGUnaCMdOWCLchovOJBWXIvdmsvdO1vRUGUjDYeZeSUa0Z9EMfR30oiBMFEj+l1psQ0vKh2aodg9acb1nSduGC4yVABx2NwnmyW9EzWE9cHkera4pEDj0fmJgKN4H27mQPugEMA6A7SRmDdVVSF4zQLGeGRoQxv6l0f3w2GCcA0nJk+mx0GvnzpvbpteMqhdV425GaUI8TSjqbovfU4doseqVtxmjB5apJdLmo3nCvXqmEzoiGQP8fha3OMzCERnuMyn6dXiQLA5mdG48VZbtXu3HU+qFZD9LNBbvhDksCjm0IbuWi1ccUrJRK+aShBIallMGZuhd/KbPWF8n/gWzXxvVO+2dJ6HNLAs8aV/rb30LyEI8JMXe9HvpZPWxN9Akp4/Ixyx+LaPkXR+HzIxcRQtbFlubc6xwiwLs2owNJefnHYsW/w5PxSXuVW+gYI4R1DV4WvhsUnRoCwjyObIKzC1P4CeA7ZIijRbtji37YoMBW5G8PI2eLmb4/vsiwUX0BK1UK5/ATIz/ax2o98dYhghUaSvvnAKTTTGHot/njEsvdfXKF8aawBaYOxmXm3tO0KDkHVX9Yvwkd0zV+EQ== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230031)(4636009)(346002)(136003)(396003)(376002)(39860400002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(46966006)(36840700001)(2616005)(336012)(83380400001)(21480400003)(70206006)(5660300002)(316002)(70586007)(40480700001)(6916009)(26005)(2906002)(47076005)(36756003)(44832011)(6506007)(44144004)(33964004)(6512007)(36860700001)(6486002)(478600001)(82740400003)(6666004)(8936002)(81166007)(235185007)(356005)(40460700003)(86362001)(4326008)(8676002)(41300700001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2023 10:38:14.0175 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56166697-8c7b-44f6-e440-08db9f0e0f75 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT007.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB8047 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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: Alex Coplan via Gcc-patches From: Alex Coplan Reply-To: Alex Coplan Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774472402757803665 X-GMAIL-MSGID: 1774472402757803665 Hi, This patch fixes up the code examples in the RTL-SSA documentation (the sections on making insn changes) to reflect the current API. The main issues are as follows: - rtl_ssa::recog takes an obstack_watermark & as the first parameter. Presumably this is intended to be the change attempt, so I've updated the examples to pass this through. - The variants of recog and restrict_movement that take an ignore predicate have been renamed with an _ignoring suffix, so I've updated callers to use those names. - A couple of minor "obvious" fixes to add a missing address-of operator and correct a variable name. OK for trunk? Thanks, Alex gcc/ChangeLog: * doc/rtl.texi: Fix up sample code for RTL-SSA insn changes. diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi index 76aeafb8f15..0ed88f58821 100644 --- a/gcc/doc/rtl.texi +++ b/gcc/doc/rtl.texi @@ -4964,7 +4964,7 @@ the pass should check whether the new pattern matches a target instruction or satisfies the requirements of an inline asm: @smallexample -if (!rtl_ssa::recog (change)) +if (!rtl_ssa::recog (attempt, change)) return false; @end smallexample @@ -5015,7 +5015,7 @@ if (!rtl_ssa::restrict_movement (change)) insn_change_watermark watermark; // Use validate_change etc. to change INSN's pattern. @dots{} -if (!rtl_ssa::recog (change) +if (!rtl_ssa::recog (attempt, change) || !rtl_ssa::change_is_worthwhile (change)) return false; @@ -5048,7 +5048,7 @@ For example, if a pass is changing exactly two instructions, it might do: @smallexample -rtl_ssa::insn_change *changes[] = @{ &change1, change2 @}; +rtl_ssa::insn_change *changes[] = @{ &change1, &change2 @}; @end smallexample where @code{change1}'s instruction must come before @code{change2}'s. @@ -5066,7 +5066,7 @@ in the correct order with respect to each other. The way to do this is: @smallexample -if (!rtl_ssa::restrict_movement (change, insn_is_changing (changes))) +if (!rtl_ssa::restrict_movement_ignoring (change, insn_is_changing (changes))) return false; @end smallexample @@ -5078,7 +5078,7 @@ changing instructions (which might, for example, no longer need to clobber the flags register). The way to do this is: @smallexample -if (!rtl_ssa::recog (change, insn_is_changing (changes))) +if (!rtl_ssa::recog_ignoring (attempt, change, insn_is_changing (changes))) return false; @end smallexample @@ -5118,28 +5118,28 @@ Putting all this together, the process for a two-instruction change is: @smallexample auto attempt = crtl->ssa->new_change_attempt (); -rtl_ssa::insn_change change (insn1); +rtl_ssa::insn_change change1 (insn1); change1.new_defs = @dots{}; change1.new_uses = @dots{}; change1.move_range = @dots{}; -rtl_ssa::insn_change change (insn2); +rtl_ssa::insn_change change2 (insn2); change2.new_defs = @dots{}; change2.new_uses = @dots{}; change2.move_range = @dots{}; -rtl_ssa::insn_change *changes[] = @{ &change1, change2 @}; +rtl_ssa::insn_change *changes[] = @{ &change1, &change2 @}; auto is_changing = insn_is_changing (changes); -if (!rtl_ssa::restrict_movement (change1, is_changing) - || !rtl_ssa::restrict_movement (change2, is_changing)) +if (!rtl_ssa::restrict_movement_ignoring (change1, is_changing) + || !rtl_ssa::restrict_movement_ignoring (change2, is_changing)) return false; insn_change_watermark watermark; // Use validate_change etc. to change INSN1's and INSN2's patterns. @dots{} -if (!rtl_ssa::recog (change1, is_changing) - || !rtl_ssa::recog (change2, is_changing) +if (!rtl_ssa::recog_ignoring (attempt, change1, is_changing) + || !rtl_ssa::recog_ignoring (attempt, change2, is_changing) || !rtl_ssa::changes_are_worthwhile (changes) || !crtl->ssa->verify_insn_changes (changes)) return false;