Commit 6b92ab17 by Tom de Vries Committed by Tom de Vries

Add dg-add-options feature stack_size

2017-06-21  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.c-torture/compile/20080806-1.c: Same.
	* gcc.c-torture/compile/920723-1.c: Same.
	* gcc.c-torture/compile/930621-1.c: Same.
	* gcc.c-torture/compile/991214-2.c: Same.
	* gcc.c-torture/compile/bcopy.c: Same.
	* gcc.c-torture/compile/memtst.c: Same.
	* gcc.c-torture/compile/msp.c: Same.
	* gcc.c-torture/compile/stuct.c: Same.
	* gcc.c-torture/execute/20011008-3.c: Same.
	* gcc.c-torture/execute/20030209-1.c: Same.
	* gcc.c-torture/execute/20031012-1.c: Same.
	* gcc.c-torture/execute/20040805-1.c: Same.
	* gcc.c-torture/execute/920410-1.c: Same.
	* gcc.c-torture/execute/921113-1.c: Same.
	* gcc.c-torture/execute/921202-1.c: Same.
	* gcc.c-torture/execute/921208-2.c: Same.
	* gcc.c-torture/execute/930106-1.c: Same.
	* gcc.c-torture/execute/930406-1.c: Same.
	* gcc.c-torture/execute/950221-1.c: Same.
	* gcc.c-torture/execute/960521-1.c: Same.
	* gcc.c-torture/execute/980605-1.c: Same.
	* gcc.c-torture/execute/comp-goto-1.c: Same.
	* gcc.c-torture/execute/comp-goto-2.c: Same.
	* gcc.c-torture/execute/memcpy-1.c: Same.
	* gcc.c-torture/execute/multi-ix.c: Same.
	* gcc.c-torture/execute/nestfunc-4.c: Same.
	* gcc.c-torture/execute/pr20621-1.c: Same.
	* gcc.c-torture/execute/pr23135.c: Same.
	* gcc.c-torture/execute/pr28982b.c: Same.
	* gcc.dg/loop-3.c: Same.
	* gcc.dg/struct-ret-3.c: Same.
	* gcc.dg/torture/stackalign/comp-goto-1.c: Same.
	* gcc.dg/torture/stackalign/non-local-goto-4.c: Same.
	* gcc.dg/tree-prof/comp-goto-1.c: Same.
	* gcc.dg/tree-prof/pr44777.c: Same.

From-SVN: r249440
parent ed39d22d
2017-06-21 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.
2017-06-21 Julian Brown <julian@codesourcery.com> 2017-06-21 Julian Brown <julian@codesourcery.com>
Naveen H.S <Naveen.Hurugalawadi@cavium.com> Naveen H.S <Naveen.Hurugalawadi@cavium.com>
......
...@@ -2097,11 +2097,10 @@ Target supports section anchors. ...@@ -2097,11 +2097,10 @@ Target supports section anchors.
Target defaults to short enums. Target defaults to short enums.
@item stack_size @item stack_size
Target has limited stack size. The stack size limit can be obtained using @anchor{stack_size_et}
@code{[dg-effective-target-value stack_size]}. For example: Target has limited stack size. The stack size limit can be obtained using the
@smallexample STACK_SIZE macro defined by @ref{stack_size_ao,,@code{dg-add-options} feature
/* @{ dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" @{ target @{ stack_size @} @} @} */ @code{stack_size}}.
@end smallexample
@item static @item static
Target supports @option{-static}. Target supports @option{-static}.
...@@ -2282,6 +2281,12 @@ compliance mode. ...@@ -2282,6 +2281,12 @@ compliance mode.
@code{mips16} function attributes. @code{mips16} function attributes.
Only MIPS targets support this feature, and only then in certain modes. 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 @item tls
Add the target-specific flags needed to use thread-local storage. Add the target-specific flags needed to use thread-local storage.
@end table @end table
......
2017-06-21 Tom de Vries <tom@codesourcery.com>
* 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.c-torture/compile/20080806-1.c: Same.
* gcc.c-torture/compile/920723-1.c: Same.
* gcc.c-torture/compile/930621-1.c: Same.
* gcc.c-torture/compile/991214-2.c: Same.
* gcc.c-torture/compile/bcopy.c: Same.
* gcc.c-torture/compile/memtst.c: Same.
* gcc.c-torture/compile/msp.c: Same.
* gcc.c-torture/compile/stuct.c: Same.
* gcc.c-torture/execute/20011008-3.c: Same.
* gcc.c-torture/execute/20030209-1.c: Same.
* gcc.c-torture/execute/20031012-1.c: Same.
* gcc.c-torture/execute/20040805-1.c: Same.
* gcc.c-torture/execute/920410-1.c: Same.
* gcc.c-torture/execute/921113-1.c: Same.
* gcc.c-torture/execute/921202-1.c: Same.
* gcc.c-torture/execute/921208-2.c: Same.
* gcc.c-torture/execute/930106-1.c: Same.
* gcc.c-torture/execute/930406-1.c: Same.
* gcc.c-torture/execute/950221-1.c: Same.
* gcc.c-torture/execute/960521-1.c: Same.
* gcc.c-torture/execute/980605-1.c: Same.
* gcc.c-torture/execute/comp-goto-1.c: Same.
* gcc.c-torture/execute/comp-goto-2.c: Same.
* gcc.c-torture/execute/memcpy-1.c: Same.
* gcc.c-torture/execute/multi-ix.c: Same.
* gcc.c-torture/execute/nestfunc-4.c: Same.
* gcc.c-torture/execute/pr20621-1.c: Same.
* gcc.c-torture/execute/pr23135.c: Same.
* gcc.c-torture/execute/pr28982b.c: Same.
* gcc.dg/loop-3.c: Same.
* gcc.dg/struct-ret-3.c: Same.
* gcc.dg/torture/stackalign/comp-goto-1.c: Same.
* gcc.dg/torture/stackalign/non-local-goto-4.c: Same.
* gcc.dg/tree-prof/comp-goto-1.c: Same.
* gcc.dg/tree-prof/pr44777.c: Same.
2017-06-20 David Malcolm <dmalcolm@redhat.com> 2017-06-20 David Malcolm <dmalcolm@redhat.com>
PR jit/81144 PR jit/81144
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
/* This used to ICE on s390x due to a reload bug. */ /* This used to ICE on s390x due to a reload bug. */
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#if defined(STACK_SIZE) && STACK_SIZE < 65536 #if defined(STACK_SIZE) && STACK_SIZE < 65536
# define GITT_SIZE 75 # define GITT_SIZE 75
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#if defined(STACK_SIZE) && (STACK_SIZE < 65536) #if defined(STACK_SIZE) && (STACK_SIZE < 65536)
# define BYTEMEM_SIZE 10000L # define BYTEMEM_SIZE 10000L
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#if defined(STACK_SIZE) && (STACK_SIZE < 65536) #if defined(STACK_SIZE) && (STACK_SIZE < 65536)
# define HISTO_SIZE 9 # define HISTO_SIZE 9
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
void void
bcopy1 (s, d, c) bcopy1 (s, d, c)
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#ifdef STACK_SIZE #ifdef STACK_SIZE
#define SIZE STACK_SIZE / 8 #define SIZE STACK_SIZE / 8
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#ifdef STACK_SIZE #ifdef STACK_SIZE
# define A_SIZE (STACK_SIZE/sizeof(int)) # define A_SIZE (STACK_SIZE/sizeof(int))
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#ifdef STACK_SIZE #ifdef STACK_SIZE
#define SIZE STACK_SIZE / 8 #define SIZE STACK_SIZE / 8
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
extern void exit (int); extern void exit (int);
extern void abort (void); extern void abort (void);
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#ifdef STACK_SIZE #ifdef STACK_SIZE
#if STACK_SIZE < 8*100*100 #if STACK_SIZE < 8*100*100
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
/* PR optimization/8750 /* PR optimization/8750
Used to fail under Cygwin with Used to fail under Cygwin with
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#if __INT_MAX__ < 32768 || (defined(STACK_SIZE) && STACK_SIZE < 0x12000) #if __INT_MAX__ < 32768 || (defined(STACK_SIZE) && STACK_SIZE < 0x12000)
int main () { exit (0); } int main () { exit (0); }
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#define STACK_REQUIREMENT (40000 * 4 + 256) #define STACK_REQUIREMENT (40000 * 4 + 256)
#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT #if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT
......
/* { dg-require-effective-target label_values } */ /* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */ /* { 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 #ifdef STACK_SIZE
#define DEPTH ((STACK_SIZE) / 512 + 1) #define DEPTH ((STACK_SIZE) / 512 + 1)
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#define STACK_REQUIREMENT (128 * 128 * 4 + 1024) #define STACK_REQUIREMENT (128 * 128 * 4 + 1024)
#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT #if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT
......
/* { dg-require-effective-target untyped_assembly } */ /* { dg-require-effective-target untyped_assembly } */
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#ifndef STACK_SIZE #ifndef STACK_SIZE
#define VLEN 2055 #define VLEN 2055
......
/* { dg-require-effective-target untyped_assembly } */ /* { dg-require-effective-target untyped_assembly } */
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#define STACK_REQUIREMENT (100000 * 4 + 1024) #define STACK_REQUIREMENT (100000 * 4 + 1024)
#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT #if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#if defined (STACK_SIZE) #if defined (STACK_SIZE)
#define DUMMY_SIZE 9 #define DUMMY_SIZE 9
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
f() f()
{ {
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
struct parsefile struct parsefile
{ {
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#include <stdio.h> #include <stdio.h>
......
/* { dg-require-effective-target label_values } */ /* { dg-require-effective-target label_values } */
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-require-effective-target label_values } */ /* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */ /* { dg-require-effective-target trampolines } */
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
/* A slight variation of 920501-7.c. */ /* A slight variation of 920501-7.c. */
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#include <string.h> #include <string.h>
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
/* Test for a reload bug: /* Test for a reload bug:
if you have a memory reference using the indexed addressing if you have a memory reference using the indexed addressing
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
/* Origin: hp@bitrange.com /* Origin: hp@bitrange.com
Test that return values come out right from a 1000-level call chain to Test that return values come out right from a 1000-level call chain to
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
/* When generating o32 MIPS PIC, main's $gp save slot was out of range /* When generating o32 MIPS PIC, main's $gp save slot was out of range
of a single load instruction. */ of a single load instruction. */
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
/* Based on execute/simd-1.c, modified by joern.rennecke@st.com to /* Based on execute/simd-1.c, modified by joern.rennecke@st.com to
trigger a reload bug. Verified for gcc mainline from 20050722 13:00 UTC trigger a reload bug. Verified for gcc mainline from 20050722 13:00 UTC
......
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
/* Like pr28982a.c, but with the spill slots outside the range of /* Like pr28982a.c, but with the spill slots outside the range of
a single sp-based load on ARM. This test tests for cases where a single sp-based load on ARM. This test tests for cases where
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O3" } */ /* { dg-options "-O3" } */
/* { dg-options "-O3 -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* { dg-options "-O3 -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#if defined(STACK_SIZE) && (STACK_SIZE < 65536) #if defined(STACK_SIZE) && (STACK_SIZE < 65536)
# define BYTEMEM_SIZE 10000L # define BYTEMEM_SIZE 10000L
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* Origin: Peeter Joot <peeterj@ca.ibm.com> */ /* Origin: Peeter Joot <peeterj@ca.ibm.com> */
/* { dg-do run { target *-*-linux* *-*-gnu* } } */ /* { dg-do run { target *-*-linux* *-*-gnu* } } */
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#include <sys/mman.h> #include <sys/mman.h>
#include <string.h> #include <string.h>
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-require-effective-target label_values } */ /* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */ /* { 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 #ifdef STACK_SIZE
#define DEPTH ((STACK_SIZE) / 512 + 1) #define DEPTH ((STACK_SIZE) / 512 + 1)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* { dg-require-effective-target nonlocal_goto } */ /* { dg-require-effective-target nonlocal_goto } */
/* { dg-require-effective-target label_values } */ /* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */ /* { dg-require-effective-target trampolines } */
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
extern void abort (void); extern void abort (void);
extern void exit (int); extern void exit (int);
......
/* { dg-require-effective-target freorder } */ /* { dg-require-effective-target freorder } */
/* { dg-require-effective-target label_values } */ /* { dg-require-effective-target label_values } */
/* { dg-options "-O2 -freorder-blocks-and-partition" } */ /* { dg-options "-O2 -freorder-blocks-and-partition" } */
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
#include <stdlib.h> #include <stdlib.h>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* { dg-require-effective-target label_values } */ /* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */ /* { dg-require-effective-target trampolines } */
/* { dg-options "-O0" } */ /* { dg-options "-O0" } */
/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ /* { dg-add-options stack_size } */
/* A variant of gcc.c-torture/execute/comp-goto-2.c. */ /* A variant of gcc.c-torture/execute/comp-goto-2.c. */
......
...@@ -7249,6 +7249,17 @@ proc add_options_for_double_vectors { flags } { ...@@ -7249,6 +7249,17 @@ proc add_options_for_double_vectors { flags } {
return $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. # Return 1 if the target provides a full C99 runtime.
proc check_effective_target_c99_runtime { } { proc check_effective_target_c99_runtime { } {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment