From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 047AF3858405 for ; Thu, 21 Oct 2021 15:41:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 047AF3858405 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 19LFeTHf019772; Thu, 21 Oct 2021 10:40:29 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 19LFeSWM019767; Thu, 21 Oct 2021 10:40:28 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 21 Oct 2021 10:40:28 -0500 From: Segher Boessenkool To: Richard Biener Cc: Martin =?utf-8?B?TGnFoWth?= , GCC Patches Subject: Re: [PATCH 3/N] Come up with casm global state. Message-ID: <20211021154028.GT614@gate.crashing.org> References: <8aa1fb10-334d-aa62-13e4-2ebc24d4ea16@suse.cz> <6a4d22df-d810-ea08-4782-6d79cc639e1b@suse.cz> <460ab511-289b-f82b-0b34-d16ddf581252@suse.cz> <856ae6d3-d1f7-4f00-0af0-afeb55a46f06@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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-List-Received-Date: Thu, 21 Oct 2021 15:41:31 -0000 On Thu, Oct 21, 2021 at 02:42:10PM +0200, Richard Biener wrote: > +#define rs6000_casm static_cast (casm) > > maybe there's a better way? Though I can't think of one at the moment. > There are only 10 uses so eventually we can put the > static_cast into all places. Let's ask the powerpc maintainers (CCed). It's disgusting, and fragile. The define is slightly better than having to write it out every time. But can this not be done properly? If you use object-oriented stuff and need casts for that, you are doing something wrong. > Note you do > > +/* Implement TARGET_ASM_INIT_SECTIONS. */ > + > +static asm_out_state * > +rs6000_elf_asm_init_sections (void) > +{ > + rs6000_asm_out_state *target_state > + = new (ggc_alloc ()) rs6000_asm_out_state (); > + target_state->init_elf_sections (); > + target_state->init_sections (); > + > + return target_state; > +} > > If you'd have made init_sections virtual the flow would be more > natural and we could separate section init from casm construction > (and rs6000 would override init_sections but call the base function > from the override). Yeah. Segher