From patchwork Thu Jun 24 19:19:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 56823 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 17F5BB6F3E for ; Fri, 25 Jun 2010 05:20:10 +1000 (EST) Received: (qmail 20989 invoked by alias); 24 Jun 2010 19:20:09 -0000 Received: (qmail 20967 invoked by uid 22791); 24 Jun 2010 19:20:07 -0000 X-SWARE-Spam-Status: No, hits=1.6 required=5.0 tests=AWL, BAYES_99, MIME_QP_LONG_LINE, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from c60.cesmail.net (HELO c60.cesmail.net) (216.154.195.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Jun 2010 19:20:01 +0000 Received: from unknown (HELO webmail2) ([192.168.1.183]) by c60.cesmail.net with ESMTP; 24 Jun 2010 15:19:55 -0400 Received: from 78.151.102.80 ([78.151.102.80]) by webmail.spamcop.net (Horde MIME library) with HTTP; Thu, 24 Jun 2010 15:19:54 -0400 Message-ID: <20100624151954.gl9owlc26o8w0wss-nzlynne@webmail.spamcop.net> Date: Thu, 24 Jun 2010 15:19:54 -0400 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Subject: RFA: PR44566: accessor macros (3/3): CRTL_ASM_CLOBBERS MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) 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 Bootstrapped and regression tested on i686-pc-linux-gnu in revision 161310. 2010-06-24 Joern Rennecke PR other/44566 * function.h (target-gtypes.h): Include. (struct function): New member target_arch. * Makefile.in (TARGET_NUM): New Makefile variable. (cs-tm.h): Add TARGET_NUM to DEFINES. (GTFILES): Add target-gtypes.h. * function.h (CRTL_ASM_CLOBBERS): Define. (struct rtl_data): Use type hard_reg_set_u for member asm_clobbers. * Makefile.in (target-gtypes.h, s-target-gtypes): New rules. * expr.c (expand_expr_real_1): Use CRTL_ASM_CLOBBERS. * ira.c (compute_regs_asm_clobbered): Likewise. (ira_setup_eliminable_regset): Likewise. Index: gcc/expr.c =================================================================== --- gcc/expr.c (revision 161310) +++ gcc/expr.c (working copy) @@ -8463,7 +8463,7 @@ expand_expr_real_1 (tree exp, rtx target int nregs = hard_regno_nregs[i][GET_MODE (decl_rtl)]; while (nregs) { - SET_HARD_REG_BIT (crtl->asm_clobbers, i); + SET_HARD_REG_BIT (CRTL_ASM_CLOBBERS, i); i++; nregs--; } Index: gcc/function.h =================================================================== --- gcc/function.h (revision 161310) +++ gcc/function.h (working copy) @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. #include "vecprim.h" #include "tm.h" /* For CUMULATIVE_ARGS. */ #include "hard-reg-set.h" +#include "target-gtypes.h" /* Stack of pending (incomplete) sequences saved by `start_sequence'. Each element describes one pending sequence. @@ -216,6 +217,8 @@ struct GTY(()) incoming_args { rtx internal_arg_pointer; }; +#define CRTL_ASM_CLOBBERS (crtl->asm_clobbers._hrs) + /* Data for function partitioning. */ struct GTY(()) function_subsections { /* Assembly labels for the hot and cold text sections, to @@ -443,7 +446,7 @@ struct GTY(()) rtl_data { asm. Unlike regs_ever_live, elements of this array corresponding to eliminable regs (like the frame pointer) are set if an asm sets them. */ - HARD_REG_SET asm_clobbers; + hard_reg_set_u GTY ((desc ("cfun ? cfun->target_arch : -1"))) asm_clobbers; }; #define return_label (crtl->x_return_label) @@ -607,6 +610,9 @@ struct GTY(()) function { adjusts one of its arguments and forwards to another function. */ unsigned int is_thunk : 1; + + /* Target architecture to compile this function for. */ + unsigned int target_arch : 8; }; /* If va_list_[gf]pr_size is set to this, it means we don't know how Index: gcc/ira.c =================================================================== --- gcc/ira.c (revision 161310) +++ gcc/ira.c (working copy) @@ -1464,7 +1464,7 @@ compute_regs_asm_clobbered (void) + hard_regno_nregs[dregno][mode] - 1; for (i = dregno; i <= end; ++i) - SET_HARD_REG_BIT(crtl->asm_clobbers, i); + SET_HARD_REG_BIT (CRTL_ASM_CLOBBERS, i); } } } @@ -1510,7 +1510,7 @@ ira_setup_eliminable_regset (void) = (! targetm.can_eliminate (eliminables[i].from, eliminables[i].to) || (eliminables[i].to == STACK_POINTER_REGNUM && need_fp)); - if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, eliminables[i].from)) + if (!TEST_HARD_REG_BIT (CRTL_ASM_CLOBBERS, eliminables[i].from)) { SET_HARD_REG_BIT (eliminable_regset, eliminables[i].from); @@ -1524,7 +1524,7 @@ ira_setup_eliminable_regset (void) df_set_regs_ever_live (eliminables[i].from, true); } #if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM - if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM)) + if (!TEST_HARD_REG_BIT (CRTL_ASM_CLOBBERS, HARD_FRAME_POINTER_REGNUM)) { SET_HARD_REG_BIT (eliminable_regset, HARD_FRAME_POINTER_REGNUM); if (need_fp) @@ -1538,7 +1538,7 @@ ira_setup_eliminable_regset (void) #endif #else - if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM)) + if (!TEST_HARD_REG_BIT (CRTL_ASM_CLOBBERS, HARD_FRAME_POINTER_REGNUM)) { SET_HARD_REG_BIT (eliminable_regset, FRAME_POINTER_REGNUM); if (need_fp) Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 161310) +++ gcc/Makefile.in (working copy) @@ -800,6 +800,9 @@ T = T_TARGET = T_TARGET : $(T_TARGET) +# For building rtl pases for extra target architectures. +TARGET_NUM=0 + # This should name the specs file that we're going to install. Target # Makefiles may override it and name another file to be generated from # the built-in specs and installed as the default spec, as long as @@ -1668,7 +1671,9 @@ cs-tconfig.h: Makefile cs-tm.h: Makefile TARGET_CPU_DEFAULT="$(target_cpu_default)" \ - HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \ + HEADERS="$(tm_include_list)" \ + DEFINES="TARGET_NUM=$(TARGET_NUM) \ + $(tm_defines)" \ $(SHELL) $(srcdir)/mkconfig.sh tm.h cs-tm_p.h: Makefile @@ -3671,7 +3676,7 @@ s-constrs-h: $(MD_DEPS) build/genpreds$( GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/vecprim.h $(srcdir)/vecir.h \ - $(host_xm_file_list) \ + $(host_xm_file_list) target-gtypes.h \ $(tm_file_list) $(HASHTAB_H) $(SPLAY_TREE_H) $(srcdir)/bitmap.h \ $(srcdir)/alias.h $(srcdir)/coverage.c $(srcdir)/rtl.h \ $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(SYMTAB_H) \ @@ -3848,6 +3853,17 @@ build/genpreds.o : genpreds.c $(RTL_BASE build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h +target-gtypes.h: s-target-gtypes; @true +# using struct instead of union makes this gty-safe. +s-target-gtypes: Makefile + (echo 'typedef union GTY (())'; \ + echo ' {'; \ + echo ' HARD_REG_SET GTY ((tag ("TARGET_NUM"))) _hrs;'; \ + echo ' } hard_reg_set_u;'; \ + ) >> tmp-target-gtypes.h + $(SHELL) $(srcdir)/../move-if-change tmp-target-gtypes.h target-gtypes.h + $(STAMP) s-target-gtypes + # Compile the programs that generate insn-* from the machine description. # They are compiled with $(COMPILER_FOR_BUILD), and associated libraries, # since they need to run on this machine