This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch, fortran] Introducing -fdump-optimized-tree
On Saturday 30 October 2010 15:25:16 Thomas Koenig wrote:
> Here's a patch which implements these options. Regression-tested,
> also tested with "make info", "make dvi" and "make pdf".
>
> OK for trunk?
>
> 2010-10-30 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> * gfortran.h (gfc_option_t): Replace dump_parse_tree by
> dump_fortran_original and add dump_fortran_optimized.
> * lang.opt: Add fdump-fortran-original and
> fdump-fortran-optimized. Document that fdump-parse-tree is
> deprecated.
> * gfortran.texi: Add -fdump-fortran-original and
> -fdump-fortran-optimized. -fdump-parse-tree is deprecated.
> * frontend-passes.c (gfc_run_passes): If optimizing and
> if gfc_option.dump_fortran_optimized is set, dump the parse tree
> after optimization.
> * parse.c: Rename gfc_option.dump_parse_tree to
> gfc_option.dump_fortran_original.
> * options.c (gfc_init_options): Rename gfc_option.dump_parse_tree
> to gfc_option.dump_fortran_original and handle
> gfc_option.dump_fortran_optimize.
> (gfc_post_options): Rename gfc_option.dump_parse_tree
> to gfc_option.dump_fortran_original.
> (gfc_handle_option): Rename OPT_fdump_parse_tree to
> OPT_fdump_fortran_original and gfc_option.dump_parse_tree
> to gfc_option.dump_fortran_original. Handle
> OPT_fdump_fortran_optimized.
>
> > > Should we keep fdump-parse-tree around as an alias for 4.6, then remove
> > > it for 4.7?
> >
> > Well, in principle one should really avoid removing flags; thus, we can
> > deprecate it, but I am not sure that we should already remove it in 4.7.
> > (On the other hand, -fdump-parse-tree is presumably extremely rarely
> > used by users and also I hardly every use it - thus, it does not matter
> > as much as removing -fbounds-check in favour of -fcheck=bounds would do.)
>
> I think we can defer that decision until 4.7.
>
> Thomas
> Index: invoke.texi
> ===================================================================
> --- invoke.texi (Revision 166074)
> +++ invoke.texi (Arbeitskopie)
> @@ -143,8 +143,8 @@ and warnings}.
>
> @item Debugging Options
> @xref{Debugging Options,,Options for debugging your program or GNU
Fortran}.
> -@gccoptlist{-fdump-parse-tree -ffpe-trap=@var{list} @gol
> --fdump-core -fbacktrace}
> +@gccoptlist{-fdump-fortran-original -fdump-fortran-optimized @gol
> +-ffpe-trap=@var{list} -fdump-core -fbacktrace -fdump-parse-tree}
>
> @item Directory Options
> @xref{Directory Options,,Options for directory search}.
> @@ -879,10 +879,23 @@ GNU Fortran has various special options that are u
> either your program or the GNU Fortran compiler.
>
> @table @gcctabopt
> -@item -fdump-parse-tree
> +@item -fdump-fortran-original
> +@opindex @code{fdump-fortran-original}
> +Output the internal parse tree after translating the source program
> +into internal representation. Only really useful for debugging the
> +GNU Fortran compiler itself. This option is deprecated; use
> +@code{-fdump-fortran-original} instead.
maximum recursion depth exceeded ;-)
Also, I would prefer "Output the internal parse tree _after parsing the source
program_." as the internal representation seems ambiguous to me (front-end vs
middle-end representation). Actually, I don't like my sentence either ("parse
tree after parsing" isn't very nice). Oh well...
> +
> +@item -fdump-optimized-tree
> +@opindex @code{fdump-fortran-optimized}
> +Output the parse tree after front-end optimization. Only really
> +useful for debugging the GNU Fortran compiler itself.
> +
> @opindex @code{fdump-parse-tree}
> -Output the internal parse tree before starting code generation. Only
> -really useful for debugging the GNU Fortran compiler itself.
> +Output the internal parse tree after translating the source program
> +into internal representation. Only really useful for debugging the
> +GNU Fortran compiler itself. This option is deprecated; use
> +@code{-fdump-fortran-original} instead.
>
> @item -ffpe-trap=@var{list}
> @opindex @code{ffpe-trap=}@var{list}
OK with the documentation fixed.
Thanks
Mikael