From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by sourceware.org (Postfix) with ESMTPS id E86B23858439 for ; Tue, 16 May 2023 01:12:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E86B23858439 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684199533; x=1715735533; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=MEY75ewtXgCJ0GQuRcs0YnIFz9w3ru0YaCs1wDAAqho=; b=fJcpmWMapP/8q3CgS/wnbAIbPnwVl5zuynFQx5Q9zeOeh/mnuyL3puFa EGJSvV3PLxbm7880udWCGCC8XZIVUlaSO0ExSX5OaLTs88AETlRQ0/cBS XH0/cdhan52dvOMBrSwadl2XA7K7Nmdf7geUI5CAZOq1tRTXPIKg+0bHr Ikc9lOwcc47iZGfkRMgMhXMa94RdxPrQCgPneN+q4p8YzHx8gxy5rp0Fg nD/EylR7BqExuYrk89/pYcOKhW7soXx2gFD7OHp+gczOuG2Uy+EDrVvtM iCV7bdF/kLcOVeqmXi/5YzaYkXv3D4bwJA3k0mSm9CAEY3YBQKVNDCESB A==; X-IronPort-AV: E=McAfee;i="6600,9927,10711"; a="379523544" X-IronPort-AV: E=Sophos;i="5.99,277,1677571200"; d="scan'208";a="379523544" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2023 18:12:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10711"; a="651625410" X-IronPort-AV: E=Sophos;i="5.99,277,1677571200"; d="scan'208";a="651625410" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga003.jf.intel.com with ESMTP; 15 May 2023 18:12:12 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 15 May 2023 18:12:12 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 15 May 2023 18:12:11 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Mon, 15 May 2023 18:12:11 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.47) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Mon, 15 May 2023 18:12:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b6glQkYBieXXWFvH2Bs4QPofUo/eBvqBMJvPAXypia/bc6ph1q1oo0mxbQMx3B1PaJxcI4FYwfrgzmN81C7Ec2v6z5WJ9a2J2auEK4wiN7fdTlufoBUzrhC0oBA/HLOCj/40nqvysSLCmOj+nJnXVUcnqAxY++vf5s+aYO/fdP+Ja9B81xdUzKPinSHJdIkbi4KAq+gFFOQlzmsbiKF3Mq4kGHUkoBzjNWiD2usDtbW7AptliAxVPbpyZRYGnMD3UBNNwL0HGQolfL4AnHO1Oh1hrh+2hpNYR6JmWFIGUxFiFBvqGjlI9stPoRMykCsgsA4mj7DeSMqlYn0E/E5PRw== 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=mldEz8mg8SgOHdusyqUa0LyVabk+7f9iCKCdhQmGzBM=; b=KNUSixywWf0POyhf6QwgGVKJrf+ogC42Bz2FTrX+ufBxwjsCY3gZWRu7c+UNxb35k43ifPHzmjhrJs8u4tEZOjvb1pBQy3ImzgiV+4HrZCrP6HpoNsTo6/GqvkqmWD7RoY+lTlOBQOlA4h+lgYPem5EESRFE+HxPynR2l9bNOW8xV47eyjeyzCYwGMW02FkDZKc2qPqsvi0XOVbrYnNqwvQVBTrtk61l+hEYHKTQKy2cIUpzIx9Oeyxa2Gb8gRqYYh6g56PwelJX301N7WqQ/4hgFDbhXGzG2BpoRNuBj/Fc1U8KQ6ORxzLOrQ86kYVm9zsYNHhsVwCXwzE6+fgv7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MW5PR11MB5908.namprd11.prod.outlook.com (2603:10b6:303:194::10) by PH0PR11MB5189.namprd11.prod.outlook.com (2603:10b6:510:3d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Tue, 16 May 2023 01:12:09 +0000 Received: from MW5PR11MB5908.namprd11.prod.outlook.com ([fe80::bbc5:f013:1f53:10a9]) by MW5PR11MB5908.namprd11.prod.outlook.com ([fe80::bbc5:f013:1f53:10a9%3]) with mapi id 15.20.6387.030; Tue, 16 May 2023 01:12:09 +0000 From: "Li, Pan2" To: "gcc-patches@gcc.gnu.org" CC: "juzhe.zhong@rivai.ai" , "kito.cheng@sifive.com" , "Wang, Yanzhang" , "jeffreyalaw@gmail.com" , "rguenther@suse.de" , "richard.sandiford@arm.com" Subject: RE: [PATCH v3] Machine_Mode: Extend machine_mode from 8 to 16 bits Thread-Topic: [PATCH v3] Machine_Mode: Extend machine_mode from 8 to 16 bits Thread-Index: AQHZhZy5KDlJLdzko0m9KcEdCFzeZq9cG45g Date: Tue, 16 May 2023 01:12:09 +0000 Message-ID: References: <20230513131325.1667305-1-pan2.li@intel.com> In-Reply-To: <20230513131325.1667305-1-pan2.li@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW5PR11MB5908:EE_|PH0PR11MB5189:EE_ x-ms-office365-filtering-correlation-id: 8d9d1cc4-37b2-4179-29a3-08db55aa926e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +MBXi/cYVlsJaGnq+Dnx+/mLlbXY2mbT86969jHT+QZRc+Sx0JK/UlGYE+R+RaWoT4StNvUrHAVyXf3dp7VB0otjurDcow4AAajye6sOxPx38vgClwBuqapcF6cirj/YbWeEk1EcWIqkoqMZVFRXNtqUCm7yJXfbMYMhFVACfTKJmkel3GP4RkMi6LOSElQEMLCgzZIHeGH+aEnc+adcxz8Vf3fsPXSZNp40KvPuhWc/w+2kFrD872Wd460PpRLK8hynacjvWuGoNQnT5FXLEvQEjoRWXAqRZqe+Epi0MKcAhH0m74Q4n/vmxKgyFJY704cMwlwYPu9psZWO3DslPaVhHfaBqr2RPXZFjU7fsx0p6h7Wna81tWy7GF5NsAH7WFGnQcEt93utYhHG2DTIdAvuMRkOn4JEkJA0j9fNs7WtvyUoXADwC6YH8jRtMDGyh6FqskXgcCikIruQTmN3cxctQ1stGQxWdy/4Sgkx7GH6RC5vh3sL3i8gKKEXw7OEcvtmIoHJRMJy7oAfM10TMws5v5scWNp+eRG0tCRULZsOj1Junk+71brv/iIah8gUKxNlH0D1buSSc8A1d1F5yKvoEKi59uBv6/7TnH2Jq2xhIEw07D43gub+zdcVJf1F x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW5PR11MB5908.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199021)(83380400001)(53546011)(54906003)(478600001)(7696005)(71200400001)(26005)(9686003)(186003)(6506007)(33656002)(2906002)(30864003)(38070700005)(6916009)(38100700002)(4326008)(122000001)(66446008)(66946007)(41300700001)(66556008)(82960400001)(52536014)(66476007)(76116006)(64756008)(8936002)(8676002)(316002)(86362001)(5660300002)(55016003)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?1eBjwTtSk7SIAQb2xy29ZO8oB7TDovEN7N/LgN6sioS6GkMdBzt3GZ42cIGq?= =?us-ascii?Q?AmFM0aXE1J21dhX4mHbUNKbx1XqNoayDoLaMY7p4SFWXzMtsDwPalhZWFs2x?= =?us-ascii?Q?iQRoUzVSt1D8LJ4z92/sULsNtsdJOIbtjWwoYLQ+LgCEGiH1vMHXJDVdYigO?= =?us-ascii?Q?Rzn/Io+/YFHAmgPOLADYv9xv2XFLPgXpu70hwaWrF3k4qK61c8vKPcjT1/Dy?= =?us-ascii?Q?ANalhLhPXhygCgNqg8wwWfMUOQfc0/7r6bh5ABfUjtCHzLAOKGEGLyo7oycJ?= =?us-ascii?Q?/5qqnvdJfWnTCZR1vHparDtHist6TCk7wTdlzMyJ93osKlwWMw873uIAeGuk?= =?us-ascii?Q?lORVCXWXQqRCyROrdRoeZFj0J1q/KITsgLVwFXtwAz97HOP6sOHieGFWP7A8?= =?us-ascii?Q?NYfR/2t0HOyWObYteglkH+nZ0sL5pGw9z8JR+c4vwUT9MvJJd5Kej5ifzRqD?= =?us-ascii?Q?j/11hsO1/vQrx6TUByBhifsb3Ifo595wF/TCF5jrw4HPBKe6ejnYv/Wt7L09?= =?us-ascii?Q?wfVe3j0UN1Yuu+YU3FtbK6UQ6f7bTm9GoDKhUHf/q6ZXAC9+X4HI1nqkGv2N?= =?us-ascii?Q?QU7ZLGkETXHR8KJpTgiYg6H9AlJ2YXqW9FB0ZmKDNn2sTOvvfrEpaiYUrR95?= =?us-ascii?Q?ffu9Aih6ofp9/uDODRTJHeKup6wSliPSjaSqsw6hrkhDTjcJWuuWswj4wh82?= =?us-ascii?Q?PQeV9LypsmHpM7o4Od7h2tosLJ3beQSali08XsB3Npgi6zjd83P/P4qTbcWR?= =?us-ascii?Q?1Khv0HsaMitsIc7lkrDH3tFRUXUAXHBYPjNorQFNCNamL2icUnLNUYkmGczJ?= =?us-ascii?Q?BhLbAPw12XGT1t6BiYq9TohxHukT30vuFE/5h7vv3+Y75w5z5nGtEO2xhF+A?= =?us-ascii?Q?QLxBJaYwualZTqrLR5D0CWLQkxiU8lKjqPg5VAgtzk8mOezu1g/iz/7gf+gU?= =?us-ascii?Q?BUdrv3Lh3QkKxEnKMUv3/59PanNmaNMCz10UjE9CTZJjPfV46YiuA7NoKtLi?= =?us-ascii?Q?xJRh0+xVyxtWiei1f5oWKXRqnHKNLSNXTFLPy2GjtidfS2ArYkY2KIuM8esk?= =?us-ascii?Q?kiAgCqtC/o30vyHblme8mNZ7lJAO2FXo9KG5t1vk03O4Wr8d/9hFIoPmhgSd?= =?us-ascii?Q?B7AgvKkttq8mG4LDZfYdL5am1ZUQ6EtfLDUND0PTAjtccEX7xXa1lL1n0UYT?= =?us-ascii?Q?pGesbfXUyl5sP7CQoAv1Sn6zIsqkVpsf7AGHdKT8F2IznQ+zkXN2PXlCso+n?= =?us-ascii?Q?CIBDMfsQJy9CLSdhUUdt9dH79MAIMb8D+q3rWNNXwcerQa/8YkNyoUM1u8F+?= =?us-ascii?Q?N/DJ+fNGjoi7BN02ArFOYl3ncIK+f5MZBNql3yRnjbNmC5zMGZqCR9ROi48x?= =?us-ascii?Q?5+zLwoeNSUSKhRIvb5t/qRikYHDcEc1HRfJnZrmn62z30DdBFQhhPL4W4EO7?= =?us-ascii?Q?RRy8Qcd0kyxS7dRauf7QfYLHKiQgWWVVSDNheQly+T48gAdiEFzQL0xqHOW8?= =?us-ascii?Q?0f0v+jpw7OkHzze6GeaYYPyNfgbXAn2w7eqyqsE+jMYP7lUdtW7uzCYKhsom?= =?us-ascii?Q?wxPCkEtDr/3bM7ujMxk=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW5PR11MB5908.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d9d1cc4-37b2-4179-29a3-08db55aa926e X-MS-Exchange-CrossTenant-originalarrivaltime: 16 May 2023 01:12:09.2214 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: EVS/jDfGtmhqiki0THOiSec4L1mF1i54DSV1YXTshlxzxE9Ti8YoAEGw/jLkxmztdf5HCkXyU7TKSqflaH9eyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5189 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_ASCII_DIVIDERS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Kindly ping for this PATCH v3. Pan -----Original Message----- From: Li, Pan2 =20 Sent: Saturday, May 13, 2023 9:13 PM To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai; kito.cheng@sifive.com; Li, Pan2 ; Wang, Yanzhang ; jeffreyalaw@gmail.com; rguent= her@suse.de; richard.sandiford@arm.com Subject: [PATCH v3] Machine_Mode: Extend machine_mode from 8 to 16 bits From: Pan Li We are running out of the machine_mode(8 bits) in RISC-V backend. Thus we w= ould like to extend the machine_mode bit size from 8 to 16 bits. However, it is sensitive to extend the memory size in common structure like= tree or rtx. This patch would like to extend the machine_mode bits to 16 b= its by shrinking, like: * Swap the bit size of code and machine code in rtx_def. * Adjust the machine_mode location and spare in tree. The memory impact of this patch for correlated structure looks like below: +-------------------+----------+---------+------+ | struct/bytes | upstream | patched | diff | +-------------------+----------+---------+------+ | rtx_obj_reference | 8 | 12 | +4 | | ext_modified | 2 | 4 | +2 | | ira_allocno | 192 | 184 | -8 | | qty_table_elem | 40 | 40 | 0 | | reg_stat_type | 64 | 64 | 0 | | rtx_def | 40 | 40 | 0 | | table_elt | 80 | 80 | 0 | | tree_decl_common | 112 | 112 | 0 | | tree_type_common | 128 | 128 | 0 | +-------------------+----------+---------+------+ The tree and rtx related struct has no memory changes after this patch, and= the machine_mode changes to 16 bits already. Signed-off-by: Pan Li Co-authored-by: Ju-Zhe Zhong Co-authored-by: Kito Cheng Co-Authored-By: Richard Biener Co-Authored-By: Richard Sandiford gcc/ChangeLog: * combine.cc (struct reg_stat_type): Extend machine_mode to 16 bits. * cse.cc (struct qty_table_elem): Extend machine_mode to 16 bits (struct table_elt): Extend machine_mode to 16 bits. (struct set): Ditto. * genmodes.cc (emit_mode_wider): Extend type from char to short. (emit_mode_complex): Ditto. (emit_mode_inner): Ditto. (emit_class_narrowest_mode): Ditto. * genopinit.cc (main): Extend the machine_mode limit. * ira-int.h (struct ira_allocno): Extend machine_mode to 16 bits and re-ordered the struct fields for padding. * machmode.h (MACHINE_MODE_BITSIZE): New macro. (GET_MODE_2XWIDER_MODE): Extend type from char to short. (get_mode_alignment): Extend type from char to short. * ree.cc (struct ext_modified): Extend machine_mode to 16 bits and removed the ATTRIBUTE_PACKED. * rtl-ssa/accesses.h: Extend machine_mode to 16 bits. * rtl.h (RTX_CODE_BITSIZE): New macro. (struct rtx_def): Swap both the bit size and location between the rtx_code and the machine_mode. (subreg_shape::unique_id): Extend the machine_mode limit. * rtlanal.h: Extend machine_mode to 16 bits. * tree-core.h (struct tree_type_common): Extend machine_mode to 16 bits and re-ordered the struct fields for padding. (struct tree_decl_common): Extend machine_mode to 16 bits. --- gcc/combine.cc | 4 +-- gcc/cse.cc | 16 ++++-------- gcc/genmodes.cc | 16 ++++++------ gcc/genopinit.cc | 3 ++- gcc/ira-int.h | 56 +++++++++++++++++++++--------------------- gcc/machmode.h | 27 +++++++++++++++----- gcc/ree.cc | 4 +-- gcc/rtl-ssa/accesses.h | 2 +- gcc/rtl.h | 12 +++++---- gcc/rtlanal.h | 2 +- gcc/tree-core.h | 9 ++++--- 11 files changed, 82 insertions(+), 69 deletions(-) diff --git a/gcc/combine.cc b/gcc/combine.cc index 5aa0ec5c45a..a23caeed96f= 100644 --- a/gcc/combine.cc +++ b/gcc/combine.cc @@ -200,7 +200,7 @@ struct reg_stat_type { =20 unsigned HOST_WIDE_INT last_set_nonzero_bits; char last_set_sign_bit_copies; - ENUM_BITFIELD(machine_mode) last_set_mode : 8; + ENUM_BITFIELD(machine_mode) last_set_mode : MACHINE_MODE_BITSIZE; =20 /* Set nonzero if references to register n in expressions should not be used. last_set_invalid is set nonzero when this register is being @@= -235,7 +235,7 @@ struct reg_stat_type { truncation if we know that value already contains a truncated value. */ =20 - ENUM_BITFIELD(machine_mode) truncated_to_mode : 8; + ENUM_BITFIELD(machine_mode) truncated_to_mode : MACHINE_MODE_BITSIZE; }; =20 =20 diff --git a/gcc/cse.cc b/gcc/cse.cc index b10c9b0c94d..86403b95938 100644 --- a/gcc/cse.cc +++ b/gcc/cse.cc @@ -248,10 +248,8 @@ struct qty_table_elem rtx comparison_const; int comparison_qty; unsigned int first_reg, last_reg; - /* The sizes of these fields should match the sizes of the - code and mode fields of struct rtx_def (see rtl.h). */ - ENUM_BITFIELD(rtx_code) comparison_code : 16; - ENUM_BITFIELD(machine_mode) mode : 8; + ENUM_BITFIELD(machine_mode) mode : MACHINE_MODE_BITSIZE; + ENUM_BITFIELD(rtx_code) comparison_code : RTX_CODE_BITSIZE; }; =20 /* The table of all qtys, indexed by qty number. */ @@ -404,9 +402,7 @@ s= truct table_elt struct table_elt *related_value; int cost; int regcost; - /* The size of this field should match the size - of the mode field of struct rtx_def (see rtl.h). */ - ENUM_BITFIELD(machine_mode) mode : 8; + ENUM_BITFIELD(machine_mode) mode : MACHINE_MODE_BITSIZE; char in_memory; char is_const; char flag; @@ -4152,10 +4148,8 @@ struct set /* Nonzero if the SET_SRC contains something whose value cannot be predicted and understood. */ char src_volatile; - /* Original machine mode, in case it becomes a CONST_INT. - The size of this field should match the size of the mode - field of struct rtx_def (see rtl.h). */ - ENUM_BITFIELD(machine_mode) mode : 8; + /* Original machine mode, in case it becomes a CONST_INT. */ + ENUM_BITFIELD(machine_mode) mode : MACHINE_MODE_BITSIZE; /* Hash value of constant equivalent for SET_SRC. */ unsigned src_const_hash; /* A constant equivalent for SET_SRC, if any. */ diff --git a/gcc/genmo= des.cc b/gcc/genmodes.cc index 715787b8f48..55ac2adb559 100644 --- a/gcc/genmodes.cc +++ b/gcc/genmodes.cc @@ -1141,10 +1141,10 @@ inline __attribute__((__always_inline__))\n\ #else\n\ extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\ #= endif\n\ -unsigned char\n\ +unsigned short\n\ mode_inner_inline (machine_mode mode)\n\ {\n\ - extern const unsigned char mode_inner[NUM_MACHINE_MODES];\n\ + extern const unsigned short mode_inner[NUM_MACHINE_MODES];\n\ gcc_assert (mode >=3D 0 && mode < NUM_MACHINE_MODES);\n\ switch (mode)\n\ {"); @@ -1529,7 +1529,7 @@ emit_mode_wider (void) int c; struct mode_data *m; =20 - print_decl ("unsigned char", "mode_next", "NUM_MACHINE_MODES"); + print_decl ("unsigned short", "mode_next", "NUM_MACHINE_MODES"); =20 for_all_modes (c, m) tagged_printf ("E_%smode", @@ -1537,7 +1537,7 @@ emit_mode_wider (void) m->name); =20 print_closer (); - print_decl ("unsigned char", "mode_wider", "NUM_MACHINE_MODES"); + print_decl ("unsigned short", "mode_wider", "NUM_MACHINE_MODES"); =20 for_all_modes (c, m) { @@ -1568,7 +1568,7 @@ emit_mode_wider (void) } =20 print_closer (); - print_decl ("unsigned char", "mode_2xwider", "NUM_MACHINE_MODES"); + print_decl ("unsigned short", "mode_2xwider", "NUM_MACHINE_MODES"); =20 for_all_modes (c, m) { @@ -1625,7 +1625,7 @@ emit_mode_complex (void) int c; struct mode_data *m; =20 - print_decl ("unsigned char", "mode_complex", "NUM_MACHINE_MODES"); + print_decl ("unsigned short", "mode_complex", "NUM_MACHINE_MODES"); =20 for_all_modes (c, m) tagged_printf ("E_%smode", @@ -1665,7 +1665,7 @@ emit_mode_inner (void) int c; struct mode_data *m; =20 - print_decl ("unsigned char", "mode_inner", "NUM_MACHINE_MODES"); + print_decl ("unsigned short", "mode_inner", "NUM_MACHINE_MODES"); =20 for_all_modes (c, m) tagged_printf ("E_%smode", @@ -1738,7 +1738,7 @@ emit_class_narrowest_mode (void) { int c; =20 - print_decl ("unsigned char", "class_narrowest_mode", "MAX_MODE_CLASS"); + print_decl ("unsigned short", "class_narrowest_mode",=20 + "MAX_MODE_CLASS"); =20 for (c =3D 0; c < MAX_MODE_CLASS; c++) { diff --git a/gcc/genopinit.cc b/gcc/genopinit.cc index 83cb7504fa1..0c1b685= 9ca0 100644 --- a/gcc/genopinit.cc +++ b/gcc/genopinit.cc @@ -182,7 +182,8 @@ main (int argc, const char **argv) =20 progname =3D "genopinit"; =20 - if (NUM_OPTABS > 0xffff || MAX_MACHINE_MODE >=3D 0xff) + if (NUM_OPTABS > 0xffff + || MAX_MACHINE_MODE >=3D ((1 << MACHINE_MODE_BITSIZE) - 1)) fatal ("genopinit range assumptions invalid"); =20 if (!init_rtx_reader_args_cb (argc, argv, handle_arg)) diff --git a/gcc/= ira-int.h b/gcc/ira-int.h index e2de47213b4..e7460cfd906 100644 --- a/gcc/ira-int.h +++ b/gcc/ira-int.h @@ -281,13 +281,20 @@ struct ira_allocno int regno; /* Mode of the allocno which is the mode of the corresponding pseudo-register. */ - ENUM_BITFIELD (machine_mode) mode : 8; + ENUM_BITFIELD (machine_mode) mode : MACHINE_MODE_BITSIZE; /* Widest mode of the allocno which in at least one case could be for paradoxical subregs where wmode > mode. */ - ENUM_BITFIELD (machine_mode) wmode : 8; + ENUM_BITFIELD (machine_mode) wmode : MACHINE_MODE_BITSIZE; /* Register class which should be used for allocation for given allocno. NO_REGS means that we should use memory. */ ENUM_BITFIELD (reg_class) aclass : 16; + /* Hard register assigned to given allocno. Negative value means + that memory was allocated to the allocno. During the reload, + spilled allocno has value equal to the corresponding stack slot + number (0, ...) - 2. Value -1 is used for allocnos spilled by the + reload (at this point pseudo-register has only one allocno) which + did not get stack slot yet. */ + signed int hard_regno : 16; /* A bitmask of the ABIs used by calls that occur while the allocno is live. */ unsigned int crossed_calls_abis : NUM_ABI_IDS; @@ -321,22 +328,6 @@ stru= ct ira_allocno =20 This is only ever true for non-cap allocnos. */ unsigned int might_conflict_with_parent_p : 1; - /* Hard register assigned to given allocno. Negative value means - that memory was allocated to the allocno. During the reload, - spilled allocno has value equal to the corresponding stack slot - number (0, ...) - 2. Value -1 is used for allocnos spilled by the - reload (at this point pseudo-register has only one allocno) which - did not get stack slot yet. */ - signed int hard_regno : 16; - /* Allocnos with the same regno are linked by the following member. - Allocnos corresponding to inner loops are first in the list (it - corresponds to depth-first traverse of the loops). */ - ira_allocno_t next_regno_allocno; - /* There may be different allocnos with the same regno in different - regions. Allocnos are bound to the corresponding loop tree node. - Pseudo-register may have only one regular allocno with given loop - tree node but more than one cap (see comments above). */ - ira_loop_tree_node_t loop_tree_node; /* Accumulated usage references of the allocno. Here and below, word 'accumulated' means info for given region and all nested subregions. In this case, 'accumulated' means sum of references @@ -= 362,6 +353,25 @@ struct ira_allocno register class living at the point than number of hard-registers of the class available for the allocation. */ int excess_pressure_points_num; + /* The number of objects tracked in the following array. */ int=20 + num_objects; + /* Accumulated frequency of calls which given allocno + intersects. */ + int call_freq; + /* Accumulated number of the intersected calls. */ int=20 + calls_crossed_num; + /* The number of calls across which it is live, but which should not + affect register preferences. */ + int cheap_calls_crossed_num; + /* Allocnos with the same regno are linked by the following member. + Allocnos corresponding to inner loops are first in the list (it + corresponds to depth-first traverse of the loops). */ =20 + ira_allocno_t next_regno_allocno; + /* There may be different allocnos with the same regno in different + regions. Allocnos are bound to the corresponding loop tree node. + Pseudo-register may have only one regular allocno with given loop + tree node but more than one cap (see comments above). */ =20 + ira_loop_tree_node_t loop_tree_node; /* Allocno hard reg preferences. */ ira_pref_t allocno_prefs; /* Copies to other non-conflicting allocnos. The copies can @@ -374,21 = +384,11 @@ struct ira_allocno /* It is a link to allocno (cap) on lower loop level represented by given cap. Null if given allocno is not a cap. */ ira_allocno_t cap_member; - /* The number of objects tracked in the following array. */ - int num_objects; /* An array of structures describing conflict information and live ranges for each object associated with the allocno. There may be more than one such object in cases where the allocno represents a multi-word register. */ ira_object_t objects[2]; - /* Accumulated frequency of calls which given allocno - intersects. */ - int call_freq; - /* Accumulated number of the intersected calls. */ - int calls_crossed_num; - /* The number of calls across which it is live, but which should not - affect register preferences. */ - int cheap_calls_crossed_num; /* Registers clobbered by intersected calls. */ HARD_REG_SET crossed_calls_clobbered_regs; /* Array of usage costs (accumulated and the one updated during diff --g= it a/gcc/machmode.h b/gcc/machmode.h index f1865c1ef42..a22df60dc20 100644 --- a/gcc/machmode.h +++ b/gcc/machmode.h @@ -24,13 +24,13 @@ typedef opt_mode opt_machine_mode; =20 extern CONST_MODE_SIZE poly_uint16_pod mode_size[NUM_MACHINE_MODES]; exte= rn CONST_MODE_PRECISION poly_uint16_pod mode_precision[NUM_MACHINE_MODES]; -extern const unsigned char mode_inner[NUM_MACHINE_MODES]; +extern const unsigned short mode_inner[NUM_MACHINE_MODES]; extern CONST_MODE_NUNITS poly_uint16_pod mode_nunits[NUM_MACHINE_MODES]; = extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES]= ; extern const unsigned short mode_unit_precision[NUM_MACHINE_MODES]; -extern const unsigned char mode_next[NUM_MACHINE_MODES]; -extern const uns= igned char mode_wider[NUM_MACHINE_MODES]; -extern const unsigned char mode_= 2xwider[NUM_MACHINE_MODES]; +extern const unsigned short mode_next[NUM_MACHINE_MODES]; extern const=20 +unsigned short mode_wider[NUM_MACHINE_MODES]; extern const unsigned=20 +short mode_2xwider[NUM_MACHINE_MODES]; =20 template struct mode_traits @@ -242,6 +242,21 @@ extern const unsigned char mode_class[NUM_MACHINE_MODE= S]; || CLASS =3D=3D MODE_ACCUM \ || CLASS =3D=3D MODE_UACCUM) =20 +/* The MACHINE_MODE_BITSIZE should be exactly aligned with the type of the + machine_mode array in the machmode.h and genmodes.cc. For example as b= elow. + +------------------------+-------+ + | MACHINE_MODE_BITSIZE | 16 | + +------------------------+-------+ + | mode_inter[] | short | + | mode_next[] | short | + | mode_wider[] | short | + | mode_2xwider[] | short | + | mode_complex[] | short | + | class_narrowest_mode[] | short | + +------------------------+-------+ + */ +#define MACHINE_MODE_BITSIZE 16 + /* An optional T (i.e. a T or nothing), where T is some form of mode class= . */ template class opt_mode @@ -797,7 +812,7 @@ GET_MODE_2X= WIDER_MODE (const T &m) } =20 /* Get the complex mode from the component mode. */ -extern const unsigne= d char mode_complex[NUM_MACHINE_MODES]; +extern const unsigned short mode_complex[NUM_MACHINE_MODES]; #define GET_MODE_COMPLEX_MODE(MODE) ((machine_mode) mode_complex[MODE]) =20 /* Represents a machine mode that must have a fixed size. The main @@ -94= 6,7 +961,7 @@ extern unsigned get_mode_alignment (machine_mode); =20 /* For each class, get the narrowest mode in that class. */ =20 -extern const unsigned char class_narrowest_mode[MAX_MODE_CLASS]; +extern const unsigned short class_narrowest_mode[MAX_MODE_CLASS]; #define GET_CLASS_NARROWEST_MODE(CLASS) \ ((machine_mode) class_narrowest_mode[CLASS]) =20 diff --git a/gcc/ree.cc b/gcc/ree.cc index 413aec7c8eb..fc04249fa84 100644 --- a/gcc/ree.cc +++ b/gcc/ree.cc @@ -564,10 +564,10 @@ enum ext_modified_kind EXT_MODIFIED_SEXT }; =20 -struct ATTRIBUTE_PACKED ext_modified +struct ext_modified { /* Mode from which ree has zero or sign extended the destination. */ - ENUM_BITFIELD(machine_mode) mode : 8; + ENUM_BITFIELD(machine_mode) mode : MACHINE_MODE_BITSIZE; =20 /* Kind of modification of the insn. */ ENUM_BITFIELD(ext_modified_kind) kind : 2; diff --git a/gcc/rtl-ssa/acce= sses.h b/gcc/rtl-ssa/accesses.h index c5180b9308a..38b4d6160c2 100644 --- a/gcc/rtl-ssa/accesses.h +++ b/gcc/rtl-ssa/accesses.h @@ -254,7 +254,7 @@ private: unsigned int m_spare : 2; =20 // The value returned by the accessor above. - machine_mode m_mode : 8; + machine_mode m_mode : MACHINE_MODE_BITSIZE; }; =20 // A contiguous array of access_info pointers. Used to represent a diff -= -git a/gcc/rtl.h b/gcc/rtl.h index f634cab730b..364782b6060 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -63,6 +63,8 @@ enum rtx_code { # define NON_GENERATOR_NUM_RTX_CODE ((int) MATCH_OPERAND) #endif =20 +#define RTX_CODE_BITSIZE 8 + /* Register Transfer Language EXPRESSIONS CODE CLASSES */ =20 enum rtx_class { @@ -309,11 +311,11 @@ struct GTY((variable_size)) const_poly_int_def { str= uct GTY((desc("0"), tag("0"), chain_next ("RTX_NEXT (&%h)"), chain_prev ("RTX_PREV (&%h)"))) rtx_def { - /* The kind of expression this is. */ - ENUM_BITFIELD(rtx_code) code: 16; - /* The kind of value the expression has. */ - ENUM_BITFIELD(machine_mode) mode : 8; + ENUM_BITFIELD(machine_mode) mode : MACHINE_MODE_BITSIZE; + + /* The kind of expression this is. */ + ENUM_BITFIELD(rtx_code) code: RTX_CODE_BITSIZE; =20 /* 1 in a MEM if we should keep the alias set for this mem unchanged when we access a component. @@ -2164,7 +2166,7 @@ subreg_shape::operator !=3D (const subreg_shape &othe= r) const inline unsigned HOST_WIDE_INT subreg_shape::unique_id () const = { - { STATIC_ASSERT (MAX_MACHINE_MODE <=3D 256); } + { STATIC_ASSERT (MAX_MACHINE_MODE <=3D (1 << MACHINE_MODE_BITSIZE)); } { STATIC_ASSERT (NUM_POLY_INT_COEFFS <=3D 3); } { STATIC_ASSERT (sizeof (offset.coeffs[0]) <=3D 2); } int res =3D (int) inner_mode + ((int) outer_mode << 8); diff --git a/gcc= /rtlanal.h b/gcc/rtlanal.h index 5fbed816e20..9013e75c04b 100644 --- a/gcc/rtlanal.h +++ b/gcc/rtlanal.h @@ -100,7 +100,7 @@ public: =20 /* The mode of the reference. If IS_MULTIREG, this is the mode of REGNO - MULTIREG_OFFSET. */ - machine_mode mode : 8; + machine_mode mode : MACHINE_MODE_BITSIZE; =20 /* If IS_MULTIREG, the offset of REGNO from the start of the register. = */ unsigned int multireg_offset : 8; diff --git a/gcc/tree-core.h b/gcc/tree-core.h index a1aea136e75..9d44c04bf= 03 100644 --- a/gcc/tree-core.h +++ b/gcc/tree-core.h @@ -1680,8 +1680,9 @@ struct GTY(()) tree_type_common { tree attributes; unsigned int uid; =20 + ENUM_BITFIELD(machine_mode) mode : MACHINE_MODE_BITSIZE; + unsigned int precision : 16; - ENUM_BITFIELD(machine_mode) mode : 8; unsigned lang_flag_0 : 1; unsigned lang_flag_1 : 1; unsigned lang_flag_2 : 1; @@ -1712,7 +1713,7 @@ struct GTY(()) tree_type_common { unsigned empty_flag : 1; unsigned indivisible_p : 1; unsigned no_named_args_stdarg_p : 1; - unsigned spare : 9; + unsigned spare : 1; =20 alias_set_type alias_set; tree pointer_to; @@ -1770,7 +1771,7 @@ struct GTY(()) tree_decl_common { struct tree_decl_minimal common; tree size; =20 - ENUM_BITFIELD(machine_mode) mode : 8; + ENUM_BITFIELD(machine_mode) mode : MACHINE_MODE_BITSIZE; =20 unsigned nonlocal_flag : 1; unsigned virtual_flag : 1; @@ -1828,7 +1829,7 @@ struct GTY(()) tree_decl_common { /* In FIELD_DECL, this is DECL_NOT_FLEXARRAY. */ unsigned int decl_not_flexarray : 1; =20 - /* 13 bits unused. */ + /* 5 bits unused. */ =20 /* UID for points-to sets, stable over copying from inlining. */ unsigned int pt_uid; -- 2.34.1