public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Mike Stump <mikestump@comcast.net>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Rainer Orth	<ro@CeBiTec.Uni-Bielefeld.DE>
Subject: Add dg-add-options feature stack_size
Date: Mon, 19 Jun 2017 17:11:00 -0000	[thread overview]
Message-ID: <bfa700c2-db7a-e39a-6de9-4100ab777b01@mentor.com> (raw)
In-Reply-To: <62E9DFA1-67E2-442B-8348-61953EAEC5A9@comcast.net>

[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]

[ 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<Tom_deVries@mentor.com>  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

[-- Attachment #2: 0001-Add-dg-add-options-feature-stack_size.patch --]
[-- Type: text/x-patch, Size: 3259 bytes --]

Add dg-add-options feature stack_size

2017-06-19  Tom de Vries  <tom@codesourcery.com>

	* 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 { } {

  parent reply	other threads:[~2017-06-19 17:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09 14:24 [PATCH, testsuite] Add effective target stack_size Tom de Vries
2017-06-09 15:25 ` Mike Stump
2017-06-12 12:28   ` Christophe Lyon
2017-06-12 14:29     ` Tom de Vries
2017-06-19  9:21       ` Christophe Lyon
2017-06-19 15:42         ` Mike Stump
2017-06-19 17:11   ` Tom de Vries [this message]
2017-06-19 17:36     ` Add dg-add-options feature stack_size Mike Stump
2017-06-21 13:19 ` [PATCH, testsuite] Add effective target stack_size Jakub Jelinek
2017-06-21 14:27   ` [testsuite, committed] Support dg-add-options in profopt.exp Tom de Vries
2022-11-08 20:29 ` nvptx: stack size limits are relevant for execution only (was: [PATCH, testsuite] Add effective target stack_size) Thomas Schwinge
2022-11-25 11:09   ` [PING] " Thomas Schwinge
2022-12-20  7:55     ` [PING^2] " Thomas Schwinge
2023-01-11 11:45       ` [PING^3] " Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bfa700c2-db7a-e39a-6de9-4100ab777b01@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mikestump@comcast.net \
    --cc=ro@CeBiTec.Uni-Bielefeld.DE \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).