From patchwork Wed Jul 7 21:27:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 58189 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 CE590B6F04 for ; Thu, 8 Jul 2010 07:29:05 +1000 (EST) Received: (qmail 25516 invoked by alias); 7 Jul 2010 21:29:04 -0000 Received: (qmail 25506 invoked by uid 22791); 7 Jul 2010 21:29:04 -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, 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:28:59 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWcAq-0004B1-Eu for gcc-patches@gcc.gnu.org; Wed, 07 Jul 2010 17:28:57 -0400 Received: from mail-ww0-f51.google.com ([74.125.82.51]:48905) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWcAq-0004Av-9o for gcc-patches@gcc.gnu.org; Wed, 07 Jul 2010 17:28:56 -0400 Received: by wwb18 with SMTP id 18so1277876wwb.8 for ; Wed, 07 Jul 2010 14:27:55 -0700 (PDT) Received: by 10.227.152.79 with SMTP id f15mr5727360wbw.180.1278538075445; Wed, 07 Jul 2010 14:27:55 -0700 (PDT) Received: from localhost (rsandifo.gotadsl.co.uk [82.133.89.107]) by mx.google.com with ESMTPS id g37sm45717546wbg.9.2010.07.07.14.27.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 07 Jul 2010 14:27:54 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [22/27] Add more caller-save.c stuff to the target structures References: <87d3v2oqyt.fsf@firetop.home> Date: Wed, 07 Jul 2010 22:27:52 +0100 In-Reply-To: <87d3v2oqyt.fsf@firetop.home> (Richard Sandiford's message of "Sun, 04 Jul 2010 22:51:54 +0100") Message-ID: <87fwzvrnhj.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 This patch adds two caller-save.c variables to the target structures. The variables aren't covered by target_reinit, but they are target-dependent. Richard gcc/ * reload.h (target_reload): Add x_cached_reg_save_code and x_cached_reg_restore_code. * caller-save.c (cached_reg_save_code, cached_reg_restore_code): Redefine as macros. Index: gcc/reload.h =================================================================== --- gcc/reload.h 2010-07-07 22:02:23.000000000 +0100 +++ gcc/reload.h 2010-07-07 22:26:11.000000000 +0100 @@ -182,6 +182,14 @@ struct target_reload { enum machine_mode (x_regno_save_mode [FIRST_PSEUDO_REGISTER] [MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1]); + + /* We will only make a register eligible for caller-save if it can be + saved in its widest mode with a simple SET insn as long as the memory + address is valid. We record the INSN_CODE is those insns here since + when we emit them, the addresses might not be valid, so they might not + be recognized. */ + int x_cached_reg_save_code[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; + int x_cached_reg_restore_code[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; }; extern struct target_reload default_target_reload; Index: gcc/caller-save.c =================================================================== --- gcc/caller-save.c 2010-07-07 22:02:23.000000000 +0100 +++ gcc/caller-save.c 2010-07-07 22:26:11.000000000 +0100 @@ -44,6 +44,10 @@ #define MOVE_MAX_WORDS (MOVE_MAX / UNITS #define regno_save_mode \ (this_target_reload->x_regno_save_mode) +#define cached_reg_save_code \ + (this_target_reload->x_cached_reg_save_code) +#define cached_reg_restore_code \ + (this_target_reload->x_cached_reg_restore_code) /* For each hard register, a place on the stack where it can be saved, if needed. */ @@ -57,17 +61,6 @@ #define regno_save_mode \ /* Allocated slots so far. */ static rtx save_slots[FIRST_PSEUDO_REGISTER]; -/* We will only make a register eligible for caller-save if it can be - saved in its widest mode with a simple SET insn as long as the memory - address is valid. We record the INSN_CODE is those insns here since - when we emit them, the addresses might not be valid, so they might not - be recognized. */ - -static int - cached_reg_save_code[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; -static int - cached_reg_restore_code[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; - /* Set of hard regs currently residing in save area (during insn scan). */ static HARD_REG_SET hard_regs_saved;