diff options
Diffstat (limited to 'gnu/egcs/gcc')
-rw-r--r-- | gnu/egcs/gcc/config/alpha/alpha.c | 3 | ||||
-rw-r--r-- | gnu/egcs/gcc/config/m68k/m68k.c | 2 | ||||
-rw-r--r-- | gnu/egcs/gcc/config/m88k/m88k.c | 3 | ||||
-rw-r--r-- | gnu/egcs/gcc/config/sparc/sparc.c | 4 | ||||
-rw-r--r-- | gnu/egcs/gcc/config/vax/vax.h | 9 | ||||
-rw-r--r-- | gnu/egcs/gcc/flags.h | 6 | ||||
-rw-r--r-- | gnu/egcs/gcc/toplev.c | 17 |
7 files changed, 42 insertions, 2 deletions
diff --git a/gnu/egcs/gcc/config/alpha/alpha.c b/gnu/egcs/gcc/config/alpha/alpha.c index 2d62693d76b..861d58d644f 100644 --- a/gnu/egcs/gcc/config/alpha/alpha.c +++ b/gnu/egcs/gcc/config/alpha/alpha.c @@ -3460,6 +3460,9 @@ alpha_expand_prologue () + ALPHA_ROUND (frame_size + current_function_pretend_args_size)); + if (warn_stack_larger_than && frame_size > stack_larger_than_size) + warning ("stack usage is %d bytes", frame_size); + if (TARGET_OPEN_VMS) reg_offset = 8; else diff --git a/gnu/egcs/gcc/config/m68k/m68k.c b/gnu/egcs/gcc/config/m68k/m68k.c index e751326c85b..72d305c073a 100644 --- a/gnu/egcs/gcc/config/m68k/m68k.c +++ b/gnu/egcs/gcc/config/m68k/m68k.c @@ -151,6 +151,8 @@ output_function_prologue (stream, size) int fsize = (size + 3) & -4; int cfa_offset = INCOMING_FRAME_SP_OFFSET, cfa_store_offset = cfa_offset; + if (warn_stack_larger_than && fsize > stack_larger_than_size) + warning ("stack usage is %d bytes", fsize); if (frame_pointer_needed) { diff --git a/gnu/egcs/gcc/config/m88k/m88k.c b/gnu/egcs/gcc/config/m88k/m88k.c index 6c46ff1d544..8c9eaed2678 100644 --- a/gnu/egcs/gcc/config/m88k/m88k.c +++ b/gnu/egcs/gcc/config/m88k/m88k.c @@ -1920,6 +1920,9 @@ m88k_expand_prologue () { m88k_layout_frame (); + if (warn_stack_larger_than && m88k_stack_size > stack_larger_than_size) + warning ("stack usage is %d bytes", m88k_stack_size); + if (m88k_stack_size) emit_add (stack_pointer_rtx, stack_pointer_rtx, -m88k_stack_size); diff --git a/gnu/egcs/gcc/config/sparc/sparc.c b/gnu/egcs/gcc/config/sparc/sparc.c index 9d8fade6c62..35800d7aee3 100644 --- a/gnu/egcs/gcc/config/sparc/sparc.c +++ b/gnu/egcs/gcc/config/sparc/sparc.c @@ -3116,6 +3116,10 @@ output_function_prologue (file, size, leaf_function) int size; int leaf_function; { + if (warn_stack_larger_than && + SPARC_STACK_ALIGN (size) > stack_larger_than_size) + warning ("stack usage is %d bytes", SPARC_STACK_ALIGN (size)); + /* Need to use actual_fsize, since we are also allocating space for our callee (and our own register save area). */ actual_fsize = compute_frame_size (size, leaf_function); diff --git a/gnu/egcs/gcc/config/vax/vax.h b/gnu/egcs/gcc/config/vax/vax.h index 89f6b8a639d..6492ea6d331 100644 --- a/gnu/egcs/gcc/config/vax/vax.h +++ b/gnu/egcs/gcc/config/vax/vax.h @@ -466,8 +466,13 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12)) mask |= 1 << regno; \ fprintf (FILE, "\t.word 0x%x\n", mask); \ MAYBE_VMS_FUNCTION_PROLOGUE(FILE) \ - if ((size) >= 64) fprintf (FILE, "\tmovab %d(sp),sp\n", -size);\ - else if (size) fprintf (FILE, "\tsubl2 $%d,sp\n", (size)); } + if (warn_stack_larger_than && size > stack_larger_than_size) \ + warning ("stack usage is %d bytes", size); \ + if ((size) >= 64) \ + fprintf (FILE, "\tmovab %d(sp),sp\n", -size); \ + else if (size) \ + fprintf (FILE, "\tsubl2 $%d,sp\n", (size)); \ +} /* vms.h redefines this. */ #define MAYBE_VMS_FUNCTION_PROLOGUE(FILE) diff --git a/gnu/egcs/gcc/flags.h b/gnu/egcs/gcc/flags.h index bc1c5690f3d..a63a4e5ab14 100644 --- a/gnu/egcs/gcc/flags.h +++ b/gnu/egcs/gcc/flags.h @@ -132,6 +132,12 @@ extern unsigned id_clash_len; extern int warn_larger_than; extern unsigned larger_than_size; +/* Nonzero means warn about any function whose stack usage is larger + than N bytes. The value N is in `stack_larger_than_size'. */ + +extern int warn_stack_larger_than; +extern unsigned stack_larger_than_size; + /* Warn if a function returns an aggregate, since there are often incompatible calling conventions for doing this. */ diff --git a/gnu/egcs/gcc/toplev.c b/gnu/egcs/gcc/toplev.c index 7443a766999..f8f616fb300 100644 --- a/gnu/egcs/gcc/toplev.c +++ b/gnu/egcs/gcc/toplev.c @@ -1257,6 +1257,12 @@ unsigned id_clash_len; int warn_larger_than; unsigned larger_than_size; +/* Nonzero means warn about any function whose stack usage is larger + than N bytes. The value N is in `stack_larger_than_size'. */ + +int warn_stack_larger_than; +unsigned stack_larger_than_size; + /* Nonzero means warn if inline function is too large. */ int warn_inline; @@ -4576,6 +4582,7 @@ display_help () printf (" -Wid-clash-<num> Warn if 2 identifiers have the same first <num> chars\n"); printf (" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n"); + printf (" -Wstack-larger-than-<number> Warn if a function stack usage is larger than <number> bytes\n"); printf (" -p Enable function profiling\n"); #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER) printf (" -a Enable block profiling \n"); @@ -5219,6 +5226,16 @@ main (argc, argv) warn_larger_than = 1; } } + else if (!strncmp (p, "stack-larger-than-", 18)) + { + const int stack_larger_than_val + = read_integral_parameter (p + 18, p - 2, -1); + if (stack_larger_than_val != -1) + { + stack_larger_than_size = stack_larger_than_val; + warn_stack_larger_than = 1; + } + } else error ("Invalid option `%s'", argv[i]); } |