From patchwork Fri May 6 15:53:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1627698 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=hzPU40zq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kvw9D6wgrz9sGq for ; Sat, 7 May 2022 01:54:07 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB56A394D899 for ; Fri, 6 May 2022 15:54:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB56A394D899 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1651852444; bh=LG3vfVekRRsXEG87vjC6g6ALKLMX/83w48mVHhB83tQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=hzPU40zqIBsvelXnsG3BNeCchOcJcu70woxGHD8wvlw2NqMp2t0LAneqhdhduBeVS bYhsMxz2/iEcXm8RloC0kx2bb7DtOw5nwDbxTPfTQKWZH/rzg+VNX+7SIFM7JJUC7v lJUhrriZbFqYAZp529b6QPBOra0g8UnSo6Ntk+gg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20069.outbound.protection.outlook.com [40.107.2.69]) by sourceware.org (Postfix) with ESMTPS id BA0CE3857404 for ; Fri, 6 May 2022 15:53:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BA0CE3857404 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=SYJcTCINATLnjoDoDMrHhMj81SEPU2YDcDYjKTEzkI2OEtErmbiTorxaGjikb39FURU2cdCZGZyGD/bKrrF6F2YaWA4FAgZrw+welNbYRJCpZ1/uuDnojzsrzNEpkzVbeDePrgrYEhQo1A6McKcsmCFFxFIxEU2Hor1E/vTHzKPdV2oWJx1ZDhzSQdY8Cpqd9rzjAay5WGcDW6Ph4Sh23aFLBa63kfWeYeDdFKHsoQiHx/aZLpYvHo/u77N8ZzeNFknrOVmdRWI364PZoW2kW0haGp4u8u7zphoraOGdRmJthPmG65Cd81HX68/LtvjIpCOG4Uthgxb7CNytFvW8PA== 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=LG3vfVekRRsXEG87vjC6g6ALKLMX/83w48mVHhB83tQ=; b=POCzdCdGSjZZOtomQdruCS+lYjmnZ8YMMz8znpPAq4Vso3qW3JKludAswoYmR41zMnoRZzHj2Ck2rScWuIvB14xXM31ZA2egOsky1d2cqynC7wj5jq7HqDXSlk4TnograFKa7N3slhjlmPch/TH8G9Xo0fE5+20YPeB2wERoB3WAyAPUn81sGlprjJt8KFZTlNi7q1Hzj5VixNvciuapUu0irmVHCi01v2AOOjRVdQJQ9V1rZByvtp2MRn4/mzapY5rBkzJWn7UHcr4qL+V9CcETLv5fC8nwoD48MO1rb3aDpa5A+6qQSLbOQmdn1NrJ+OaZ7FD3tKaDpI1BJ5cXUg== 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]) Received: from AM7PR03CA0012.eurprd03.prod.outlook.com (2603:10a6:20b:130::22) by VE1PR08MB4688.eurprd08.prod.outlook.com (2603:10a6:802:a3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13; Fri, 6 May 2022 15:53:35 +0000 Received: from VE1EUR03FT021.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:130:cafe::19) by AM7PR03CA0012.outlook.office365.com (2603:10a6:20b:130::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.27 via Frontend Transport; Fri, 6 May 2022 15:53: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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT021.mail.protection.outlook.com (10.152.18.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.15 via Frontend Transport; Fri, 6 May 2022 15:53:34 +0000 Received: ("Tessian outbound 2d401af10eb3:v118"); Fri, 06 May 2022 15:53:34 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9d8497c831cf4f57 X-CR-MTA-TID: 64aa7808 Received: from 1890c982716a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1F3327D2-6DB0-4506-AEC0-CF87EFEF33F9.1; Fri, 06 May 2022 15:53:27 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1890c982716a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 06 May 2022 15:53:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QPRV9cjPoTIAn5dwBoYPDfzyO2lV+Ww+F01iU6mEClxE0zUobtIiH8qO48VjUyoYnBAMZ8ZTD5aObhPjuoeSuZSzxyYhs5E2yyFxscqH1aDpKYm89/xgdmFM3XftRYqUdv+d/Q2ffAnvfM4AHF1T0ybaKW6Rh/vbcZvY5kiNuPVQ5ZOn9KPcEoOi5fYG7tbF9bjJ+HL0hgPHXo16Gfg8WEElbnjAiykx/VB2G/mH81lT9b0cRVu+lvBXnjoNZbMNBdFyFxSfdP+c4X2zFhA/6CObH4TSa3dzzew7TX23hQDpgdghjaKgQrApuKs6PrQO8u2mAQHUqsHKugAkI3Y0Ug== 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=LG3vfVekRRsXEG87vjC6g6ALKLMX/83w48mVHhB83tQ=; b=Q832l9S8kTyXLYUHpkqS+3Bzk4pfd8ZXhrOpAuUMGInUR4TYO/oWdsZIbm4zpNEBweCIEdp7Lxsc/iWt5rgaS3+Ckx2O5ez5GVXkCAeP96b8NYSJrx/Q8X5fsyNqgWc9Iq0JofdMMcNflrwgwNm/FpQTWdwClRnGQPRdPAvbNFSOuhwRDvVBxDGFHycgxNZpaQzibvuS8ZqDUwpUwU6LISmHwK0nMoK6mF6rcNy0mTwag0a+1TFwJxz7A3GMS5wB8o797ur22TZ5dvOIqfi4/pU3lZg9hyj/LxAKDtpOIeRlzvVgjvtVM3EkNKy7GCWve1sVbiPQvsTT4ud9qsRfnw== 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 PAXPR08MB7201.eurprd08.prod.outlook.com (2603:10a6:102:20b::17) by DB8PR08MB4202.eurprd08.prod.outlook.com (2603:10a6:10:ae::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Fri, 6 May 2022 15:53:26 +0000 Received: from PAXPR08MB7201.eurprd08.prod.outlook.com ([fe80::20f5:c008:a6a4:4763]) by PAXPR08MB7201.eurprd08.prod.outlook.com ([fe80::20f5:c008:a6a4:4763%4]) with mapi id 15.20.5227.020; Fri, 6 May 2022 15:53:25 +0000 Date: Fri, 6 May 2022 16:53:11 +0100 To: gcc-patches@gcc.gnu.org Subject: [PATCH v2] Enable match.pd dumping with -fdump-tree-original Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0158.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:188::19) To PAXPR08MB7201.eurprd08.prod.outlook.com (2603:10a6:102:20b::17) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 6ab7634b-8c85-4697-83cc-08da2f7893cb X-MS-TrafficTypeDiagnostic: DB8PR08MB4202:EE_|VE1EUR03FT021:EE_|VE1PR08MB4688:EE_ X-Microsoft-Antispam-PRVS: 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: iF84h2H4LNdM8GnVWsiZFeErvtLfXj/Va7R69mJ/cLLIYNO0t5P9M6uIQUeVdMqcoy/JFmwGfoHVkpMDuUZydfGuIHjNnl/sz3FUZh1nONZl4kumzWhUx9snVcoYcCb5yiHiTcHc+rPazaMf1qpl31FKmUI53jfGfPM3A7THxKoYD+gVSudhQbj3j5VUGemKh3tont0uldkC1jpZYLzmZVEjoUl0Gl5kkEWujvU3IEAiKsp/HF4dljBS2+/7LYNIIGkry9HNb+sfsSjZ9FpifILg87fNqyh94TOfxuXaTfW9a2ikKzNMBif8uQK5OOXVkYX5TnnrziI49Ahfv1rnmsTdVvWUDHrhY6Kl6fDTfjRIISSDoQLbnTA67X+CWZ7Ovqf+ibKXVhRoeX4J+uo+tijCQ3LU5vSYECtdT+2f5eczX9F8wXRmf58xCCE8abnsy8kJn27w8lyZ7FYFVgEKXHyXxPrumGMz10e0GPni7+8XcXJN6GbtI6jLNm1EZVZ8bDF/hWyL6JAyFXA66MEY78l5sjzw5LBzSoNASsvXcbY1WF+wdijquKsLz3du+Ueu9QnFLylHv3+EIELXbKWm37XzTfx9umK+RyVISOxEYajn8gMTKYMNHzos9TR6RrDkIPbeAbMUNl91ry6OGYUw2NvOLf+UDKk26GZGm6or8t17j4mqcgECM4y5x29MzCOEedRrXqVQ/6nMPCVkfDibI1AWB+F3HP6TTZEetQteE8NR2KvXSav3jqKGPt+TKWVZhWC3luLp15/V1LCd9WZajqrG6WK8ACQ5nteYlHLn/+s= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR08MB7201.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(508600001)(66556008)(66476007)(66946007)(33964004)(6512007)(21480400003)(83380400001)(8676002)(44832011)(36756003)(6486002)(8936002)(6916009)(4326008)(966005)(316002)(235185007)(5660300002)(44144004)(26005)(2906002)(6666004)(186003)(38100700002)(86362001)(2616005)(6506007)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4202 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: VE1EUR03FT021.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6a358eb7-d348-4c8f-1713-08da2f788e49 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: THrwnWLaYmIkBbIa4+ZIEXXH58HXsX0XNfIcMXaTvGxGtTn7gC9jhULzgMbyzYkUsunswbG55wXbgCFJjNS8ilGKaY2NGJSY6cl1hl2IlXxsrd5qJHwq/j8p8He19dtkDtNxSIbp0boiTQw+pDKDHStpiYgD8HkVif8uS6aJncP4nfoG+hEOku9s9Ps5ACKdD9n8S0ILTukdu93X/iRcDxtq2F9fRozm195iOlO7hM+LxEq4sAG+ah7TlmFTOAZ+h4jizpX3uH8tmKJGKgdtfcMwOcYm4cslWBZqg+B/zIMjCgUbtbdyLCDR/cQagM3IsL1ZzA4ghyt10wlBM4qKtXVDdremQ1tWjWXqLJF0wS3zToPoUmrfNzhLLY62jKEzE/ZUTk5hs/+PKD/PEKaw/uNGM4W1JFQ1w8Pzrib8I+N82oD1c3wr/pMI68w/dSIiSvJKAv/ZNr6YjbKdcDrpOnEEhHpcJNQ1ZzCiw2VhzDtSZ1uQpxO7rA6Di9MnvLYwC5YW4KQ8udnOaAwEd/l8qY2O3GzuenKUE5vdhk981JRYk1dSzZl/y+WvxsMeAO5HZKiGaqS4CnaNCb2KG8gQnGosR2TPv4WS4mNW2Exvc52RGDD9Z50XMcqrNexOYz+qYLeW+JmXoc2gVbgAIbT56JL5pMCtHvILI6cfK2BUsJOmMS/tj0aN4tqoZbZzbhKrdrKuhifwNtdpfbiK7aRcDBazqqFJ530R3C3z00MSQOu8XlGv5LPtEioqmVNT3zJ9ETWFqfIHSr5ASfn+qEvBdf3UAcZCnui0En/fly5g7uk= 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:(13230001)(4636009)(36840700001)(40470700004)(46966006)(6506007)(6486002)(508600001)(6916009)(6666004)(21480400003)(83380400001)(6512007)(966005)(33964004)(316002)(26005)(44144004)(336012)(107886003)(2616005)(186003)(47076005)(82310400005)(2906002)(356005)(4326008)(44832011)(235185007)(81166007)(8676002)(8936002)(40460700003)(5660300002)(70206006)(70586007)(36860700001)(86362001)(36756003)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2022 15:53:34.7113 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ab7634b-8c85-4697-83cc-08da2f7893cb 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: VE1EUR03FT021.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4688 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY, WEIRD_PORT 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-Patchwork-Original-From: Alex Coplan via Gcc-patches From: Alex Coplan Reply-To: Alex Coplan Cc: Richard Biener Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This is a respin of: https://gcc.gnu.org/pipermail/gcc-patches/2022-March/592307.html that implements Richard's suggestion around the cgraph.cc change. Otherwise the patch is as before. Bootstrapped and regtested on aarch64-linux-gnu, OK for trunk? Thanks, Alex ------ I noticed that, while the C/C++ frontends invoke the GENERIC match.pd simplifications to do early folding, the debug output from generic-match.cc does not appear in the -fdump-tree-original output, even with -fdump-tree-original-folding or -fdump-tree-original-all. This patch fixes that. For example, before the patch, for the following code: int a[2]; void bar (); void f() { if ((unsigned long)(a + 1) == 0) bar (); } on AArch64 at -O0, -fdump-tree-original-all would give: ;; Function f (null) ;; enabled by -tree-original { if (0) { bar (); } } After the patch, we get: Applying pattern match.pd:3774, generic-match.cc:24535 Matching expression match.pd:146, generic-match.cc:23 Applying pattern match.pd:5638, generic-match.cc:13388 ;; Function f (null) ;; enabled by -tree-original { if (0) { bar (); } } The reason we don't get the match.pd output as it stands, is that the original dump is treated specially in c-opts.cc: it gets its own state which is independent from that used by other dump files in the compiler. Like most of the compiler, the generated generic-match.cc has code of the form: if (dump_file && (dump_flags & TDF_FOLDING)) fprintf (dump_file, ...); But, as it stands, -fdump-tree-original has its own FILE * and flags in c-opts.cc (original_dump_{file,flags}) and never touches the global dump_{file,flags} (managed by dumpfile.{h,cc}). This patch adjusts the code in c-opts.cc to use the main dump infrastructure used by the rest of the compiler, instead of treating the original dump specially. We take the opportunity to make a small refactor: the code in c-gimplify.cc:c_genericize can, with this change, use the global dump infrastructure to get the original dump file and flags instead of using the bespoke get_dump_info function implemented in c-opts.cc. With this change, we remove the only use of get_dump_info, so this can be removed. Note that we also fix a leak of the original dump file in c_common_parse_file. I originally thought it might be possible to achieve this with only one static call to dump_finish () (by simply moving it earlier in the loop), but unfortunately the dump file is required to be open while c_parse_final_cleanups runs, as we (e.g.) perform some template instantiations here for C++, which need to appear in the original dump file. We adjust cgraph_node::get_create to avoid introducing noise in the original dump file: without this, these "Introduced new external node" lines start appearing in the original dump files, which breaks tests that do a scan-tree-dump-times on the original dump looking for a certain function name. gcc/c-family/ChangeLog: * c-common.h (get_dump_info): Delete. * c-gimplify.cc (c_genericize): Get TDI_original dump file info from the global dump_manager instead of the (now obsolete) get_dump_info. * c-opts.cc (original_dump_file): Delete. (original_dump_flags): Delete. (c_common_parse_file): Switch to using global dump_manager to manage the original dump file; fix leak of dump file. (get_dump_info): Delete. gcc/ChangeLog: * cgraph.cc (cgraph_node::get_create): Don't dump if the current symtab state is PARSING. diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 52a85bfb783..b829cdbfe28 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -950,7 +950,6 @@ extern bool c_common_post_options (const char **); extern bool c_common_init (void); extern void c_common_finish (void); extern void c_common_parse_file (void); -extern FILE *get_dump_info (int, dump_flags_t *); extern alias_set_type c_common_get_alias_set (tree); extern void c_register_builtin_type (tree, const char*); extern bool c_promoting_integer_type_p (const_tree); diff --git a/gcc/c-family/c-gimplify.cc b/gcc/c-family/c-gimplify.cc index a00b0a02dcc..a6f26c9b0d3 100644 --- a/gcc/c-family/c-gimplify.cc +++ b/gcc/c-family/c-gimplify.cc @@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see #include "dumpfile.h" #include "c-ubsan.h" #include "tree-nested.h" +#include "context.h" /* The gimplification pass converts the language-dependent trees (ld-trees) emitted by the parser into language-independent trees @@ -552,6 +553,7 @@ c_genericize_control_r (tree *stmt_p, int *walk_subtrees, void *data) void c_genericize (tree fndecl) { + dump_file_info *dfi; FILE *dump_orig; dump_flags_t local_dump_flags; struct cgraph_node *cgn; @@ -581,7 +583,9 @@ c_genericize (tree fndecl) do_warn_duplicated_branches_r, NULL); /* Dump the C-specific tree IR. */ - dump_orig = get_dump_info (TDI_original, &local_dump_flags); + dfi = g->get_dumps ()->get_dump_file_info (TDI_original); + dump_orig = dfi->pstream; + local_dump_flags = dfi->pflags; if (dump_orig) { fprintf (dump_orig, "\n;; Function %s", diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc index a341a061758..09a16b20f36 100644 --- a/gcc/c-family/c-opts.cc +++ b/gcc/c-family/c-opts.cc @@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see #include "mkdeps.h" #include "dumpfile.h" #include "file-prefix-map.h" /* add_*_prefix_map() */ +#include "context.h" #ifndef DOLLARS_IN_IDENTIFIERS # define DOLLARS_IN_IDENTIFIERS true @@ -100,10 +101,6 @@ static size_t deferred_count; /* Number of deferred options scanned for -include. */ static size_t include_cursor; -/* Dump files/flags to use during parsing. */ -static FILE *original_dump_file = NULL; -static dump_flags_t original_dump_flags; - /* Whether any standard preincluded header has been preincluded. */ static bool done_preinclude; @@ -1226,15 +1223,13 @@ c_common_init (void) void c_common_parse_file (void) { - unsigned int i; - - i = 0; - for (;;) + auto dumps = g->get_dumps (); + for (unsigned int i = 0;;) { c_finish_options (); /* Open the dump file to use for the original dump output here, to be used during parsing for the current file. */ - original_dump_file = dump_begin (TDI_original, &original_dump_flags); + dumps->dump_start (TDI_original, &dump_flags); pch_init (); push_file_scope (); c_parse_file (); @@ -1248,29 +1243,15 @@ c_common_parse_file (void) cpp_clear_file_cache (parse_in); this_input_filename = cpp_read_main_file (parse_in, in_fnames[i]); - if (original_dump_file) - { - dump_end (TDI_original, original_dump_file); - original_dump_file = NULL; - } /* If an input file is missing, abandon further compilation. cpplib has issued a diagnostic. */ if (!this_input_filename) break; + dumps->dump_finish (TDI_original); } c_parse_final_cleanups (); -} - -/* Returns the appropriate dump file for PHASE to dump with FLAGS. */ - -FILE * -get_dump_info (int phase, dump_flags_t *flags) -{ - gcc_assert (phase == TDI_original); - - *flags = original_dump_flags; - return original_dump_file; + dumps->dump_finish (TDI_original); } /* Common finish hook for the C, ObjC and C++ front ends. */ diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index 4bb9e7ba6af..d5c0e559f89 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -538,6 +538,7 @@ cgraph_node::get_create (tree decl) return first_clone; cgraph_node *node = cgraph_node::create (decl); + if (first_clone) { first_clone->clone_of = node; @@ -545,12 +546,12 @@ cgraph_node::get_create (tree decl) node->order = first_clone->order; symtab->symtab_prevail_in_asm_name_hash (node); node->decl->decl_with_vis.symtab_node = node; - if (dump_file) + if (dump_file && symtab->state != PARSING) fprintf (dump_file, "Introduced new external node " "(%s) and turned into root of the clone tree.\n", node->dump_name ()); } - else if (dump_file) + else if (dump_file && symtab->state != PARSING) fprintf (dump_file, "Introduced new external node " "(%s).\n", node->dump_name ()); return node;