diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 006c3f74347..532c1b248c1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-09-14 Jan Hubicka + + * invoke.texi (-fconserve-stack): Document. + * opts.c (decode_options): Handle conserve_stack. + * common.opt (fconvserve_stack): New. + 2008-09-14 David Edelsohn * config.host: Add x-aix to host_xmake_file. diff --git a/gcc/common.opt b/gcc/common.opt index e7f8159a161..6f09dfdc2f4 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -385,6 +385,10 @@ fcommon Common Report Var(flag_no_common,0) Optimization Do not put uninitialized globals in the common section +fconserve-stack +Common Var(flag_conserve_stack,0) Optimization +Do not perform optimizations increasing noticeably stack usage + fcprop-registers Common Report Var(flag_cprop_registers) Optimization Perform a register copy-propagation optimization pass diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index eb9ecd555c0..dda7d8590b2 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -323,8 +323,8 @@ Objective-C and Objective-C++ Dialects}. -falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol --fcheck-data-deps -fcprop-registers -fcrossjumping -fcse-follow-jumps @gol --fcse-skip-blocks -fcx-fortran-rules -fcx-limited-range @gol +-fcheck-data-deps -fconserve-stack -fcprop-registers -fcrossjumping @gol +-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules -fcx-limited-range @gol -fdata-sections -fdce -fdce @gol -fdelayed-branch -fdelete-null-pointer-checks -fdse -fdse @gol -fearly-inlining -fexpensive-optimizations -ffast-math @gol @@ -5871,6 +5871,13 @@ those which have no call-preserved registers to use instead. Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. +@item -fconserve-stack +@opindex fconserve-stack +Attempt to minimize stack usage. The compiler will attempt to use less +stack space, even if that makes the program slower. This option +implies setting the @option{large-stack-frame} parameter to 100 +and the @option{large-stack-frame-growth} parameter to 400. + @item -ftree-reassoc @opindex ftree-reassoc Perform reassociation on trees. This flag is enabled by default diff --git a/gcc/opts.c b/gcc/opts.c index 5e97bdd4ec6..b45c0c53a57 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1112,6 +1112,14 @@ decode_options (unsigned int argc, const char **argv) optimization_current_node = optimization_default_node; first_time_p = false; } + if (flag_conserve_stack) + { + if (!PARAM_SET_P (PARAM_LARGE_STACK_FRAME)) + PARAM_VALUE (PARAM_LARGE_STACK_FRAME) = 100; + if (!PARAM_SET_P (PARAM_STACK_FRAME_GROWTH)) + PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) = 40; + } + } #define LEFT_COLUMN 27