From patchwork Sat Oct 30 13:25:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 69654 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8865FB70A8 for ; Sun, 31 Oct 2010 00:25:32 +1100 (EST) Received: (qmail 25574 invoked by alias); 30 Oct 2010 13:25:29 -0000 Received: (qmail 25547 invoked by uid 22791); 30 Oct 2010 13:25:26 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp6.netcologne.de (HELO smtp6.netcologne.de) (194.8.194.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 30 Oct 2010 13:25:19 +0000 Received: from [192.168.0.197] (xdsl-84-44-254-143.netcologne.de [84.44.254.143]) by smtp6.netcologne.de (Postfix) with ESMTP id 9FF022A1035; Sat, 30 Oct 2010 15:25:16 +0200 (CEST) Subject: Re: [patch, fortran] Introducing -fdump-optimized-tree From: Thomas Koenig To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org In-Reply-To: <4CC7DC49.5000404@net-b.de> References: <1287956428.26284.8.camel@linux-fd1f.site> <1288068211.3604.1.camel@linux-fd1f.site> <4CC7DC49.5000404@net-b.de> Date: Sat, 30 Oct 2010 15:25:16 +0200 Message-ID: <1288445116.3588.5.camel@linux-fd1f.site> Mime-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org [Sorry if anybody sees this twice...] Hi Tobias, > >> fdump-fortran-xxx? Or perhaps have an umbrella fdump=... > > fdump-fortran-original and fdump-fortran-optimized sounds good to me. > > Looks also fine to me. 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 * 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: gfortran.h =================================================================== --- gfortran.h (Revision 166074) +++ gfortran.h (Arbeitskopie) @@ -2178,7 +2178,8 @@ typedef struct int max_continue_fixed; int max_continue_free; int max_identifier_length; - int dump_parse_tree; + int dump_fortran_original; + int dump_fortran_optimized; int warn_aliasing; int warn_ampersand; Index: lang.opt =================================================================== --- lang.opt (Revision 166074) +++ lang.opt (Arbeitskopie) @@ -358,10 +358,18 @@ fdump-core Fortran Dump a core file when a runtime error occurs -fdump-parse-tree +fdump-fortran-original Fortran Display the code tree after parsing +fdump-fortran-optimized +Fortran +Display the code tree after front end optimization + +fdump-parse-tree +Fortran +Display the code tree after parsing; deprecated option + fexternal-blas Fortran Specify that an external BLAS library should be used for matmul calls on large-size arrays 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. + +@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} Index: frontend-passes.c =================================================================== --- frontend-passes.c (Revision 166074) +++ frontend-passes.c (Arbeitskopie) @@ -42,7 +42,11 @@ void gfc_run_passes (gfc_namespace *ns) { if (optimize) - optimize_namespace (ns); + { + optimize_namespace (ns); + if (gfc_option.dump_fortran_optimized) + gfc_dump_parse_tree (ns, stdout); + } } /* Callback for each gfc_code node invoked through gfc_code_walker Index: parse.c =================================================================== --- parse.c (Revision 166074) +++ parse.c (Arbeitskopie) @@ -4373,7 +4373,7 @@ loop: gfc_resolve (gfc_current_ns); /* Dump the parse tree if requested. */ - if (gfc_option.dump_parse_tree) + if (gfc_option.dump_fortran_original) gfc_dump_parse_tree (gfc_current_ns, stdout); gfc_get_errors (NULL, &errors); @@ -4431,7 +4431,7 @@ prog_units: /* Do the parse tree dump. */ gfc_current_ns - = gfc_option.dump_parse_tree ? gfc_global_ns_list : NULL; + = gfc_option.dump_fortran_original ? gfc_global_ns_list : NULL; for (; gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling) { Index: options.c =================================================================== --- options.c (Revision 166074) +++ options.c (Arbeitskopie) @@ -90,7 +90,8 @@ gfc_init_options (unsigned int decoded_options_cou gfc_option.flag_max_array_constructor = 65535; gfc_option.convert = GFC_CONVERT_NATIVE; gfc_option.record_marker = 0; - gfc_option.dump_parse_tree = 0; + gfc_option.dump_fortran_original = 0; + gfc_option.dump_fortran_optimized = 0; gfc_option.warn_aliasing = 0; gfc_option.warn_ampersand = 0; @@ -270,7 +271,7 @@ gfc_post_options (const char **pfilename) gfc_option.rtcheck |= GFC_RTCHECK_BOUNDS; if (flag_compare_debug) - gfc_option.dump_parse_tree = 0; + gfc_option.dump_fortran_original = 0; /* Verify the input file name. */ if (!filename || strcmp (filename, "-") == 0) @@ -686,10 +687,15 @@ gfc_handle_option (size_t scode, const char *arg, gfc_option.flag_d_lines = 0; break; + case OPT_fdump_fortran_original: case OPT_fdump_parse_tree: - gfc_option.dump_parse_tree = value; + gfc_option.dump_fortran_original = value; break; + case OPT_fdump_fortran_optimized: + gfc_option.dump_fortran_optimized = value; + break; + case OPT_ffixed_form: gfc_option.source_form = FORM_FIXED; break;