From patchwork Tue Apr 22 16:35:58 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: 341404 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 5879B14011D for ; Wed, 23 Apr 2014 02:36:16 +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=TZrRzAsxevQR9JWHu P/CG3QIwFaWhAiN5XCgx/4+gTiQC4qOowROmj+8DmV5cKXO3b4rmiInxW0I5ShLo 87y91OAIjw5JwW7528YYwz3rr0lMMz9G2FA24hDhI/ZVyii3fEqeZJ6MASlHCS8w U7/hRQE3KX4KzZ1OBVc3GG2qnI= 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=TWGk/Nb0SSxTtjxEwjnoLBP /NPA=; b=rGx1WaycZKn+ZLlLvxIHY81iHvp9aTbHexKp75WkfnGjEUokrD6k7wi 0x71eOKGN7tL75whGWvWbDFQNq4ulq/c4ryng3FX7dHBjYjl61L102nzLh8QhyZt xoJuBS/GQb8J+Ylt4nGF8MOwbdnVzyn77gxv39eh2hmjZIEeC3II= Received: (qmail 29422 invoked by alias); 22 Apr 2014 16:36:09 -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 29398 invoked by uid 89); 22 Apr 2014 16:36:08 -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; Tue, 22 Apr 2014 16:36:07 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Wcdfv-0004WJ-7Y from Tom_deVries@mentor.com ; Tue, 22 Apr 2014 09:36:03 -0700 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 22 Apr 2014 09:36:01 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.2.247.3; Tue, 22 Apr 2014 17:35:59 +0100 Message-ID: <53569A6E.4010101@mentor.com> Date: Tue, 22 Apr 2014 18:35:58 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Vladimir Makarov CC: "gcc-patches@gcc.gnu.org" Subject: Add call_fusage_contains_non_callee_clobbers hook References: <534ED7BC.50300@mentor.com> <534FF0F9.60404@redhat.com> <87lhv4ug7f.fsf@sandifor-thinkpad.stglab.manchester.uk.ibm.com> <53500628.2090802@redhat.com> <5356853D.8050905@mentor.com> In-Reply-To: <5356853D.8050905@mentor.com> On 22-04-14 17:05, Tom de Vries wrote: > I've updated the fuse-caller-save patch series to model non-callee call clobbers > in CALL_INSN_FUNCTION_USAGE. > Vladimir, This patch adds a hook to indicate whether a target has added the non-callee call clobbers to CALL_INSN_FUNCTION_USAGE, meaning it's safe to do the fuse-caller-save optimization. OK for trunk? Thanks, - Tom 2013-04-29 Radovan Obradovic Tom de Vries * target.def (call_fusage_contains_non_callee_clobbers): New DEFHOOK. * doc/tm.texi.in (@node Stack and Calling): Add Miscellaneous Register Hooks to @menu. (@node Miscellaneous Register Hooks): New node. (@hook TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS): New hook. * doc/tm.texi: Regenerate. diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index b8ca17e..8af8efd 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -3091,6 +3091,7 @@ This describes the stack layout and calling conventions. * Profiling:: * Tail Calls:: * Stack Smashing Protection:: +* Miscellaneous Register Hooks:: @end menu @node Frame Layout @@ -5016,6 +5017,21 @@ normally defined in @file{libgcc2.c}. Whether this target supports splitting the stack when the options described in @var{opts} have been passed. This is called after options have been parsed, so the target may reject splitting the stack in some configurations. The default version of this hook returns false. If @var{report} is true, this function may issue a warning or error; if @var{report} is false, it must simply return a value @end deftypefn +@node Miscellaneous Register Hooks +@subsection Miscellaneous register hooks +@cindex miscellaneous register hooks + +@deftypefn {Target Hook} bool TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS (void) +Return 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 returns false. +@end deftypefn + @node Varargs @section Implementing the Varargs Macros @cindex varargs implementation diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index d793d26..8991c3c 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -2720,6 +2720,7 @@ This describes the stack layout and calling conventions. * Profiling:: * Tail Calls:: * Stack Smashing Protection:: +* Miscellaneous Register Hooks:: @end menu @node Frame Layout @@ -3985,6 +3986,12 @@ the function prologue. Normally, the profiling code comes after. @hook TARGET_SUPPORTS_SPLIT_STACK +@node Miscellaneous Register Hooks +@subsection Miscellaneous register hooks +@cindex miscellaneous register hooks + +@hook TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS + @node Varargs @section Implementing the Varargs Macros @cindex varargs implementation diff --git a/gcc/target.def b/gcc/target.def index 3a64cd1..ae0bc9c 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -5130,6 +5130,22 @@ FRAME_POINTER_REGNUM, ARG_POINTER_REGNUM, and the PIC_OFFSET_TABLE_REGNUM.", void, (bitmap regs), 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. */ +DEFHOOK +(call_fusage_contains_non_callee_clobbers, + "Return 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 returns false.", + bool, (void), + hook_bool_void_false) + /* Fill in additional registers set up by prologue into a regset. */ DEFHOOK (set_up_by_prologue,