From patchwork Mon Apr 23 21:04:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 154539 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 B5214B6FAA for ; Tue, 24 Apr 2012 07:06:52 +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=1335820014; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=4Rs6WGD cA19u81+D2y7Caax5vjY=; b=AC55+Me5VoPE6WvKzqOZoyC+7bBGhK5dCgkX7gc M3kP4GMfnYHHe7zTM4FXVJ6ZPb9JWqhggYlm6pvho4uZ0qay6TBu/joyAoUn5l73 2W0Gf6wqrYAk9atl9Mm8rAxJIC+7P/DS2BrSIc89VNStah6ko+TiLHqFvlcBtW2S Lchc= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=WpPwoCRvBRG5J1nL5QrvymsU26DsEcgNkRC2j+9Er1BlmnEfjYGty3Ge0Sw54B w60I1SQn34noQW45vrt/uhWRczNfh2CgKGNH0S9EzQwf79VyjCmT7Yea4DDU7Vel 1P+a+EP2Y1gq+kB+6DS7RpL4/03NUqAsXhbtshjatlSJU=; Received: (qmail 20353 invoked by alias); 23 Apr 2012 21:06:48 -0000 Received: (qmail 20344 invoked by uid 22791); 23 Apr 2012 21:06:47 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Apr 2012 21:06:31 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3NL6U89026136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 Apr 2012 17:06:30 -0400 Received: from localhost.localdomain (ovpn-113-68.phx2.redhat.com [10.3.113.68]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3NL6T2h011735 for ; Mon, 23 Apr 2012 17:06:30 -0400 Message-ID: <4F95C3E9.7040304@redhat.com> Date: Mon, 23 Apr 2012 17:04:41 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [lra] patch to bootstrap GCC with LRA on PA-RISC 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 The following patch makes GCC bootstrap on PA-RISC successful. Committed as rev. 186724. 2012-04-23 Vladimir Makarov * targhooks.h (default_different_addr_displacement_p): Declare. * targhooks.c (default_different_addr_displacement_p): New function. * target.def (different_addr_displacement_p): New hook. * rtlanal.c (simplify_subreg_regno): Permit ARG_POINTER_REGNUM for LRA. * lra-spills.c (spill_pseudos): Check different_addr_displacement_p to invalidate insn alternative. * config/pa/pa.c (TARGET_DIFFERENT_ADDR_DISPLACEMENT_P): Redefine it. (pa_secondary_reload): Return NO_REGS for LRA. (pa_different_addr_displacement_p): New function. * doc/tm.texi: Rebuild. Index: doc/tm.texi =================================================================== --- doc/tm.texi (revision 186357) +++ doc/tm.texi (working copy) @@ -2875,6 +2875,10 @@ as below: A target hook which returns the register bank number to which the register @var{hard_regno} belongs to. The smaller the number, the more preferable the hard register usage (when all other conditions are the same). This hook can be used to prefer some hard register over others in LRA. For example, some x86-64 register usage needs additional prefix which makes instructions longer. The hook can return bigger bank number for such registers make them less favorable and as result making the generated code smaller. The default version of this target hook returns always zero. @end deftypefn +@deftypefn {Target Hook} bool TARGET_DIFFERENT_ADDR_DISPLACEMENT_P (void) +A target hook which returns true if an address with the same structure can have different maximal legitimate displacement. For example, the displacement can depend on memory mode or on operand combinations in the insn. The default version of this target hook returns always false. +@end deftypefn + @node Old Constraints @section Obsolete Macros for Defining Constraints @cindex defining constraints, obsolete method Index: target.def =================================================================== --- target.def (revision 186357) +++ target.def (working copy) @@ -2300,6 +2300,18 @@ DEFHOOK int, (int), default_register_bank) +/* Return true if maximal address displacement can be different. */ +DEFHOOK +(different_addr_displacement_p, + "A target hook which returns true if an address with the same structure\ + can have different maximal legitimate displacement. For example, the\ + displacement can depend on memory mode or on operand combinations in\ + the insn.\ + \ + The default version of this target hook returns always false.", + bool, (void), + default_different_addr_displacement_p) + /* Return the class for a secondary reload, and fill in extra information. */ DEFHOOK (secondary_reload, Index: lra-spills.c =================================================================== --- lra-spills.c (revision 186357) +++ lra-spills.c (working copy) @@ -445,8 +445,8 @@ spill_pseudos (void) "Changing spilled pseudos to memory in insn #%u\n", INSN_UID (insn)); lra_push_insn (insn); - if (lra_reg_spill_p) - lra_set_used_insn_alternative_by_uid (INSN_UID (insn), -1); + if (lra_reg_spill_p || targetm.different_addr_displacement_p ()) + lra_set_used_insn_alternative (insn, -1); } bitmap_and_compl_into (DF_LR_IN (bb), &spilled_pseudos); bitmap_and_compl_into (DF_LR_OUT (bb), &spilled_pseudos); Index: targhooks.c =================================================================== --- targhooks.c (revision 186357) +++ targhooks.c (working copy) @@ -840,6 +840,12 @@ default_register_bank (int hard_regno AT return 0; } +extern bool +default_different_addr_displacement_p (void) +{ + return false; +} + reg_class_t default_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED, reg_class_t reload_class_i ATTRIBUTE_UNUSED, Index: targhooks.h =================================================================== --- targhooks.h (revision 186357) +++ targhooks.h (working copy) @@ -125,6 +125,7 @@ extern void default_trampoline_init (rtx extern int default_return_pops_args (tree, tree, int); extern reg_class_t default_branch_target_register_class (void); extern int default_register_bank (int); +extern bool default_different_addr_displacement_p (void); extern reg_class_t default_secondary_reload (bool, rtx, reg_class_t, enum machine_mode, secondary_reload_info *); Index: rtlanal.c =================================================================== --- rtlanal.c (revision 186357) +++ rtlanal.c (working copy) @@ -3497,7 +3497,8 @@ simplify_subreg_regno (unsigned int xreg return -1; if (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM - && xregno == ARG_POINTER_REGNUM) + && xregno == ARG_POINTER_REGNUM + && ! lra_in_progress) return -1; if (xregno == STACK_POINTER_REGNUM Index: config/pa/pa.c =================================================================== --- config/pa/pa.c (revision 186357) +++ config/pa/pa.c (working copy) @@ -188,6 +188,7 @@ static enum machine_mode pa_c_mode_for_s static section *pa_function_section (tree, enum node_frequency, bool, bool); static bool pa_cannot_force_const_mem (enum machine_mode, rtx); static bool pa_legitimate_constant_p (enum machine_mode, rtx); +static bool pa_different_addr_displacement_p (void); /* The following extra sections are only used for SOM. */ static GTY(()) section *som_readonly_data_section; @@ -384,6 +385,9 @@ static size_t n_deferred_plabels = 0; #undef TARGET_LEGITIMATE_CONSTANT_P #define TARGET_LEGITIMATE_CONSTANT_P pa_legitimate_constant_p +#undef TARGET_DIFFERENT_ADDR_DISPLACEMENT_P +#define TARGET_DIFFERENT_ADDR_DISPLACEMENT_P pa_different_addr_displacement_p + struct gcc_target targetm = TARGET_INITIALIZER; /* Parse the -mfixed-range= option string. */ @@ -5848,6 +5852,9 @@ pa_secondary_reload (bool in_p, rtx x, r int regno; enum reg_class rclass = (enum reg_class) rclass_i; + if (lra_in_progress) + return NO_REGS; + /* Handle the easy stuff first. */ if (rclass == R1_REGS) return NO_REGS; @@ -10338,4 +10345,12 @@ pa_legitimate_constant_p (enum machine_m return true; } +/* Implement TARGET_DIFFERENT_ADDR_DISPLACEMENT_P. */ + +static bool +pa_different_addr_displacement_p (void) +{ + return true; +} + #include "gt-pa.h"