From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id E6FA63858CDA; Thu, 14 Sep 2023 17:54:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E6FA63858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-CSE-ConnectionGUID: yl9y+4Y9TxGR85FaDzW6KA== X-CSE-MsgGUID: 4EkLsPO0Ryu35IkITv5jaw== X-IronPort-AV: E=Sophos;i="6.02,146,1688457600"; d="scan'208";a="16906219" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 14 Sep 2023 09:54:04 -0800 IronPort-SDR: wHz561zYWhSF24rjzeNqqvDETNtjQvV3sc/H8uTRwUQr4VhFuvqeDzsT0uMi7QRr5Fpi/OfRDt Q4+onHxnrT4JgUxQY8jVBCaIljHi7g71aTGdHf0B3c4Vc1YJYMpPYa0hFaM+4H5xs4F5wSTlZa vrnYf+/3RiWijhJ12DiPzmeNJqYCTdrhh7GP9kVEW3g/N9kmXACPAvkllzWFIHAgohxx3ZVNPE VJCLuU9blfybkdMRqwX+1R+zy2M7JX4KVizPQivYNUEqvwB/Z81tW1D7sQNO8o//fCnCRouDRD 78A= Date: Thu, 14 Sep 2023 17:53:59 +0000 From: Joseph Myers To: Ken Matsui CC: , Subject: Re: [PATCH v11 16/40] c, c++: Use 16 bits for all use of enum rid for more keyword space In-Reply-To: <20230914064949.29787-17-kmatsui@gcc.gnu.org> Message-ID: <308093c9-bc0-49b-36ce-8687612ffd88@codesourcery.com> References: <20230914064949.29787-1-kmatsui@gcc.gnu.org> <20230914064949.29787-17-kmatsui@gcc.gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3110.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP 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: On Wed, 13 Sep 2023, Ken Matsui via Gcc-patches wrote: > diff --git a/gcc/c/c-parser.h b/gcc/c/c-parser.h > index 545f0f4d9eb..eed6deaf0f8 100644 > --- a/gcc/c/c-parser.h > +++ b/gcc/c/c-parser.h > @@ -51,14 +51,14 @@ enum c_id_kind { > /* A single C token after string literal concatenation and conversion > of preprocessing tokens to tokens. */ > struct GTY (()) c_token { > + /* If this token is a keyword, this value indicates which keyword. > + Otherwise, this value is RID_MAX. */ > + ENUM_BITFIELD (rid) keyword : 16; > /* The kind of token. */ > ENUM_BITFIELD (cpp_ttype) type : 8; > /* If this token is a CPP_NAME, this value indicates whether also > declared as some kind of type. Otherwise, it is C_ID_NONE. */ > ENUM_BITFIELD (c_id_kind) id_kind : 8; > - /* If this token is a keyword, this value indicates which keyword. > - Otherwise, this value is RID_MAX. */ > - ENUM_BITFIELD (rid) keyword : 8; > /* If this token is a CPP_PRAGMA, this indicates the pragma that > was seen. Otherwise it is PRAGMA_NONE. */ > ENUM_BITFIELD (pragma_kind) pragma_kind : 8; If you want to optimize layout, I'd expect flags to move so it can share the same 32-bit unit as the pragma_kind bit-field (not sure if any changes should be made to the declaration of flags to maximise the chance of such sharing across different host bit-field ABIs). > diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h > index 6cbb9a8e031..3c3c482c6ce 100644 > --- a/gcc/cp/parser.h > +++ b/gcc/cp/parser.h > @@ -40,11 +40,11 @@ struct GTY(()) tree_check { > /* A C++ token. */ > > struct GTY (()) cp_token { > - /* The kind of token. */ > - enum cpp_ttype type : 8; > /* If this token is a keyword, this value indicates which keyword. > Otherwise, this value is RID_MAX. */ > - enum rid keyword : 8; > + enum rid keyword : 16; > + /* The kind of token. */ > + enum cpp_ttype type : 8; > /* Token flags. */ > unsigned char flags; > /* True if this token is from a context where it is implicitly extern "C" */ You're missing an update to the "3 unused bits." comment further down. > @@ -988,7 +988,7 @@ struct GTY(()) cpp_hashnode { > unsigned int directive_index : 7; /* If is_directive, > then index into directive table. > Otherwise, a NODE_OPERATOR. */ > - unsigned int rid_code : 8; /* Rid code - for front ends. */ > + unsigned int rid_code : 16; /* Rid code - for front ends. */ > unsigned int flags : 9; /* CPP flags. */ > ENUM_BITFIELD(node_type) type : 2; /* CPP node type. */ You're missing an update to the "5 bits spare." comment further down. Do you have any figures for the effects on compilation time or memory usage from the increase in size of these structures? -- Joseph S. Myers joseph@codesourcery.com