From patchwork Thu Aug 23 18:51:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mike Stump X-Patchwork-Id: 179706 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id D209B2C00B2 for ; Fri, 24 Aug 2012 04:51:56 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1346352717; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=cOIDypc6rKBNt2UpuNlXhE43PKY=; b=Jv7wmTQXW8vACH2YLlMecCCLRjeSZVOJSXWKH1kJgBN0kGlJiP+InP9IYcamIz YdWdxc0+fid/e7Gxk1cebFYZzLwxcQZ3hHg8CkPikFVUt+4AOQ8MiVmS4kbFu0Kx Ng/M1oq6VN/9EMyVFR7mQ2yBWGMm2o6v+Djtf9KGB7XF0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=AdDLmVoV6DoZvPlcXiPRJS6HryD0Z+trxxquRqyCloWZ7eA8SmedE1ILExPURt gaL1gqK20CW57z5vJWtIqAge1SRrRD6s5RvA5mGF/S7KTSeZN2bMSoEBwW6v3ISi dYwx9l4zuDtCqaZgQMWDWGZZFX3ngiw1a+3BcIb0bzXaQ=; Received: (qmail 10543 invoked by alias); 23 Aug 2012 18:51:51 -0000 Received: (qmail 10465 invoked by uid 22791); 23 Aug 2012 18:51:49 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=BAYES_00, FREEMAIL_FROM, KHOP_THREADED, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from qmta15.emeryville.ca.mail.comcast.net (HELO qmta15.emeryville.ca.mail.comcast.net) (76.96.27.228) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Aug 2012 18:51:36 +0000 Received: from omta19.emeryville.ca.mail.comcast.net ([76.96.30.76]) by qmta15.emeryville.ca.mail.comcast.net with comcast id qDz61j0061eYJf8AFJrbLg; Thu, 23 Aug 2012 18:51:35 +0000 Received: from bag6-1-pt.tunnel.tserv3.fmt2.ipv6.he.net ([IPv6:2001:470:1f04:ae1::2]) by omta19.emeryville.ca.mail.comcast.net with comcast id qJra1j00J0P3DwE01Jrbcd; Thu, 23 Aug 2012 18:51:35 +0000 Subject: Re: RFC: Putting target-dependent global state into switchable structures Mime-Version: 1.0 (Apple Message framework v1084) From: Mike Stump In-Reply-To: <87pqzdegwc.fsf@firetop.home> Date: Thu, 23 Aug 2012 11:51:34 -0700 Cc: Gcc Patches Message-Id: <3D6C15DE-F3F5-409D-A715-5048C96EDD82@comcast.net> References: <87pqzdegwc.fsf@firetop.home> To: Richard Sandiford X-IsSubscribed: yes 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 On Jun 26, 2010, at 12:24 PM, Richard Sandiford wrote: > GCC has a fair number of global variables that cache target-dependent > data. This makes it difficult to switch between subtargets on the fly, > such as when switching between a MIPS16 and a non-MIPS16 function. > > Our current approach is to call target_reinit each time we make such > a switch. This function goes off and redoes a fair chunk of the target > initialisation process, and although it works (or least worked) pretty well, > it is very slow. > > * doc/tm.texi (SWITCHABLE_TARGET): Document. > * Makefile.in (target_globals_def): New variable. > (target_globals_h): Likewise. > (TARGET_GLOBALS_H): Likewise. > (OBJS-common): Add target-globals.o. > (gtype-desc.o): Depend on $(TARGET_GLOBALS_H). > (target-globals.o): New rule. > ($(target_globals_h)): Likewise. > (s-target-globals): Likewise. > (GTFILES): Add $(target_globals_h). > (build/gentarget-globals.o): New rule. > * defaults.h (SWITCHABLE_TARGET): Define. > * gengtype.c (open_base_files): Add target-globals.h to the > include list. > * target-globals.def: New file. > * gentarget-globals.c: Likewise. > * target-globals.c: Likewise. First, thanks for the work. I have a switchable port, I seem to be seeing: ../../gcc/gcc/target-globals.c: In function ‘target_globals* save_target_globals()’: ../../gcc/gcc/target-globals.c:69:33: error: ‘ggc_alloc_target_globals’ was not declared in this scope make: *** [target-globals.o] Error 1 after the switch to C++. I was wondering if your switchable target port compiles post the switch to C++? Before the switch, I saw a C warning for using ggc_alloc_target_globals undeclared. With: my port again compiles. Certainly I hate block scoped external function declarations, it is wrong... could you decide where it goes and drop in that line someplace? Thanks. diff --git a/gcc/target-globals.c b/gcc/target-globals.c index e679f21..4e33359 100644 --- a/gcc/target-globals.c +++ b/gcc/target-globals.c @@ -65,6 +65,7 @@ struct target_globals * save_target_globals (void) { struct target_globals *g; + extern struct target_globals *ggc_alloc_target_globals (void); g = ggc_alloc_target_globals (); g->flag_state = XCNEW (struct target_flag_state);