From patchwork Wed Jul 7 21:46:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 58197 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 A5E42B6EFE for ; Thu, 8 Jul 2010 07:47:21 +1000 (EST) Received: (qmail 3254 invoked by alias); 7 Jul 2010 21:47:20 -0000 Received: (qmail 3244 invoked by uid 22791); 7 Jul 2010 21:47:19 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_NEUTRAL, TW_CP, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (140.186.70.92) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Jul 2010 21:47:15 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWcSW-0006uc-D3 for gcc-patches@gcc.gnu.org; Wed, 07 Jul 2010 17:47:13 -0400 Received: from mail-ww0-f51.google.com ([74.125.82.51]:51970) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWcSW-0006uR-8y for gcc-patches@gcc.gnu.org; Wed, 07 Jul 2010 17:47:12 -0400 Received: by wwb18 with SMTP id 18so1292911wwb.8 for ; Wed, 07 Jul 2010 14:46:11 -0700 (PDT) Received: by 10.227.151.130 with SMTP id c2mr5684218wbw.56.1278539171482; Wed, 07 Jul 2010 14:46:11 -0700 (PDT) Received: from localhost (rsandifo.gotadsl.co.uk [82.133.89.107]) by mx.google.com with ESMTPS id e31sm45824085wbe.5.2010.07.07.14.46.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 07 Jul 2010 14:46:10 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [26/27] Call init_reg_sets for each target structure References: <87d3v2oqyt.fsf@firetop.home> Date: Wed, 07 Jul 2010 22:46:08 +0100 In-Reply-To: <87d3v2oqyt.fsf@firetop.home> (Richard Sandiford's message of "Sun, 04 Jul 2010 22:51:54 +0100") Message-ID: <87y6dnq82n.fsf@firetop.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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 If anyone's still reading by this point, thank you! This is the final target-independent patch. At the moment, we call init_reg_sets once per run. It initialises various hard-reg-set.h variables from static target-defined arrays. However, now that these variables are stored in target structures, we need to call init_reg_sets for each structure. We then call init_reg_sets_1 (via target_reinit) to reassert any changes made on the command line (such as by -ffixed-reg-) and to make any changes relevant to the new target. This is a slight change of behaviour from calling target_reinit every time. target_reinit effectively recreates some parts of the register information as a delta from the current one, whereas save_target_globals creates it all from the same initial point. This means, for example, that target_reinit preserves any changes made to the allocation order by things like TARGET_OVERRIDE_OPTIONS, whereas save_target_globals doesn't. I think the new behaviour's cleaner though, since it's easier for the target to predict what state it's starting with. Things like the allocation order should really be changed by TARGET_CONDITIONAL_REGISTER_USAGE rather than T_O_O in any case. Richard gcc/ * reginfo.c (init_reg_sets): Don't zero globals here. Update comment to say that the function can be called more than once. * target-globals.c (save_target_globals): Call init_reg_sets. Index: gcc/reginfo.c =================================================================== --- gcc/reginfo.c 2010-07-07 21:52:27.000000000 +0100 +++ gcc/reginfo.c 2010-07-07 22:32:27.000000000 +0100 @@ -141,8 +141,9 @@ reg_set_to_hard_reg_set (HARD_REG_SET *t } } -/* Function called only once to initialize the above data on reg usage. - Once this is done, various switches may override. */ +/* Function called only once per target_globals to initialize the + target_hard_regs structure. Once this is done, various switches + may override. */ void init_reg_sets (void) { @@ -185,7 +186,6 @@ init_reg_sets (void) memcpy (reg_alloc_order, initial_reg_alloc_order, sizeof reg_alloc_order); #endif memcpy (reg_names, initial_reg_names, sizeof reg_names); - memset (global_regs, 0, sizeof global_regs); } /* Initialize may_move_cost and friends for mode M. */ Index: gcc/target-globals.c =================================================================== --- gcc/target-globals.c 2010-07-07 22:30:59.000000000 +0100 +++ gcc/target-globals.c 2010-07-07 22:32:27.000000000 +0100 @@ -80,6 +80,7 @@ save_target_globals (void) g->gcse = XCNEW (struct target_gcse); g->bb_reorder = XCNEW (struct target_bb_reorder); restore_target_globals (g); + init_reg_sets (); target_reinit (); return g; }