From patchwork Thu Apr 24 07:12:48 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: 342111 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 24D521400F7 for ; Thu, 24 Apr 2014 17:13:08 +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=Yug2kFjt6NIcJOtff n/4m6B8mbUhguKqh/kkfd+QkCv9qv9mt7LnCI0mH4JzpqoNhLYrXCX4P8EyX7EOs przTqL4X8UdlGbblLXcgchD1yo7uWMHRlL8UdNHwdbeBD+2EjnzcVHi7k++FosIs wE9KwZDC78xJFR69VQUcKsa4S8= 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=m51BE/ngUqu9h4E9Ffk1NIh S9JY=; b=ZjoC/XXz27S7XK0Xnj1TE32q3Oh/sEkrX6YNYhHCO9j1+MFMhde4VA7 WewvNrHoMwAdcBrLnvEsh3lFsxPdjndQBuGscSJFnyuzEUu3nz0MB+ogm7Ywa9BT SvGK4EHFgAb9rDZsnpaI0W+BCZTeNwNqV/76XROdImhhN66+UQ40= Received: (qmail 29346 invoked by alias); 24 Apr 2014 07:13:00 -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 29334 invoked by uid 89); 24 Apr 2014 07:13:00 -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, 24 Apr 2014 07:12:58 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WdDq0-0004R0-NX from Tom_deVries@mentor.com ; Thu, 24 Apr 2014 00:12:52 -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); Thu, 24 Apr 2014 00:12:52 -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; Thu, 24 Apr 2014 08:12:50 +0100 Message-ID: <5358B970.5020801@mentor.com> Date: Thu, 24 Apr 2014 09:12:48 +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: Re: 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> <53569A6E.4010101@mentor.com> <87d2g8gjyy.fsf@talisman.default> In-Reply-To: <87d2g8gjyy.fsf@talisman.default> On 23-04-14 17:10, Richard Sandiford wrote: > FWIW I think this should be a plain bool rather than a function, > like delay_sched2 etc. > Vladimir, I've reimplemented the hook using DEFHOOKPOD instead of DEFHOOK, to make it a plain bool. OK for trunk? Thanks, - Tom 2013-04-29 Radovan Obradovic Tom de Vries * target.def (call_fusage_contains_non_callee_clobbers): New DEFHOOKPOD. * 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..f06113d 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 + +@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. +@end deftypevr + @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..5787e13 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. */ +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.", + bool, + false) + /* Fill in additional registers set up by prologue into a regset. */ DEFHOOK (set_up_by_prologue,