diff options
author | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-04-08 21:46:08 +0000 |
---|---|---|
committer | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-04-08 21:46:08 +0000 |
commit | 10b2bb30426070c8b2e4f0d2db382805a94a4913 (patch) | |
tree | dead53cd1d4f1c204f3597d9701bfc77638335b5 /gcc/fortran/invoke.texi | |
parent | 713209080e93abe21e7e913145e20aab60ad1ecb (diff) | |
download | gcc-10b2bb30426070c8b2e4f0d2db382805a94a4913.tar.gz |
2011-04-08 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/48448
* gfortran.h (gfc_option_t): Add warn_function_elimination and
flag_frontend_optimize.
* lang.opt (Wfunction-elimination): Add.
(ffrontend-optimize): Add.
* invoke.texi: Add documentation for -Wfunction-elimination
and -ffrontend-optimize. Add -faggressive-function-elimination
to list of code generation options.
* frontend-passes.c (gfc_run_passes): Run optimizations if
flag_frontend_optimize is set.
(warn_function_elimination): New function.
(cfe_expr_0): Call it if requested to do so.
* options.c (gfc_init_options): Initiate warn_function_elimination
and flag_frontend_optimize.
(gfc_post_options): Set flag_frontend_optimize if not specified
by user, depending on the optimization level.
(gfc_handle_option): Handle -Wfunction-elimination and
-ffrontend-optimize.
2011-04-08 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/48448
* gfortran.dg/function_optimize_5.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172215 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/invoke.texi')
-rw-r--r-- | gcc/fortran/invoke.texi | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 5441dbcc121..96beff58215 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -139,7 +139,7 @@ and warnings}. -Wall -Waliasing -Wampersand -Warray-bounds -Wcharacter-truncation @gol -Wconversion -Wimplicit-interface -Wimplicit-procedure -Wline-truncation @gol -Wintrinsics-std -Wsurprising -Wno-tabs -Wunderflow -Wunused-parameter @gol --Wintrinsic-shadow -Wno-align-commons} +-Wintrinsic-shadow -Wno-align-commons -Wfunction-elimination} @item Debugging Options @xref{Debugging Options,,Options for debugging your program or GNU Fortran}. @@ -171,7 +171,8 @@ and warnings}. -fblas-matmul-limit=@var{n} -frecursive -finit-local-zero @gol -finit-integer=@var{n} -finit-real=@var{<zero|inf|-inf|nan|snan>} @gol -finit-logical=@var{<true|false>} -finit-character=@var{n} @gol --fno-align-commons -fno-protect-parens -frealloc-lhs} +-fno-align-commons -fno-protect-parens -frealloc-lhs @gol +-faggressive-function-elimination -ffrontend-optimize} @end table @menu @@ -859,6 +860,14 @@ By default, @command{gfortran} warns about any occasion of variables being padded for proper alignment inside a @code{COMMON} block. This warning can be turned off via @option{-Wno-align-commons}. See also @option{-falign-commons}. +@item -Wfunction-elimination +@opindex @code{Wfunction-elimination} +@cindex function elimination +@cindex warnings, function elimination +Warn if any calls to functions are eliminated by the optimizations +enabled by the @option{-ffrontend-optimize} option. + + @item -Werror @opindex @code{Werror} @cindex warnings, to errors @@ -1482,8 +1491,19 @@ statements, regardless of whether these functions are marked @smallexample a = f(b,c) + f(b,c) @end smallexample -there will only be a single call to @code{f}. - +there will only be a single call to @code{f}. This option only works +if @option{-ffrontend-optimize} is in effect. + +@item -ffrontend-optimize +@opindex @code{frontend-optimize} +@cindex Front-end optimization +This option performs front-end optimization, based on manipulating +parts the Fortran parse tree. Enabled by default by any @option{-O} +option. Optimizations enabled by this option include elimination of +identical function calls within expressions, removing unnecessary +calls to @code{TRIM} in comparisons and assignments and replacing +@code{TRIM(a)} with @code{a(1:LEN_TRIM(a))}. +It can be deselected by specifying @option{-fno-frontend-optimize}. @end table @xref{Code Gen Options,,Options for Code Generation Conventions, |