From patchwork Mon Jun 19 17:11:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 777878 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 3wryDs46dvz9s71 for ; Tue, 20 Jun 2017 03:11:24 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="BJOkdtq4"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=XbQQiSAQ9DwlSiMhT fxQV9Vk0MaPm/lhadI6meUYIolZrSrTF3t/fGzNwH+oxP/5VXPDILkZsrn9VC34m a/13QqKI5viK72lqvxNTGpjIOtDR8vkNkL+aUSTjXNAMdYC3L7mGlB7O9GG281ka 7vUFNSGoaSs6l/ObON+bJY148M= 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 :subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=xJ81KLxi6UWk95A/vxcp2Fe Vcy8=; b=BJOkdtq45EMWwcAA+XAoDgIUdkFiKjihX4ngRqq9OEywp9fMnRjYW7/ 9aAX4cueVsCudnzXJ1i7OEBBieDh20tfwJzUGnDJjh4SgTZvVF34pj270yedgmxC V43XoygKLxR5MNl7Zx3yCYhIgfemEJiS1za6ii2NtrcdGrgXZe8Q= Received: (qmail 109196 invoked by alias); 19 Jun 2017 17:11:10 -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 109174 invoked by uid 89); 19 Jun 2017 17:11:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=wondered, anchors, HTo:D*comcast.net, Hx-languages-length:4191 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; Mon, 19 Jun 2017 17:11:06 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1dN0Ci-0005Lh-R2 from Tom_deVries@mentor.com ; Mon, 19 Jun 2017 10:11:09 -0700 Received: from [127.0.0.1] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Mon, 19 Jun 2017 18:11:04 +0100 Subject: Add dg-add-options feature stack_size To: Mike Stump CC: GCC Patches , Rainer Orth References: <50077577-1941-e83f-aeb6-e63e1bd2701d@mentor.com> <62E9DFA1-67E2-442B-8348-61953EAEC5A9@comcast.net> From: Tom de Vries Message-ID: Date: Mon, 19 Jun 2017 19:11:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <62E9DFA1-67E2-442B-8348-61953EAEC5A9@comcast.net> X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) [ was: Re: [PATCH, testsuite] Add effective target stack_size ] On 06/09/2017 05:25 PM, Mike Stump wrote: > On Jun 9, 2017, at 7:24 AM, Tom de Vries wrote: >> this patch adds effective target stack_size. >> OK for trunk if x86_64 and nvptx testing succeeds? > Ok. Hi, I came across dg-add-options, and wondered if adding a dg-add-options feature stack_size is a better way to make STACK_SIZE available. Info looks like this: ... 7.2.3.12 Other attributes 'stack_size' Target has limited stack size. The stack size limit can be obtained using the STACK_SIZE macro defined by *note 'dg-add-options' feature 'stack_size': stack_size_ao. 7.2.4 Features for 'dg-add-options' 'stack_size' Add the flags needed to define macro STACK_SIZE and set it to the stack size limit associated with the *note 'stack_size' effective target: stack_size_et. ... Incomplete (updated just one testcase) and untested. OK if complete and tested? Thanks, - Tom Add dg-add-options feature stack_size 2017-06-19 Tom de Vries * doc/sourcebuild.texi (Add Options, Features for dg-add-options): Add stack_size feature. (Effective-Target Keywords, Other attributes): Suggest using dg-add-options stack_size feature to get stack limit in stack_size effective target documentation. * lib/target-supports.exp (add_options_for_stack_size): New proc. * gcc.c-torture/execute/920501-7.c: Use dg-add-options stack_size. --- gcc/doc/sourcebuild.texi | 15 ++++++++++----- gcc/testsuite/gcc.c-torture/execute/920501-7.c | 2 +- gcc/testsuite/lib/target-supports.exp | 11 +++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index e5f0da6..7f5c2cf 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2097,11 +2097,10 @@ Target supports section anchors. Target defaults to short enums. @item stack_size -Target has limited stack size. The stack size limit can be obtained using -@code{[dg-effective-target-value stack_size]}. For example: -@smallexample -/* @{ dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" @{ target @{ stack_size @} @} @} */ -@end smallexample +@anchor{stack_size_et} +Target has limited stack size. The stack size limit can be obtained using the +STACK_SIZE macro defined by @ref{stack_size_ao,,@code{dg-add-options} feature +@code{stack_size}}. @item static Target supports @option{-static}. @@ -2282,6 +2281,12 @@ compliance mode. @code{mips16} function attributes. Only MIPS targets support this feature, and only then in certain modes. +@item stack_size +@anchor{stack_size_ao} +Add the flags needed to define macro STACK_SIZE and set it to the stack size +limit associated with the @ref{stack_size_et,,@code{stack_size} effective +target}. + @item tls Add the target-specific flags needed to use thread-local storage. @end table diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-7.c b/gcc/testsuite/gcc.c-torture/execute/920501-7.c index 5cced09..1396eeb 100644 --- a/gcc/testsuite/gcc.c-torture/execute/920501-7.c +++ b/gcc/testsuite/gcc.c-torture/execute/920501-7.c @@ -1,6 +1,6 @@ /* { dg-require-effective-target label_values } */ /* { dg-require-effective-target trampolines } */ -/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ +/* { dg-add-options stack_size } */ #ifdef STACK_SIZE #define DEPTH ((STACK_SIZE) / 512 + 1) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 31701c2..502986e 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -7249,6 +7249,17 @@ proc add_options_for_double_vectors { flags } { return $flags } +# Add to FLAGS the flags needed to define the STACK_SIZE macro. + +proc add_options_for_stack_size { flags } { + if [is-effective-target stack_size] { + set stack_size [dg-effective-target-value stack_size] + return "$flags -DSTACK_SIZE=$stack_size" + } + + return $flags +} + # Return 1 if the target provides a full C99 runtime. proc check_effective_target_c99_runtime { } {