From patchwork Thu Jun 19 18:25:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 361957 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A995214007F for ; Fri, 20 Jun 2014 04:25:33 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=Z/EcMtDPe9oXcnuJx 8LmSNmUkWr8yDJA5AX9sLcmfR+L3uXUNlMB+n0IdE0WTVAKNu1wQAtBPPFiQjdES ymkfqa35y6XMBWw5OM3k7x4fqYMEke3lqDBUBuUxImRtuMNAUWCkQCQRY+GewfnS 7FXj+RZmcuVQ0SeMFv03eomJ64= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=pIgIYWz4aoY3Yprt/a7uduK lDmI=; b=GZQEMpqCt9t6mUPWo6Tyg854AKeaKY4Z4eVOxzrUy66xUnIAljlmMyV pD0gJ44lGw+VebN0SwnScfT9po/2inzL1MAdphYhawpvhcbaxM5RgmNYOLw0y5Ot b4ZpPJiIuLuqCCXY8BZfl2i5JCpT2wa6WVbefvEAmalvg1j/dOJ0= Received: (qmail 23278 invoked by alias); 19 Jun 2014 18:25:25 -0000 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 Received: (qmail 23268 invoked by uid 89); 19 Jun 2014 18:25:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Jun 2014 18:25:23 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Wxh1R-00067F-Pb from Tom_deVries@mentor.com ; Thu, 19 Jun 2014 11:25:17 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 19 Jun 2014 11:25:17 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Thu, 19 Jun 2014 19:25:15 +0100 Message-ID: <53A32B08.8040106@mentor.com> Date: Thu, 19 Jun 2014 20:25:12 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Richard Henderson CC: Richard Earnshaw , GCC Patches Subject: Re: [PATCH, AARCH64] Enable fuse-caller-save for AARCH64 References: <538AF9C7.7040408@mentor.com> <53A25E9D.1050005@redhat.com> In-Reply-To: <53A25E9D.1050005@redhat.com> On 19-06-14 05:53, Richard Henderson wrote: > On 06/01/2014 03:00 AM, Tom de Vries wrote: >> >+aarch64_emit_call_insn (rtx pat) >> >+{ >> >+ rtx insn = emit_call_insn (pat); >> >+ >> >+ rtx *fusage = &CALL_INSN_FUNCTION_USAGE (insn); >> >+ clobber_reg (fusage, gen_rtx_REG (word_mode, IP0_REGNUM)); >> >+ clobber_reg (fusage, gen_rtx_REG (word_mode, IP1_REGNUM)); > Actually, I'd like to know more about how this is supposed to work. > > Why are you only marking the two registers that would be used by a PLT entry, > but not those clobbered by the ld.so trampoline, or indeed the unknown function > that would be called from the PLT. > > Oh, I see, looking at the code we do actually follow the cgraph and make sure > it is a direct call with a known destination. So, in fact, it's only the > registers that could be clobbered by ld branch islands (so these two are still > correct for aarch64). > > This means the documentation is actually wrong when it mentions PLTs at all. Yes, if we go from the point of view that the TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS hooks sole purpose is to enable the fuse-caller-save optimization. How about this updated definition ? OK for trunk if re-testing on arm succeeds ? Thanks, - Tom 2014-06-19 Tom de Vries * config/arm/arm.c (arm_emit_call_insn): Remove clobber of CC_REGNUM. * target.def: Update defition. * doc/tm.texi: Regenerate. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index d293b5b..178f08b 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -17642,11 +17642,11 @@ arm_emit_call_insn (rtx pat, rtx addr, bool sibcall) if (TARGET_AAPCS_BASED) { /* For AAPCS, IP and CC can be clobbered by veneers inserted by the - linker. We need to add these to allow setting - TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS to true. */ + linker. We need to add IP to allow setting + TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS to true. CC is not + needed since it's a fixed register. */ rtx *fusage = &CALL_INSN_FUNCTION_USAGE (insn); clobber_reg (fusage, gen_rtx_REG (word_mode, IP_REGNUM)); - clobber_reg (fusage, gen_rtx_REG (word_mode, CC_REGNUM)); } } diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index c272630..b0a8dbd 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -4884,14 +4884,11 @@ Whether this target supports splitting the stack when the options described in @ @cindex miscellaneous register hooks @deftypevr {Target Hook} bool TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS -set to true if all the calls in the current function contain clobbers in -CALL_INSN_FUNCTION_USAGE for the registers that are clobbered by the call -rather than by the callee, and are not already set or clobbered in the call -pattern. Examples of such registers are registers used in PLTs and stubs, -and temporary registers used in the call instruction but not present in the -rtl pattern. Another way to formulate it is the registers not present in the -rtl pattern that are clobbered by the call assuming the callee does not -clobber any register. The default version of this hook is set to false. +Set to true if each call that binds to a local definition contain clobbers +in CALL_INSN_FUNCTION_USAGE for the non-fixed registers that are clobbered by +the call rather than by the callee, and are not already set or clobbered in +the call pattern. The default version of this hook is set to false. The +purpose of this hook it to enable the fuse-caller-save optimization. @end deftypevr @node Varargs diff --git a/gcc/target.def b/gcc/target.def index e455211..b738281 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -5128,18 +5128,15 @@ FRAME_POINTER_REGNUM, ARG_POINTER_REGNUM, and the PIC_OFFSET_TABLE_REGNUM.", hook_void_bitmap) /* Targets should define this target hook to mark that non-callee clobbers are - present in CALL_INSN_FUNCTION_USAGE for all the calls in the current - function. */ + present in CALL_INSN_FUNCTION_USAGE for all the calls that bind to a local + definition. */ DEFHOOKPOD (call_fusage_contains_non_callee_clobbers, - "set to true if all the calls in the current function contain clobbers in\n\ -CALL_INSN_FUNCTION_USAGE for the registers that are clobbered by the call\n\ -rather than by the callee, and are not already set or clobbered in the call\n\ -pattern. Examples of such registers are registers used in PLTs and stubs,\n\ -and temporary registers used in the call instruction but not present in the\n\ -rtl pattern. Another way to formulate it is the registers not present in the\n\ -rtl pattern that are clobbered by the call assuming the callee does not\n\ -clobber any register. The default version of this hook is set to false.", + "Set to true if each call that binds to a local definition contain clobbers\n\ +in CALL_INSN_FUNCTION_USAGE for the non-fixed registers that are clobbered by\n\ +the call rather than by the callee, and are not already set or clobbered in\n\ +the call pattern. The default version of this hook is set to false. The\n\ +purpose of this hook it to enable the fuse-caller-save optimization.", bool, false) -- 1.9.1