From patchwork Wed Jul 7 20:45:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 58170 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 BDA79B6F04 for ; Thu, 8 Jul 2010 06:46:17 +1000 (EST) Received: (qmail 26860 invoked by alias); 7 Jul 2010 20:46:16 -0000 Received: (qmail 26852 invoked by uid 22791); 7 Jul 2010 20:46:15 -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 20:46:09 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWbVO-0005tL-8L for gcc-patches@gcc.gnu.org; Wed, 07 Jul 2010 16:46:07 -0400 Received: from mail-wy0-f175.google.com ([74.125.82.175]:65282) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWbVN-0005tA-Ud for gcc-patches@gcc.gnu.org; Wed, 07 Jul 2010 16:46:06 -0400 Received: by wye20 with SMTP id 20so66820wye.20 for ; Wed, 07 Jul 2010 13:45:05 -0700 (PDT) Received: by 10.227.128.5 with SMTP id i5mr5699060wbs.91.1278535505040; Wed, 07 Jul 2010 13:45:05 -0700 (PDT) Received: from localhost (rsandifo.gotadsl.co.uk [82.133.89.107]) by mx.google.com with ESMTPS id g37sm45443695wbg.21.2010.07.07.13.45.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 07 Jul 2010 13:45:04 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [7/27] Use target structures for init_fake_stack_mems References: <87d3v2oqyt.fsf@firetop.home> Date: Wed, 07 Jul 2010 21:45:02 +0100 In-Reply-To: <87d3v2oqyt.fsf@firetop.home> (Richard Sandiford's message of "Sun, 04 Jul 2010 22:51:54 +0100") Message-ID: <878w5nuilt.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 We're now up to here: /* This invokes target hooks to set fixed_reg[] etc, which is mode-dependent. */ init_regs (); /* This depends on stack_pointer_rtx. */ ==> init_fake_stack_mems (); /* Sets static_base_value[HARD_FRAME_POINTER_REGNUM], which is mode-dependent. */ init_alias_target (); init_fake_stack_mems initialises a single array called top_of_stack, which stores a (mem:M (sp)) rtx for each mode M. This seems like a generally useful thing to have, so I think it should be exposed in rtl.h rather than kept static (point (4) in the covering note). top_of_stack was the last GGC-ed variable in reginfo.c. Richard gcc/ * Makefile.in (reginfo.o): Don't depend on $(GGC_H) or gt-reginfo.h. (GTFILES): Remove reginfo.c. * rtl.h (target_rtl): Add x_top_of_stack. (top_of_stack): New macro. * reginfo.c: Don't include ggc.h or gt-reginfo.h. (top_of_stack): Delete. Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in 2010-07-04 12:42:07.000000000 +0100 +++ gcc/Makefile.in 2010-07-04 12:43:05.000000000 +0100 @@ -3261,9 +3261,8 @@ combine.o : combine.c $(CONFIG_H) $(SYST insn-codes.h $(TIMEVAR_H) $(TREE_PASS_H) $(DF_H) vecprim.h $(CGRAPH_H) reginfo.o : reginfo.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) addresses.h $(REGS_H) insn-config.h \ - $(RECOG_H) reload.h $(TOPLEV_H) $(FUNCTION_H) output.h $(GGC_H) \ - $(TM_P_H) $(EXPR_H) $(TIMEVAR_H) gt-reginfo.h $(HASHTAB_H) \ - $(TARGET_H) $(TREE_PASS_H) $(DF_H) ira.h + $(RECOG_H) reload.h $(TOPLEV_H) $(FUNCTION_H) output.h $(TM_P_H) $(EXPR_H) \ + $(TIMEVAR_H) $(HASHTAB_H) $(TARGET_H) $(TREE_PASS_H) $(DF_H) ira.h bitmap.o : bitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(FLAGS_H) $(GGC_H) gt-bitmap.h $(BITMAP_H) $(OBSTACK_H) $(HASHTAB_H) vec.o : vec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(VEC_H) $(GGC_H) \ @@ -3730,7 +3729,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/inp $(srcdir)/expr.h \ $(srcdir)/function.c $(srcdir)/except.c \ $(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c $(srcdir)/optabs.c \ - $(srcdir)/profile.c $(srcdir)/reginfo.c $(srcdir)/mcf.c \ + $(srcdir)/profile.c $(srcdir)/mcf.c \ $(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/cfglayout.h \ $(srcdir)/sdbout.c $(srcdir)/stor-layout.c \ $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \ Index: gcc/rtl.h =================================================================== --- gcc/rtl.h 2010-07-04 12:42:07.000000000 +0100 +++ gcc/rtl.h 2010-07-04 12:43:41.000000000 +0100 @@ -2042,6 +2042,9 @@ struct GTY(()) target_rtl { They are initialized once per compilation unit, then copied into regno_reg_rtx at the beginning of each function. */ rtx x_initial_regno_reg_rtx[FIRST_PSEUDO_REGISTER]; + + /* A sample (mem:M stack_pointer_rtx) rtx for each mode M. */ + rtx x_top_of_stack[MAX_MACHINE_MODE]; }; extern GTY(()) struct target_rtl default_target_rtl; @@ -2057,6 +2060,8 @@ #define pic_offset_table_rtx \ (this_target_rtl->x_pic_offset_table_rtx) #define return_address_pointer_rtx \ (this_target_rtl->x_return_address_pointer_rtx) +#define top_of_stack \ + (this_target_rtl->x_top_of_stack) /* Standard pieces of rtx, to be substituted directly into things. */ #define pc_rtx (global_rtl[GR_PC]) Index: gcc/reginfo.c =================================================================== --- gcc/reginfo.c 2010-07-04 12:42:07.000000000 +0100 +++ gcc/reginfo.c 2010-07-04 12:43:20.000000000 +0100 @@ -45,7 +45,6 @@ Software Foundation; either version 3, o #include "reload.h" #include "toplev.h" #include "output.h" -#include "ggc.h" #include "timevar.h" #include "hashtab.h" #include "target.h" @@ -120,9 +119,6 @@ const char * reg_class_names[] = REG_CLA #define last_mode_for_init_move_cost \ (this_target_regs->x_last_mode_for_init_move_cost) -/* Sample MEM values for use by memory_move_secondary_cost. */ -static GTY(()) rtx top_of_stack[MAX_MACHINE_MODE]; - /* No more global register variables may be declared; true once reginfo has been initialized. */ static int no_global_reg_vars = 0; @@ -1338,5 +1334,3 @@ finish_subregs_of_mode (void) } #endif /* CANNOT_CHANGE_MODE_CLASS */ - -#include "gt-reginfo.h"