From patchwork Mon Jan 15 11:27:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Carlotti X-Patchwork-Id: 84093 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3A27E385770F for ; Mon, 15 Jan 2024 11:28:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) by sourceware.org (Postfix) with ESMTPS id 871503857B8E for ; Mon, 15 Jan 2024 11:27:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 871503857B8E 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 871503857B8E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.22.76 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705318055; cv=pass; b=Nuvk+REnGfZDFuCEhf+WROXcLTwxOHNcnJW1EvpmL3hJzFXkteEAxpcTGGSyE1SCO8ycuWqa1GrxP9HTHbjz4cqkt6J2sm3vLpXY9woCwjVQ30hAmKQUWRc/tXHSRRH/bddGsfrq3TxsQ20p0HpPdm1EWh1SSIp0X98LNQMLEjA= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1705318055; c=relaxed/simple; bh=xR+V75VlrO6vOeeuvM8pIR6Qlukc20yvyr/sSyArvOo=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=Uc2HZk9PobYlKn71WfspS5Nmz+5UIQM3uM3Gg+0xMnNd6l13kT1PTt5LBvy8MHSkixIb6J/jXO8CsVpwVM1bvaIJVD9+XEqG0qojZckxFLi9sHoVQ9mQoPya1zJ/uUVL6zN6xdkIjZSYQuRuwo6N2Dr9GlQy5zvYR3Eo0wW3d6A= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Z9prRiV8evDIAnj9HzqguokHuL+b47r1TAV/NyIkJVJPVz8KaV/BN10hsgjR9GhLz9/0EtdezUx2sKptSBfrSOOqexNsWQM4jeHHCS4qD2R+WjyCrMW9b2a75gWDF0p4EZCrQ0U0nig+5HE1yHjdcimvKI0hB+Rdd98e/5mb2VKS9peHC0cW0ciq2k01v7/K5ZwH+01QCnB4fDXzGv34jC3dllqVCvjmX/G4GRzpnOaEcGgf9HKnVoNQNQxnUjbw36HPh7PKMXFGscqbtPyC3f4UvTHk55QtuCrl7ibXj48mAaUT42rJWj0euUXh7LstaoLWjHsMKDqHdCXuwcxJdg== 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=RUsytf17P2l/zzyh7kr64Fo5R2aCekQBDcxRImM3akI=; b=ITQXjSfx0Nh3la1GpI4gP9BlftbKQeN4D52/wKKW44FI0MGS6ejpiu9V9E0p5+GqyXQ+Cu9xAY5duJ0QTdcxiaV4XL2HJEf0F6uYDooLNIH1iXMsmZbwcIonvmkmLtsOfCDhbt7XH5jF8Rh1mdUCNoxQiKm2TGK/qqhtbAiYMaIZwIkSeLwncb/tfsHFxcxVACIvemKGX5d9Fbfw0cJsV11zS2UM/g3azRsK/DWT2wwpg6BUIwP0Sh9QTRKWC0XZ8CkfRD+SRzjTxBf29ah5zXe/JimFLfYrA8e2m3BQPKn2Lho1TqbjdOdz8tbgqTCApN+6t59uxs9hec7wrWg74g== 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=RUsytf17P2l/zzyh7kr64Fo5R2aCekQBDcxRImM3akI=; b=ftxuVSxzMhKPo6L3Cd1s2kYn9i4ajYyQtyZIUN1ocpda0HqGSC8SOvEh5SW006PCFxJ567cAbINRAHAJAB55cn57mXLvhsfstHOE5e0HiZlnTay2OoCfXmCoelN/mmabaAPOtTr0e0KgJl+W5S30jhKO2fnhg2hwcdqzCYw3N2A= Received: from AM0PR02CA0034.eurprd02.prod.outlook.com (2603:10a6:208:3e::47) by GV1PR08MB10790.eurprd08.prod.outlook.com (2603:10a6:150:16a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.17; Mon, 15 Jan 2024 11:27:22 +0000 Received: from AM3PEPF00009BA2.eurprd04.prod.outlook.com (2603:10a6:208:3e:cafe::4) by AM0PR02CA0034.outlook.office365.com (2603:10a6:208:3e::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.26 via Frontend Transport; Mon, 15 Jan 2024 11:27:21 +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 AM3PEPF00009BA2.mail.protection.outlook.com (10.167.16.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.16 via Frontend Transport; Mon, 15 Jan 2024 11:27:21 +0000 Received: ("Tessian outbound 67699c3f02bc:v228"); Mon, 15 Jan 2024 11:27:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: cb893ae6d2128838 X-CR-MTA-TID: 64aa7808 Received: from 20c0c448d76a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 27D3F291-5572-4EB6-8A7D-1505964EF6DE.1; Mon, 15 Jan 2024 11:27:14 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 20c0c448d76a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Jan 2024 11:27:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=guVlpMiGOrGhaHlTyQSc+F/vUtj5gMb4G6KpeJwYvs7f9nAASQp8DqccJpjYRzVYM8Iod8RAuKKnlzVVJ1bYTEaSEkXXH8wfSAyFYK+RdmytOFpnLnLIZzZpiDjEJNe1y5rdU7V4XHE4G3UhmICmgxI31FpJThyKIrXAhiGhTyyS2QFBt72thEChdekqRKeipeuT4o3VlihZabfAAovT/ITWViXFx3YqLw6z1ZDjnyUTxa8RxwuGAxGK78ITosgf93US6btUZMXYu1hsOGa8gYRwJDgEvofMLvi2iL22hhz2fCgfQAAgp65NeYRU3aeW2Xsp8+i8o47MaulzsdimSg== 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=RUsytf17P2l/zzyh7kr64Fo5R2aCekQBDcxRImM3akI=; b=IbGScijajcxsjmY2Xoe0XgBHmUAaFqZDSpZCFEvj9BiDyob4/15I4GNI/6r0Loep4lY2kY6cJj+vJ5bAuHziybBaiYUWmmg3v992L/hGcL1GrDDPJ20rHH9PG0bYQuagIqwYKzNybJ7NpBJMEtetmJrYFm0Gh0T9wC6YgGoVfhIAZj0E0xuaRT20ujwfblKRYXX0GG0HSInpZMc1wivIXYRpJj1krEW3KlFwtMUxzNtOZOuf66jNoaPCGNzvhtyPrXahx970fw2zXXPGUB9JEm2K0ma/HdP6W8P8nK9fqdxmzRhjVLrm4Uo6qTLJFMKQ01cIzacbsRJCzzpCmixLzg== 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=RUsytf17P2l/zzyh7kr64Fo5R2aCekQBDcxRImM3akI=; b=ftxuVSxzMhKPo6L3Cd1s2kYn9i4ajYyQtyZIUN1ocpda0HqGSC8SOvEh5SW006PCFxJ567cAbINRAHAJAB55cn57mXLvhsfstHOE5e0HiZlnTay2OoCfXmCoelN/mmabaAPOtTr0e0KgJl+W5S30jhKO2fnhg2hwcdqzCYw3N2A= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6678.eurprd08.prod.outlook.com (2603:10a6:20b:398::8) by DU0PR08MB8929.eurprd08.prod.outlook.com (2603:10a6:10:464::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.19; Mon, 15 Jan 2024 11:27:12 +0000 Received: from AS8PR08MB6678.eurprd08.prod.outlook.com ([fe80::a997:a5ad:3e6:44b6]) by AS8PR08MB6678.eurprd08.prod.outlook.com ([fe80::a997:a5ad:3e6:44b6%4]) with mapi id 15.20.7181.022; Mon, 15 Jan 2024 11:27:12 +0000 Date: Mon, 15 Jan 2024 11:27:10 +0000 From: Andrew Carlotti To: gcc-patches@gcc.gnu.org Cc: Richard Biener Subject: [PATCH 2/5] tree: Extend DECL_FUNCTION_VERSIONED to an enum Message-ID: <149a20f9-2f84-fb38-9cfb-1de2c38a39d6@e124511.cambridge.arm.com> References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO2P265CA0249.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::21) To AS8PR08MB6678.eurprd08.prod.outlook.com (2603:10a6:20b:398::8) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AS8PR08MB6678:EE_|DU0PR08MB8929:EE_|AM3PEPF00009BA2:EE_|GV1PR08MB10790:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a61f677-21da-42b0-ddbb-08dc15bcf06c 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: 8pqepgvTzuiy8JqfCSxquEXbrwdrT8GZVUrsMtZNrNIJEkJzU9byc4OReyJY2RHdWZvW5lAFb+0I5dQu+k/kWhi7LgPoJKgq7u4B28hc/0Ui9bsvYr2CCXbu5geAGKLYeFhfpJizFOTmCHcfU1/KcgXjsK7jz9a8+jgFa59DYJ7CWnFCJ9T6RVHAvfFi8gY4ya2Ilw42ui/Sg56F+Ed3FxS197nL+vL7qn9JUKM9L9Kobj4W6lU22Jnn3PQR9AS+krxrn9IqMHvelZqA7v4IaGBYxlkLMGWjmuRZMxZi+Etm7rtM8mCjEUBhk5Wng8ikNTLnquYGlb7F3EuZ1WuXvSp/Tn/oa3fqPoynf6Z2IbQId10utsly8Ro2yqbRL0gcs2WKvm2CAxdY1MowIh6sBHaFechSGYqt35Eh8rcsCBJLPb4Iu9pRih0BpZr8at9rBbSSXU45Uk88PKXP+qsJyixyizZUgJNwlKIdceRWVPYrQxLqFC9ylTEC3K8ptGtgm0weuvUm5zwRsPsln5GT7rMpUFLJMT8Bh3tP4N8Ofp1ocFR6n++xxQs8LFfSnPXI X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB6678.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(366004)(376002)(136003)(396003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(66946007)(6916009)(66476007)(66556008)(44832011)(6506007)(6512007)(316002)(6486002)(478600001)(41300700001)(8676002)(8936002)(4326008)(2906002)(5660300002)(83380400001)(31696002)(26005)(31686004)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8929 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: AM3PEPF00009BA2.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a0bd48f1-382c-4311-6fa9-08dc15bceb08 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sMHSS7Jk9e7y568Nmr8tB6+/D8ilywmNaLqXaRmAlQ837eEx9/KR8HUwyyK+XMWgcsz3VjZ/QMn/EOKWqio3/1xSa3Lwk+zfF7HL5lEp3JIUQZLpP9bv0GaJpjbEaAU/vlZttvwalyHTwS2eoJK98PS18GnQsVuRIPAiYn8xnGdqBWNQ3pHk0G+v70UK8xCfR8Xgx5BdUQuU13yNz2nUajbCIRr1j4AQZmKmMP9Dy43c29+3PoRgugpRzXZx1mNlBhkM3krn0pBqDXk+9YLOWJzMY1dmrrEuTjxHs3Y8fIoeaSPDdjmwF56BEwdtqblQBP0l4MJ9Zf3h64RIkIzo0PI6c48HBhKkzHZkZoFgNsKPokFocgL0hqYGsz3+i30pmjT+YTbcpNuthvl4AYKPW9ZKyEp8O6y6/w1g1SW/MztPkyyTsrdE9EEFodCpYFCBUWPqsZulVi1PI1BPM4Tm7/yIYx+Swqoo5fSDCOtBuAwkYVEQdy5hm4qXMlDFXtePwdVbHOk5WEnCeBoK5h25CUUV5FWeaiBrtgzwDTDiCzCkrH8UHlexZ1JMvFPQqk0mwaXMqwhQax4Fg0umHRczGQvH3xsX0W4pxXyAHlEk+VKQp7Rh3SEhXYjvO4FXaVRXuVSA/szFkKcJqZM9O+p6CNPs+4uPkFcOUYxPpVSWdNznt1PchDd+oKpO6c6x+YjSr/bmTQclvGHw/Et/XI4yCwPuvjsJjveQmubC+5YpYIgt8TBlpthPrFw6kn+3LzIV 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)(39860400002)(346002)(396003)(376002)(136003)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(82310400011)(40470700004)(36840700001)(46966006)(41300700001)(82740400003)(356005)(81166007)(31686004)(40480700001)(86362001)(40460700003)(26005)(31696002)(107886003)(336012)(6506007)(6512007)(478600001)(316002)(6916009)(36860700001)(70206006)(6486002)(8676002)(47076005)(70586007)(83380400001)(2906002)(5660300002)(8936002)(44832011)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2024 11:27:21.0844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a61f677-21da-42b0-ddbb-08dc15bcf06c 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: AM3PEPF00009BA2.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB10790 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY, URIBL_BLACK 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+patchwork=sourceware.org@gcc.gnu.org This allows code to determine why a particular function is multiversioned. For now, this will primarily be used to preserve existing name mangling quirks when subsequent commits change all function multiversioning name mangling to use explicit target hooks. However, this can also be used in future to allow more of the multiversioning logic to be moved out of target hooks, and to allow targets to simultaneously enable multiversioning with both 'target' and 'target_version' attributes. gcc/ChangeLog: * multiple_target.cc (expand_target_clones): Use new enum value. * tree-core.h (enum function_version_source): New enum. (struct tree_function_decl): Extend versioned_function to two bits. gcc/cp/ChangeLog: * decl.cc (maybe_mark_function_versioned): Use new enum value. (duplicate_decls): Preserve DECL_FUNCTION_VERSIONED enum value. * module.cc (trees_out::core_bools): Use two bits for function_decl.versioned_function. (trees_in::core_bools): Ditto. diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index b10a72a87bf0a1cabab52c1e4b657bc8a379b91e..527931cd90a0a779a508a096b2623351fd65a2e8 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -1254,7 +1254,10 @@ maybe_mark_function_versioned (tree decl) { if (!DECL_FUNCTION_VERSIONED (decl)) { - DECL_FUNCTION_VERSIONED (decl) = 1; + if (TARGET_HAS_FMV_TARGET_ATTRIBUTE) + DECL_FUNCTION_VERSIONED (decl) = FUNCTION_VERSION_TARGET; + else + DECL_FUNCTION_VERSIONED (decl) = FUNCTION_VERSION_TARGET_VERSION; /* If DECL_ASSEMBLER_NAME has already been set, re-mangle to include the version marker. */ if (DECL_ASSEMBLER_NAME_SET_P (decl)) @@ -3159,7 +3162,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden) && DECL_FUNCTION_VERSIONED (olddecl)) { /* Set the flag for newdecl so that it gets copied to olddecl. */ - DECL_FUNCTION_VERSIONED (newdecl) = 1; + DECL_FUNCTION_VERSIONED (newdecl) = DECL_FUNCTION_VERSIONED (olddecl); /* newdecl will be purged after copying to olddecl and is no longer a version. */ cgraph_node::delete_function_version_by_decl (newdecl); diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index aa75e2809d8fdca14443c6b911bf725f6d286d20..ba60d0753f91ef91d45fb5d62f26118be4e34840 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -5473,7 +5473,11 @@ trees_out::core_bools (tree t) WB (t->function_decl.looping_const_or_pure_flag); WB (t->function_decl.has_debug_args_flag); - WB (t->function_decl.versioned_function); + + /* versioned_function is a 2 bit enum. */ + unsigned vf = t->function_decl.versioned_function; + WB ((vf >> 0) & 1); + WB ((vf >> 1) & 1); /* decl_type is a (misnamed) 2 bit discriminator. */ unsigned kind = t->function_decl.decl_type; @@ -5618,7 +5622,12 @@ trees_in::core_bools (tree t) RB (t->function_decl.looping_const_or_pure_flag); RB (t->function_decl.has_debug_args_flag); - RB (t->function_decl.versioned_function); + + /* versioned_function is a 2 bit enum. */ + unsigned vf = 0; + vf |= unsigned (b ()) << 0; + vf |= unsigned (b ()) << 1; + t->function_decl.versioned_function = function_version_source (vf); /* decl_type is a (misnamed) 2 bit discriminator. */ unsigned kind = 0; diff --git a/gcc/multiple_target.cc b/gcc/multiple_target.cc index 1fdd279da04a7acc5e8c50f528139f19cadcd5ff..56a1934fe820e91b2fa451dcf6989382c906b98c 100644 --- a/gcc/multiple_target.cc +++ b/gcc/multiple_target.cc @@ -383,7 +383,7 @@ expand_target_clones (struct cgraph_node *node, bool definition) if (decl1_v == NULL) decl1_v = node->insert_new_function_version (); before = decl1_v; - DECL_FUNCTION_VERSIONED (node->decl) = 1; + DECL_FUNCTION_VERSIONED (node->decl) = FUNCTION_VERSION_TARGET_CLONES; for (i = 0; i < attrnum; i++) { @@ -421,7 +421,8 @@ expand_target_clones (struct cgraph_node *node, bool definition) before->next = after; after->prev = before; - DECL_FUNCTION_VERSIONED (new_node->decl) = 1; + DECL_FUNCTION_VERSIONED (new_node->decl) + = FUNCTION_VERSION_TARGET_CLONES; } XDELETEVEC (attrs); diff --git a/gcc/tree-core.h b/gcc/tree-core.h index 8a89462bd7ecac52fcdc11c0b57ccf7c190572b3..e159d53f9d11ba848c49499aa963daa2fbcbc648 100644 --- a/gcc/tree-core.h +++ b/gcc/tree-core.h @@ -1955,6 +1955,19 @@ enum function_decl_type /* 0 values left */ }; +/* Enumerate function multiversioning attributes. This is used to record which + attribute enabled multiversioning on a function, and allows targets to + adjust their behaviour accordingly. */ + +enum function_version_source +{ + FUNCTION_VERSION_NONE = 0, + FUNCTION_VERSION_TARGET = 1, + FUNCTION_VERSION_TARGET_CLONES = 2, + FUNCTION_VERSION_TARGET_VERSION = 3 +}; + + /* FUNCTION_DECL inherits from DECL_NON_COMMON because of the use of the arguments/result/saved_tree fields by front ends. It was either inherit FUNCTION_DECL from non_common, or inherit non_common from FUNCTION_DECL, @@ -2002,10 +2015,10 @@ struct GTY(()) tree_function_decl { /* Align the bitfield to boundary of a byte. */ ENUM_BITFIELD(function_decl_type) decl_type: 2; unsigned has_debug_args_flag : 1; - unsigned versioned_function : 1; + ENUM_BITFIELD(function_version_source) versioned_function : 2; unsigned replaceable_operator : 1; - /* 11 bits left for future expansion. */ + /* 10 bits left for future expansion. */ /* 32 bits on 64-bit HW. */ };