From patchwork Fri Nov 15 12:22:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Malcomson X-Patchwork-Id: 1195594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513589-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="yK+XJXVp"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="63w6WpSs"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="63w6WpSs"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47DyDY6RnHz9sPJ for ; Fri, 15 Nov 2019 23:23:09 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type:mime-version; q=dns; s=default; b=azms8FBDFDkYidJWG2sRoyE8uCmdzsLxei8LOTAl71+JGaB93h YWlgxc52of4Spa4HdttYjKaYpibjoncQ5y+mDZ1v37RoehyAB6YpY5GskbFWqbqs y0tK6rpA7huLEix7CP+yJCcCJfC0+Agd2QR5GD/YByY4dwH4NrPQS/a/s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type:mime-version; s= default; bh=rZIdvjaz7e1QTrAWpX2tK4GcPUg=; b=yK+XJXVpeIP5JGfkGQ3b NMyMvlWx4yD3rQ16fEld80bUbqMZTKY3GFl8uQgLGoFgys4XdpTLmda4QA0GzWHY RFDFYj8ee7Li5H8m7a9dOIY4H7Rjslbu3KseDzq5swMyQzuhZwQx72Kf0DK0bCWC /ENkZ8Rc0h3gx7Jfnk8zMwg= Received: (qmail 116908 invoked by alias); 15 Nov 2019 12:23:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 116884 invoked by uid 89); 15 Nov 2019 12:23:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr140071.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (40.107.14.71) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Nov 2019 12:22:59 +0000 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=q3rX67IfvNOaJhG0K695ZZhnInKULw4SM2F3en2et4s=; b=63w6WpSsdQEaQ+PLwH9FeGM+O3ZWkyV4/7Y1WCn4y/QZFcBNLasVV9vE4YEnnI6cdqfMUsBaZXmJAz3FWhMWQSMJEXm1FUtPmVll/S28LDRycw9wntJ0RmdW4Eqn5Vjid8+w+xWEB+Wllw/O1lVz+zUAE5WPsFkztNlQx+2+K6E= Received: from HE1PR0802CA0017.eurprd08.prod.outlook.com (2603:10a6:3:bd::27) by DB7PR08MB3052.eurprd08.prod.outlook.com (2603:10a6:5:28::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.28; Fri, 15 Nov 2019 12:22:56 +0000 Received: from DB5EUR03FT038.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::204) by HE1PR0802CA0017.outlook.office365.com (2603:10a6:3:bd::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2451.23 via Frontend Transport; Fri, 15 Nov 2019 12:22:56 +0000 Authentication-Results: spf=fail (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; gcc.gnu.org; dmarc=none action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 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 DB5EUR03FT038.mail.protection.outlook.com (10.152.21.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2451.23 via Frontend Transport; Fri, 15 Nov 2019 12:22:55 +0000 Received: ("Tessian outbound 6481c7fa5a3c:v33"); Fri, 15 Nov 2019 12:22:55 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: cdd9ee05a249189c X-CR-MTA-TID: 64aa7808 Received: from 66fdc0b4c403.1 (cr-mta-lb-1.cr-mta-net [104.47.1.58]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8ECE2EB0-04A4-4A91-B54C-8085204A665B.1; Fri, 15 Nov 2019 12:22:50 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01lp2058.outbound.protection.outlook.com [104.47.1.58]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 66fdc0b4c403.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 Nov 2019 12:22:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hza1XW/xdwvbuRQw0Ts2BSrCVre9MlS6KU2Lx5sj83PRZqR/wx73YgsYTbm+2UJVSJnshdNbusZVJmd0rsFkq9LCOgFVqQbnXSRaKZVDfru0GKgBL6FphKOeTljrAQMMSx1MTOXkTFQkFrZQlDffNGbfDJHELlf+SdP7pdHoTRWz4MBbB77BKYAw32v0iHx8vc90khbxjII0D3phb57CwnINduHHzB2nDfmYzlBEbH/GTdfawiNCkkthva1+D+/Uunj0J0WxLNSQ4cpbueEA0C5VJPTxi9Gp73w7y0HMJQliOPJnwR01BuwJsG3DBCk4+rdXd0TY1jRjdNWFylltvA== 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-SenderADCheck; bh=q3rX67IfvNOaJhG0K695ZZhnInKULw4SM2F3en2et4s=; b=mWeUiJiS8/HM/se+KOwrOC4Ldbul164RQXMn06ML2oE9yoC4wuRyypo035tZpha9nMcK3qb2s6ZLSEyMvf/bbD0jWYTEMV1HnGxB4AC3GIRHNSRcztlI6hugMPoT1N+t6nQRPQ9gzeVgP/KQyPDp6ot2jWksdJQgOZoK+nZ79Cl8ZX9y3auCarYkYd/Ec+9oqx1ymIdOeEMbs+jkqKN7tPfPN22BuCE8PVQQFGe/b6q7lPVG8gpB00/nEogl6k3ndIUjI5BH1F/rXa9ymJzsyJ/nvAWh0JqYwBdxgF5hlpR5MRSuJE84uh0u2ECoolwuG1N75jVrnQJ2jr99ZiEYng== 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=q3rX67IfvNOaJhG0K695ZZhnInKULw4SM2F3en2et4s=; b=63w6WpSsdQEaQ+PLwH9FeGM+O3ZWkyV4/7Y1WCn4y/QZFcBNLasVV9vE4YEnnI6cdqfMUsBaZXmJAz3FWhMWQSMJEXm1FUtPmVll/S28LDRycw9wntJ0RmdW4Eqn5Vjid8+w+xWEB+Wllw/O1lVz+zUAE5WPsFkztNlQx+2+K6E= Received: from HE1PR0802MB2251.eurprd08.prod.outlook.com (10.172.131.21) by HE1PR0802MB2492.eurprd08.prod.outlook.com (10.175.34.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Fri, 15 Nov 2019 12:22:47 +0000 Received: from HE1PR0802MB2251.eurprd08.prod.outlook.com ([fe80::e120:9a38:bcf4:6075]) by HE1PR0802MB2251.eurprd08.prod.outlook.com ([fe80::e120:9a38:bcf4:6075%5]) with mapi id 15.20.2451.027; Fri, 15 Nov 2019 12:22:47 +0000 From: Matthew Malcomson To: "gcc-patches@gcc.gnu.org" CC: "ian@airs.com" , nd , "dmalcolm@redhat.com" , "law@redhat.com" , "rguenther@suse.de" Subject: [Patch] [mid-end][__RTL] Account for column numbers in __RTL functions Date: Fri, 15 Nov 2019 12:22:47 +0000 Message-ID: Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Matthew.Malcomson@arm.com; x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:9508;OLM:9508; X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(376002)(39860400002)(346002)(136003)(396003)(366004)(189003)(199004)(66066001)(478600001)(66446008)(26005)(6916009)(64756008)(66556008)(66616009)(66476007)(14454004)(66946007)(25786009)(54906003)(14444005)(5024004)(256004)(8936002)(316002)(6436002)(8676002)(81166006)(86362001)(81156014)(9686003)(186003)(52116002)(71200400001)(7696005)(15650500001)(71190400001)(33656002)(5660300002)(102836004)(4326008)(55016002)(5640700003)(74316002)(386003)(6506007)(2906002)(7736002)(305945005)(3846002)(6116002)(2501003)(476003)(52536014)(44832011)(2351001)(99286004)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0802MB2492; H:HE1PR0802MB2251.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: f1UUBiB8/g4s6MYUL8WURo5WjeWQgqeK/n4sq2EPZTkKL7L0MAmQOhmkmkTZ4r3gkKif1vth1VowlsI03YpIeoEiadPW3EtFiHiyq8N9zvTdU4HdfxpR/lphjXQiukYjy7BN0pD4OvjlogrPV4CefWck168UEhceyMeQ6D5/8sxpRxwLvaa2hD7Y8bWcZX6y+WY0iCnFmcWpe8nPhd1xbCVM38XFLuVlC6XUY8GMpn0thcu5xl8RKDJw7FWGkp/CQVseM0kzKlydXsojYQb75iONfNhS2/08ECjHJOwzkY6pB979hx/PoodhkgtFXyH8fHgD1UimibFVWGKbq4QRnD1VIMdQaAq52YN991Aey3TitgpKCKPVRFDWFlOaIneDRd81VsKrzD0eDfN1xOldnkixNrXf063Fo8fwya2D1kN9FcED9lxwM1c3EWdpvqvB x-ms-exchange-transport-forked: True MIME-Version: 1.0 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Matthew.Malcomson@arm.com; X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT038.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: da4c2903-e92b-42a4-3ff8-08d769c68659 X-IsSubscribed: yes The documentation for __RTL tests (see "(gccint) RTL Tests" info node) has the following snippet. ``` The parser expects the RTL body to be in the format emitted by this dumping function: DEBUG_FUNCTION void print_rtx_function (FILE *outfile, function *fn, bool compact); when "compact" is true. So you can capture RTL in the correct format from the debugger using: (gdb) print_rtx_function (stderr, cfun, true); and copy and paste the output into the body of the C function. ``` Since r264944 print_rtx_function prints column number information, which the __RTL function parsing does not handle. This patch handles column number information optionally, so pre-existing __RTL functions still work, and the above documentation quote still holds. I should note that none of the source information is used, so the only observable change is that the frontend does not complain when reading a column number. Note: If people would prefer to require column information I could make a slightly neater code and update existing tests. I guess this would be OK since the intended use for __RTL functions is in these testcases so there is no worry about other existing code. bootstrapped and regtested on aarch64 bootstrapped and regtested on x86_64 Ok for trunk? Cheers, Matthew ############### Attachment also inlined for ease of reply ############### diff --git a/gcc/read-rtl-function.c b/gcc/read-rtl-function.c index 53f7a94c1882018fede19fb5c760e71de65b6b61..210fd112f100d4e3ff5c8ad384746ae4b7844513 100644 --- a/gcc/read-rtl-function.c +++ b/gcc/read-rtl-function.c @@ -112,7 +112,7 @@ class function_reader : public rtx_reader int operand_idx, int bb_idx); void add_fixup_source_location (file_location loc, rtx_insn *insn, - const char *filename, int lineno); + const char *filename, int lineno, int colno); void add_fixup_expr (file_location loc, rtx x, const char *desc); @@ -1368,7 +1368,7 @@ function_reader::add_fixup_note_insn_basic_block (file_location loc, rtx insn, void function_reader::add_fixup_source_location (file_location, rtx_insn *, - const char *, int) + const char *, int, int) { } @@ -1554,7 +1554,20 @@ function_reader::maybe_read_location (rtx_insn *insn) require_char (':'); struct md_name line_num; read_name (&line_num); - add_fixup_source_location (loc, insn, filename, atoi (line_num.string)); + + int column = 0; + int ch = read_char (); + if (ch == ':') + { + struct md_name column_num; + read_name (&column_num); + column = atoi (column_num.string); + } + else + unread_char (ch); + add_fixup_source_location (loc, insn, filename, + atoi (line_num.string), + column); } else unread_char (ch); diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/rtl-handle-column-numbers.c b/gcc/testsuite/gcc.dg/rtl/aarch64/rtl-handle-column-numbers.c new file mode 100644 index 0000000000000000000000000000000000000000..576f9b9a83d1eaad95c816409d274ddf6ad9fb92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/rtl/aarch64/rtl-handle-column-numbers.c @@ -0,0 +1,20 @@ +int __RTL (startwith ("cprop_hardreg")) +foo () +{ +(function "f" + (insn-chain + (block 2 + (edge-from entry (flags "FALLTHRU")) + (cnote 6 [bb 2] NOTE_INSN_BASIC_BLOCK) + (cinsn 100 (set (reg:DI x0) + (plus:DI + (reg:DI x1) + (const_int 16777213))) + "/home/user/somefile.c":10:3) + ;; Extra insn, to avoid all of the above from being deleted by DCE + (cinsn 10 (use (reg/i:DI x0))) + (edge-to exit (flags "FALLTHRU")) + ) ;; block 2 + ) ;; insn-chain +) ;; function +} diff --git a/gcc/read-rtl-function.c b/gcc/read-rtl-function.c index 53f7a94c1882018fede19fb5c760e71de65b6b61..210fd112f100d4e3ff5c8ad384746ae4b7844513 100644 --- a/gcc/read-rtl-function.c +++ b/gcc/read-rtl-function.c @@ -112,7 +112,7 @@ class function_reader : public rtx_reader int operand_idx, int bb_idx); void add_fixup_source_location (file_location loc, rtx_insn *insn, - const char *filename, int lineno); + const char *filename, int lineno, int colno); void add_fixup_expr (file_location loc, rtx x, const char *desc); @@ -1368,7 +1368,7 @@ function_reader::add_fixup_note_insn_basic_block (file_location loc, rtx insn, void function_reader::add_fixup_source_location (file_location, rtx_insn *, - const char *, int) + const char *, int, int) { } @@ -1554,7 +1554,20 @@ function_reader::maybe_read_location (rtx_insn *insn) require_char (':'); struct md_name line_num; read_name (&line_num); - add_fixup_source_location (loc, insn, filename, atoi (line_num.string)); + + int column = 0; + int ch = read_char (); + if (ch == ':') + { + struct md_name column_num; + read_name (&column_num); + column = atoi (column_num.string); + } + else + unread_char (ch); + add_fixup_source_location (loc, insn, filename, + atoi (line_num.string), + column); } else unread_char (ch); diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/rtl-handle-column-numbers.c b/gcc/testsuite/gcc.dg/rtl/aarch64/rtl-handle-column-numbers.c new file mode 100644 index 0000000000000000000000000000000000000000..576f9b9a83d1eaad95c816409d274ddf6ad9fb92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/rtl/aarch64/rtl-handle-column-numbers.c @@ -0,0 +1,20 @@ +int __RTL (startwith ("cprop_hardreg")) +foo () +{ +(function "f" + (insn-chain + (block 2 + (edge-from entry (flags "FALLTHRU")) + (cnote 6 [bb 2] NOTE_INSN_BASIC_BLOCK) + (cinsn 100 (set (reg:DI x0) + (plus:DI + (reg:DI x1) + (const_int 16777213))) + "/home/user/somefile.c":10:3) + ;; Extra insn, to avoid all of the above from being deleted by DCE + (cinsn 10 (use (reg/i:DI x0))) + (edge-to exit (flags "FALLTHRU")) + ) ;; block 2 + ) ;; insn-chain +) ;; function +}