From patchwork Sun Oct 24 21:40:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 69055 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 9B17DB70A5 for ; Mon, 25 Oct 2010 08:40:45 +1100 (EST) Received: (qmail 31008 invoked by alias); 24 Oct 2010 21:40:42 -0000 Received: (qmail 30992 invoked by uid 22791); 24 Oct 2010 21:40:41 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp5.netcologne.de (HELO smtp5.netcologne.de) (194.8.194.25) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 24 Oct 2010 21:40:34 +0000 Received: from [192.168.0.197] (xdsl-87-79-178-28.netcologne.de [87.79.178.28]) by smtp5.netcologne.de (Postfix) with ESMTP id D94C440D868; Sun, 24 Oct 2010 23:40:28 +0200 (CEST) Subject: [patch, fortran] Introducing -fdump-optimized-tree From: Thomas Koenig To: fortran@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org Date: Sun, 24 Oct 2010 23:40:28 +0200 Message-ID: <1287956428.26284.8.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 Hello world, here's a patch for dumping the optimized tree after front-end optimization. Regression-tested (not that I expected to find anything there...). Tested with 'make dvi' and 'make info'. OK for trunk? Thomas 2010-10-24 Thomas Koenig * gfortran.h (gfc_option_t): Add dump_optimized_tree. * lang.opt: Add fdump-optimized-tree. * gfortran.texi: Adjust description of fdump-parse-tree to the presence of fdump-optimized-tree. Add description of fdump-optimized-tree. * frontend-passes.c (gfc_run_passes): If optimizing and if fdump-optimized-tree is set, dump the parse tree after optimization. * options.c (gfc_init_options): Initialize dump_optimized_tree. (gfc_handle_option): Handle dump_optimized_tree. Index: gfortran.h =================================================================== --- gfortran.h (Revision 165903) +++ gfortran.h (Arbeitskopie) @@ -2179,6 +2179,7 @@ typedef struct int max_continue_free; int max_identifier_length; int dump_parse_tree; + int dump_optimized_tree; int warn_aliasing; int warn_ampersand; Index: lang.opt =================================================================== --- lang.opt (Revision 165903) +++ lang.opt (Arbeitskopie) @@ -362,6 +362,10 @@ fdump-parse-tree Fortran Display the code tree after parsing +fdump-optimized-tree +Fortran +Display the code tree after front end optimization + 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 165903) +++ 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-parse-tree -fdump-optimized-tree @gol +-ffpe-trap=@var{list} -fdump-core -fbacktrace} @item Directory Options @xref{Directory Options,,Options for directory search}. @@ -881,9 +881,15 @@ either your program or the GNU Fortran compiler. @table @gcctabopt @item -fdump-parse-tree @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. +@item -fdump-optimized-tree +@opindex @code{fdump-optimized-tree} +Output the parse tree after front-end optimization. Only really +useful for debugging the GNU Fortran compiler itself. + @item -ffpe-trap=@var{list} @opindex @code{ffpe-trap=}@var{list} Specify a list of IEEE exceptions when a Floating Point Exception Index: frontend-passes.c =================================================================== --- frontend-passes.c (Revision 165903) +++ 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_optimized_tree) + gfc_dump_parse_tree (ns, stdout); + } } /* Callback for each gfc_code node invoked through gfc_code_walker Index: options.c =================================================================== --- options.c (Revision 165903) +++ options.c (Arbeitskopie) @@ -91,6 +91,7 @@ gfc_init_options (unsigned int decoded_options_cou gfc_option.convert = GFC_CONVERT_NATIVE; gfc_option.record_marker = 0; gfc_option.dump_parse_tree = 0; + gfc_option.dump_optimized_tree = 0; gfc_option.warn_aliasing = 0; gfc_option.warn_ampersand = 0; @@ -690,6 +691,10 @@ gfc_handle_option (size_t scode, const char *arg, gfc_option.dump_parse_tree = value; break; + case OPT_fdump_optimized_tree: + gfc_option.dump_optimized_tree = value; + break; + case OPT_ffixed_form: gfc_option.source_form = FORM_FIXED; break;