From patchwork Sat Mar 30 17:11:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 232536 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id EA57A2C00DE for ; Sun, 31 Mar 2013 04:12:14 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:in-reply-to:subject:content-type:mime-version:message-id :date; q=dns; s=default; b=Twf8Gk/aYpsdhtC6AlytxaRIMsVqCREHUO68j ovO8RBEjkNtpyhfoyS7RU27IF6tGA7nh41KO1ccfDztdum5jyXD1cA8V0VHWk+wS 5udefP6+CfliNr1NVjwB0QQ5EnyG6odg6/Qf1bbZTN7I/Ct4gDFj3nf7euY/N2PQ +Lw0zA= 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:from :to:cc:in-reply-to:subject:content-type:mime-version:message-id :date; s=default; bh=35enjWqq2c9SOfYujcOo47SzAJY=; b=ktOV6XQ9jfb FS2ffruq2WwdjEkOHlO+E7jNDQBM4XJ06kqYjZtRoajJw+KxJR5hF20ngWCW0lp6 BNAnXX6xLBaxjgqhDBf6FYJ5nKW23+IA93+HW0UDK/5j7C7DoWqYnT3M8lPCZ7oq BmIozpi/5687HwaL6nIVmNQHAQtEtg64= Received: (qmail 7482 invoked by alias); 30 Mar 2013 17:11:27 -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 7044 invoked by uid 89); 30 Mar 2013 17:11:20 -0000 X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 30 Mar 2013 17:11:17 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1ULzJE-00036Y-8D from Tom_deVries@mentor.com ; Sat, 30 Mar 2013 10:11:16 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Sat, 30 Mar 2013 10:11:16 -0700 Received: from build1-lucid-cs (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Sat, 30 Mar 2013 10:11:15 -0700 Received: by build1-lucid-cs (Postfix, from userid 49877) id 720D3421213; Sat, 30 Mar 2013 10:11:15 -0700 (PDT) From: Tom de Vries To: Vladimir Makarov CC: gcc-patches In-Reply-To: <51558EF4.1030106@mentor.com> Subject: [PATCH][04/10] -fuse-caller-save - Add TARGET_FN_OTHER_HARD_REG_USAGE hook MIME-Version: 1.0 Message-ID: <20130330171115.720D3421213@build1-lucid-cs> Date: Sat, 30 Mar 2013 10:11:15 -0700 X-Virus-Found: No Vladimir, This patch adds a TARGET_FN_OTHER_HARD_REG_USAGE hook. The hook is used to list hard registers that are set or clobbered by a call to a function, but are not listed as such in the function body, such as f.i. registers clobbered by veneers inserted by the linker. Thanks, -Tom 2013-03-30 Radovan Obradovic Tom de Vries * hooks.c (hook_void_hard_reg_set_containerp): New function. * hooks.h (hook_void_hard_reg_set_containerp): Declare. * target.def (fn_other_hard_reg_usage): New DEFHOOK. * doc/tm.texi.in (@node Stack and Calling): Add Miscellaneous Register Hooks to @menu. (@node Miscellaneous Register Hooks): New node. (@hook TARGET_FN_OTHER_HARD_REG_USAGE): New hook. * doc/tm.texi: Regenerate. diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index cbbc82d..3bf7abe 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -3074,6 +3074,7 @@ This describes the stack layout and calling conventions. * Profiling:: * Tail Calls:: * Stack Smashing Protection:: +* Miscellaneous Register Hooks:: @end menu @node Frame Layout @@ -4999,6 +5000,14 @@ 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} void TARGET_FN_OTHER_HARD_REG_USAGE (struct hard_reg_set_container *@var{regs}) +Add any hard registers to @var{regs} that are set or clobbered by a call to the function. This hook only needs to be defined to provide registers that cannot be found by examination of the final RTL representation of a function. +@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 dfba947..4dfd8aa 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -3042,6 +3042,7 @@ This describes the stack layout and calling conventions. * Profiling:: * Tail Calls:: * Stack Smashing Protection:: +* Miscellaneous Register Hooks:: @end menu @node Frame Layout @@ -4922,6 +4923,12 @@ normally defined in @file{libgcc2.c}. @hook TARGET_SUPPORTS_SPLIT_STACK +@node Miscellaneous Register Hooks +@subsection Miscellaneous register hooks +@cindex miscellaneous register hooks + +@hook TARGET_FN_OTHER_HARD_REG_USAGE + @node Varargs @section Implementing the Varargs Macros @cindex varargs implementation diff --git a/gcc/hooks.c b/gcc/hooks.c index 3b54dfa..e038a95 100644 --- a/gcc/hooks.c +++ b/gcc/hooks.c @@ -446,3 +446,11 @@ void hook_void_gcc_optionsp (struct gcc_options *opts ATTRIBUTE_UNUSED) { } + +/* Generic hook that takes a struct hard_reg_set_container * and returns + void. */ + +void +hook_void_hard_reg_set_containerp (struct hard_reg_set_container *regs ATTRIBUTE_UNUSED) +{ +} diff --git a/gcc/hooks.h b/gcc/hooks.h index 50bcc6a..44decdf 100644 --- a/gcc/hooks.h +++ b/gcc/hooks.h @@ -69,6 +69,7 @@ extern void hook_void_tree (tree); extern void hook_void_tree_treeptr (tree, tree *); extern void hook_void_int_int (int, int); extern void hook_void_gcc_optionsp (struct gcc_options *); +extern void hook_void_hard_reg_set_containerp (struct hard_reg_set_container *); extern int hook_int_uint_mode_1 (unsigned int, enum machine_mode); extern int hook_int_const_tree_0 (const_tree); diff --git a/gcc/target.def b/gcc/target.def index 831cad8..e8f7c4a 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -2850,6 +2850,17 @@ DEFHOOK void, (bitmap regs), hook_void_bitmap) +/* For targets that need to mark extra registers as clobbered on entry to + the function, they should define this target hook and set their + bits in the struct hard_reg_set_container passed in. */ +DEFHOOK +(fn_other_hard_reg_usage, + "Add any hard registers to @var{regs} that are set or clobbered by a call to\ + the function. This hook only needs to be defined to provide registers that\ + cannot be found by examination of the final RTL representation of a function.", + void, (struct hard_reg_set_container *regs), + hook_void_hard_reg_set_containerp) + /* Fill in additional registers set up by prologue into a regset. */ DEFHOOK (set_up_by_prologue,