From patchwork Fri Jan 19 09:04:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1888338 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=d9htlhCA; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=d9htlhCA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TGYc31hCZz1yPv for ; Fri, 19 Jan 2024 20:05:23 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 851D43858C74 for ; Fri, 19 Jan 2024 09:05:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2088.outbound.protection.outlook.com [40.107.8.88]) by sourceware.org (Postfix) with ESMTPS id 476253858C42 for ; Fri, 19 Jan 2024 09:04:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 476253858C42 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 476253858C42 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.8.88 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705655089; cv=pass; b=jMvVzRDS+InM6TZoQUVkS4IXgxCPIlZnVDgF7JyTUK61cbTz2KV+09ZO2sBOrq7wOROa3kpDFynwURHm8NmCaQw5OetvcnRihnBUbY/xPwC/Ey5saMKwrlxyymWNPMDgSCAqyP39QoS2TiR3EX/ES3nEKQGA/VLqo06JvmU3PYQ= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705655089; c=relaxed/simple; bh=y6vdRUzO3s7cN7ghGA+US5cSgnK+a99bK8oX0tfwmhY=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=F9J+tt2fontYCz5VqYLpWozKTBbXtDuHbTdbojpqKwjgfdlyLS+r+hmaeKBJHPjyCXRlJEw2yr2PO6fh5Y8DBGLvIXWqVVh2XEX3hRpsv4AfCU3aP5IepxINGzZuqPK4dDt8CHylTNv7i2aVziiqPXTU7Cb8EV5RzciCBAoDDYg= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=C7PfMs/qQEJKECr/1DLqd081fmHfqGggmd8mnwyEvOtAioFkDWwkRulP4CTpcpfwYGsRqipvehUjUXQGeAootAxGy8IN/2/VjMUrPPZZx7ZIbllWgZYT5USy+VwC5ilQbUZXYbfhLcbGwzPtGvfpYE6VEdlRV6XBboz2HAfQ3K+BvbIvrhQRsFTaAlBnA6OQ4Qe6k2U81pO3fdfUBRwkGGNbEwkmOzDGfmHJo7xVcnCF1g/fvVzwFs/YVA09eEqRbjnjOlPHe4WfU8n9NluQT80wlKfPf0Av/pvvPGXOOOYYAPuSvTGCwho5DN6xPC1b5+h3j75VlyC0Nzpo5NXfaA== ARC-Message-Signature: i=2; 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=r6QDyDRiVfIzOexU4aVRXlWRoELRm0nTD5HNeaIsAoo=; b=JvKM3zKTKS40AbTaH4mHPLFki/4dRHjVhyoGmh8yCvfzFysoVFnRzLLPR6kuNRpj78zxu+8qIH9f2wDgiXItkIgTP5LY39uLNBcXqS3McxUotqAwZQQaQln+i5W7uhesSHOXIWwDzQe7Vct5uDdgQX7gdIzttcEh2uKwI+8nJjOCoI2HkWRQu+VjTUjjUIDjQkbhiL+cmJGjENdWZb7MFfvaPYvcDKcqE1gCSBHlTLMAmzAH8QzXpH0mXT9ezYonknl4ejX5OloP3++AMJstqxKDcBpw61VFgTAFpMu7NhfsLshG+3lrqvJSS/gN4hVwj0XVT5lqSdHOEskKMlloCw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r6QDyDRiVfIzOexU4aVRXlWRoELRm0nTD5HNeaIsAoo=; b=d9htlhCA98rhvpYHLRJH3CUsU4TDAbdmmFnw2UEiQiJGjmZ2B512HOsGo92iNOollpGgr46YrOkAF6Cefu1/FNHg8o8/npF+VTo6V+D495vJM6Xs/hLEvrEm/gaHVLR2yBWcYgj8dMlVog5I9g81THRjvWft8nYqONlGT8JCxCM= Received: from DBBPR09CA0040.eurprd09.prod.outlook.com (2603:10a6:10:d4::28) by AS8PR08MB6117.eurprd08.prod.outlook.com (2603:10a6:20b:292::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 09:04:35 +0000 Received: from DB1PEPF00039230.eurprd03.prod.outlook.com (2603:10a6:10:d4:cafe::9f) by DBBPR09CA0040.outlook.office365.com (2603:10a6:10:d4::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24 via Frontend Transport; Fri, 19 Jan 2024 09:04:35 +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 DB1PEPF00039230.mail.protection.outlook.com (10.167.8.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.16 via Frontend Transport; Fri, 19 Jan 2024 09:04:34 +0000 Received: ("Tessian outbound a297577ee0df:v228"); Fri, 19 Jan 2024 09:04:35 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ffde4946e76be595 X-CR-MTA-TID: 64aa7808 Received: from 6e445a9994e9.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9419E0B7-F220-4FD8-96B8-AB71ADC48E9C.1; Fri, 19 Jan 2024 09:04:28 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6e445a9994e9.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 19 Jan 2024 09:04:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a4EZaxkAOGy8cC0rX04vSyS5KaCtP5k92ml5JQ/mpjmyhGitZXH3PUOdJl6ENDL5Pv50TcXrx7saPOEQ8GYT6otq1OiVxiexaNLw2/iEJ2C+edNTGHHYPXk0peTWzBOpQKXlvgpY+YK27n/9w3Gc4yyKyj0nU9xG3393SWn8pD4Yb0DXJOPisQC8sFl2j0y+2H4dw0qEPg6vYYk4xwCdBiXyAIOvNNVoJqZ7Zn64tNnbWMumV7jThefXqWdYj3wf/9iPjMKZsp4/o45jRuR87biyoyIxg/VyG0/9xMYCKl527nAwmsQHq9Aj9dw4BCfk+ZsnloA98IQTImHzNoaJ+Q== 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=r6QDyDRiVfIzOexU4aVRXlWRoELRm0nTD5HNeaIsAoo=; b=Q4dbFPwhmhku9By8fnUM2uD1J9fE2DgrrZZs++QFho4lLqV0XM83uJxuNHH7w5uLqzTYDhtFKtzR5dqcgJ8RRTOt0F0XZ7cHeMv6Sx4VRk13/Chk4CwrYD1CnstYGJEPvSToJc3lyenHAmymIBtJcJmcpJtA6XV+RPACO9MrxqS1tcA0a1iTU0vddNPSEdewZPsSugx8Apjx6fAvTVAqZ1CZ6kOyMtObSMHgJm2d/2yQL7jcax2S8RuwnQVfvNNNooFXapBb5LpLbMCShI2V/4JlGH9Isq+cRzXK58qYSoMSnWEfDzDK4OolNnMjhZ5e/v3L/RdfP02o9ygnww1t6Q== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r6QDyDRiVfIzOexU4aVRXlWRoELRm0nTD5HNeaIsAoo=; b=d9htlhCA98rhvpYHLRJH3CUsU4TDAbdmmFnw2UEiQiJGjmZ2B512HOsGo92iNOollpGgr46YrOkAF6Cefu1/FNHg8o8/npF+VTo6V+D495vJM6Xs/hLEvrEm/gaHVLR2yBWcYgj8dMlVog5I9g81THRjvWft8nYqONlGT8JCxCM= 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 DBBPR08MB5931.eurprd08.prod.outlook.com (2603:10a6:10:1f7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 09:04:26 +0000 Received: from PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::48ca:fbcb:84bf:ed17]) by PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::48ca:fbcb:84bf:ed17%4]) with mapi id 15.20.7202.024; Fri, 19 Jan 2024 09:04:25 +0000 Date: Fri, 19 Jan 2024 09:04:20 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford , Kyrylo Tkachov , Richard Earnshaw Subject: [PATCH 1/3] rtl-ssa: Provide easier access to debug uses [PR113089] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO2P123CA0039.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600::27) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|DBBPR08MB5931:EE_|DB1PEPF00039230:EE_|AS8PR08MB6117:EE_ X-MS-Office365-Filtering-Correlation-Id: 9985c909-377c-498c-3a30-08dc18cda83d 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: p3MbuWVIsRc/tKtX5BgkZobIJMldL0Zb5RfopY+C2IkMBFH9v6DlhqrAXkG6uL8rka7fbD8QJhC5Jz6o2ctMBL5jGmJ058ojNM+d/D/8IIHZLLytdn6a5zOUo1mC7nUp1cjcuT/DCL95JqiokAbYYDZ/C9c6gmMoZ0+EjNjxF2GZyC8AylQepp3oT/5EIOP/YqbjEMWcpzNz9khVfC6u4tiW8f4doUYCaYEL43UKq0lcEMj7CVL5UD02h8IZH+Eci/tsbAamtC65FUkXTGznvvr6P9YhV5hP3Eiyh0eEVSEINCWriDe4Pd+81/w0OUQzpknNiXRke3jjHbQ6kTiVkliScYainxFBGLAbygvknPxbsVqBuU7Bsglzp54anuwrh+k5eBkShNOaHhCxTBoCjtjRlv3YbPu5U9oP8juqqoSjl9f6ERMsVx2tVUHi5CMgL2uePOks1JqywXlkQUok3zwa29EIe8HEVfwNPws1jcryqOIYnNj5g1W/Tm9q0l/Hnogm3uPq8mHKN0dRxzk/jvQOoV4fMi6fSiB1SjRDs4KoFSfqmJgRNrZwZX5XxLwdnnVp4J+NPSqB4Ahd+xDoQoFtt6eoh528KvzOyBymc5QK10KVYSEDDULmZ3xUdLv1 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)(376002)(136003)(39860400002)(366004)(346002)(396003)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(83380400001)(44144004)(2616005)(38100700002)(33964004)(235185007)(26005)(8676002)(5660300002)(6512007)(54906003)(8936002)(4326008)(6506007)(41300700001)(6486002)(2906002)(6666004)(44832011)(66476007)(316002)(66556008)(478600001)(66946007)(6916009)(86362001)(36756003)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB5931 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: DB1PEPF00039230.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 832ef21e-ec73-4409-d634-08dc18cda258 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d3AA1A0jiHzdGlSZBL38voP8xSjJE2oRkWFOw2lwhyyod94eITNBYUmZ6F/vGAUGEkE5uZUYUHt6MFOyYHt6zJdJS2mP84fEkFOq6MAkOobK7aLlAcPrCPlwjCwCRvKN9gr6/J1QtJoNOBp3LLwS7MDEwoeHTG8SYVOBIwq3GZt0Gw4xlWQ1AFlm81NBRz4zbDxuEVP6f5mO6LpaQefksQ8uB3EMzxPQZVHgO1M66/zWISqsBemnyDfp0y610nMpBPegkeGgqAf50iFJiE7ORYIXoFfvA1wmoPmzGHs5AOvg0Ab5QXVGy04RZbc9hJyUhxWzI1d71TsSyqLQv/Zv10XENp9r0QKnO6qAo3RBCUfs5/GtXsW0OaPHRDTLOApi0BlOswOGka+YOXUEVyySVYsKSZthKyzKGVGpcYe40aN1FAcOHX8Ybq4itIgOSXJpjB+ddab6TK/zUSyAM0HsR0k5K5jHH1vqoZAASCdWUyDVy6uusW6VkFjeuChfq88hh8fknVnnQrr6l0fNzf8JSF5LXJqGD2RKIt0WcCs1xrQDrV7fP8CxqdKX7GacBYJtN/ID9cZBOu7ccIBfRpjrkFdTEOQOpIh0z9VtjfoV0iuUuhmx207HxIjRsjK9yvGlgowg1DJEBvBI7PwcBZTtVjjGafnntKTF1f2bi3fB1ynoN9eEQc1Rapw8KnhFNu1LIEgLttkhsydImvUgdkgYi6ZXoP0ZEkyWSHNKDuz67b4HWGbe/FBCnGXbTtxW1b6sp9uRzmmwlUPp6JmkhPOj5g== 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)(136003)(376002)(39860400002)(346002)(396003)(230922051799003)(451199024)(64100799003)(82310400011)(1800799012)(186009)(40470700004)(36840700001)(46966006)(2906002)(235185007)(36860700001)(36756003)(41300700001)(86362001)(356005)(81166007)(82740400003)(54906003)(316002)(6916009)(478600001)(70586007)(70206006)(6506007)(33964004)(44144004)(6486002)(4326008)(8936002)(6512007)(8676002)(47076005)(6666004)(5660300002)(83380400001)(336012)(44832011)(2616005)(26005)(40460700003)(40480700001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 09:04:34.9714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9985c909-377c-498c-3a30-08dc18cda83d 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: DB1PEPF00039230.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6117 X-Spam-Status: No, score=-12.0 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, T_SCC_BODY_TEXT_LINE, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org This patch adds some accessors to set_info and use_info to make it easier to get at and iterate through uses in debug insns. It is used by the aarch64 load/store pair fusion pass in a subsequent patch to fix PR113089, i.e. to update debug uses in the pass. Bootstrapped/regtested as a series on aarch64-linux-gnu (with/without the load/store pair pass enabled), OK for trunk? gcc/ChangeLog: PR target/113089 * rtl-ssa/accesses.h (use_info::next_debug_insn_use): New. (debug_insn_use_iterator): New. (set_info::first_debug_insn_use): New. (set_info::debug_insn_uses): New. * rtl-ssa/member-fns.inl (use_info::next_debug_insn_use): New. (set_info::first_debug_insn_use): New. (set_info::debug_insn_uses): New. --- gcc/rtl-ssa/accesses.h | 13 +++++++++++++ gcc/rtl-ssa/member-fns.inl | 29 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/gcc/rtl-ssa/accesses.h b/gcc/rtl-ssa/accesses.h index 6a3ecd32848..c57b8a8b7b5 100644 --- a/gcc/rtl-ssa/accesses.h +++ b/gcc/rtl-ssa/accesses.h @@ -357,6 +357,10 @@ public: // next_use () && next_use ()->is_in_any_insn () ? next_use () : nullptr use_info *next_any_insn_use () const; + // Return the next use by a debug instruction, or null if none. + // This is only valid if if is_in_debug_insn (). + use_info *next_debug_insn_use () const; + // Return the previous use by a phi node in the list, or null if none. // // This is only valid if is_in_phi (). It is equivalent to: @@ -458,6 +462,8 @@ using reverse_use_iterator = list_iterator; // of use in the same definition. using nondebug_insn_use_iterator = list_iterator; +using debug_insn_use_iterator + = list_iterator; using any_insn_use_iterator = list_iterator; using phi_use_iterator = list_iterator; @@ -680,6 +686,10 @@ public: use_info *first_nondebug_insn_use () const; use_info *last_nondebug_insn_use () const; + // Return the first use of the set by debug instructions, or null if + // there is no such use. + use_info *first_debug_insn_use () const; + // Return the first use of the set by any kind of instruction, or null // if there are no such uses. The uses are in the order described above. use_info *first_any_insn_use () const; @@ -731,6 +741,9 @@ public: // List the uses of the set by nondebug instructions, in reverse postorder. iterator_range nondebug_insn_uses () const; + // List the uses of the set by debug instructions, in reverse postorder. + iterator_range debug_insn_uses () const; + // Return nondebug_insn_uses () in reverse order. iterator_range reverse_nondebug_insn_uses () const; diff --git a/gcc/rtl-ssa/member-fns.inl b/gcc/rtl-ssa/member-fns.inl index 8e1c17ced95..e4825ad2a18 100644 --- a/gcc/rtl-ssa/member-fns.inl +++ b/gcc/rtl-ssa/member-fns.inl @@ -119,6 +119,15 @@ use_info::next_any_insn_use () const return nullptr; } +inline use_info * +use_info::next_debug_insn_use () const +{ + if (auto use = next_use ()) + if (use->is_in_debug_insn ()) + return use; + return nullptr; +} + inline use_info * use_info::prev_phi_use () const { @@ -212,6 +221,20 @@ set_info::last_nondebug_insn_use () const return nullptr; } +inline use_info * +set_info::first_debug_insn_use () const +{ + use_info *use; + if (has_nondebug_insn_uses ()) + use = last_nondebug_insn_use ()->next_use (); + else + use = first_use (); + + if (use && use->is_in_debug_insn ()) + return use; + return nullptr; +} + inline use_info * set_info::first_any_insn_use () const { @@ -310,6 +333,12 @@ set_info::nondebug_insn_uses () const return { first_nondebug_insn_use (), nullptr }; } +inline iterator_range +set_info::debug_insn_uses () const +{ + return { first_debug_insn_use (), nullptr }; +} + inline iterator_range set_info::reverse_nondebug_insn_uses () const {