This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Add dg-add-options feature stack_size


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]