diff mbox

[doc] clean up -fdump-tree- options (PR 32003)

Message ID 16e16ecf-9d00-9df8-7d5f-a3a6274b6910@gmail.com
State New
Headers show

Commit Message

Martin Sebor Feb. 2, 2017, 3:26 a.m. UTC
On 02/01/2017 08:06 PM, Sandra Loosemore wrote:
> On 02/01/2017 06:57 PM, Martin Sebor wrote:
>> As discussed in bug 32003 - Undocumented -fdump-tree options, rather
>> than duplicating the same boiler-plate text for each of the dozens
>> (138 by my count) of undocumented passes, the attached patch removes
>> the pass-specific -fdump-tree- options replacing them with a list of
>> generic steps to determine the full list of such options and the names
>> of the dump files for each.
>>
>> The bug only talks about -fdump-tree- options so the attached patch
>> only tackles those and leaves the -fdump-rtl- options for another
>> time.
>
> Thanks for tackling this.  I think the patch requires another round of
> cleanup, though.

Attached is an updated version.

Martin

Comments

Sandra Loosemore Feb. 2, 2017, 5:28 a.m. UTC | #1
On 02/01/2017 08:26 PM, Martin Sebor wrote:
> On 02/01/2017 08:06 PM, Sandra Loosemore wrote:
>> On 02/01/2017 06:57 PM, Martin Sebor wrote:
>>> As discussed in bug 32003 - Undocumented -fdump-tree options, rather
>>> than duplicating the same boiler-plate text for each of the dozens
>>> (138 by my count) of undocumented passes, the attached patch removes
>>> the pass-specific -fdump-tree- options replacing them with a list of
>>> generic steps to determine the full list of such options and the names
>>> of the dump files for each.
>>>
>>> The bug only talks about -fdump-tree- options so the attached patch
>>> only tackles those and leaves the -fdump-rtl- options for another
>>> time.
>>
>> Thanks for tackling this.  I think the patch requires another round of
>> cleanup, though.
>
> Attached is an updated version.

Just a couple more small things.

> @@ -12985,9 +12965,11 @@ whole compilation unit while @samp{-details} dumps every event as
>  the passes generate them.  The default with no option is to sum
>  counters for each function compiled.
>
> +@item -fdump-tree-all
>  @item -fdump-tree-@var{switch}

You need to make this one @itemx now since you added @item just above it.

> +To enable the creation of the dump file, append the pass code to
> +the @option{-fdump-} option prefix and invoke GCC with it.  For example,
> +to enable the dump from the Early Value Range Propagation pass, invoke
> +GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
> +specify the name of the dump file.  If you don't specify one, GCC will
> +create one as described below.

s/will create one/creates one/

> @@ -15572,7 +15434,7 @@ before calling a function and popped afterwards.
>
>  Popping the arguments after the function call can be expensive on
>  AVR so that accumulating the stack space might lead to smaller
> -executables because arguments need not to be removed from the
> +executables because arguments need not be removed from the
>  stack after such a function call.
>
>  This option can lead to reduced code size for functions that perform

This change is good, but it's clearly not related to the other parts of 
the patch, and wasn't present in the previous version.  Did you intend 
to do this?  If so, please commit it separately.  (I often commit big 
patches with collected copy-edits and typo corrections, but I try to 
keep those separate from content rewrites or restructuring patches.)

The rest of the patch is OK to commit with the two nits fixed.

-Sandra
Martin Sebor Feb. 2, 2017, 6:32 p.m. UTC | #2
On 02/01/2017 10:28 PM, Sandra Loosemore wrote:
> On 02/01/2017 08:26 PM, Martin Sebor wrote:
>> On 02/01/2017 08:06 PM, Sandra Loosemore wrote:
>>> On 02/01/2017 06:57 PM, Martin Sebor wrote:
>>>> As discussed in bug 32003 - Undocumented -fdump-tree options, rather
>>>> than duplicating the same boiler-plate text for each of the dozens
>>>> (138 by my count) of undocumented passes, the attached patch removes
>>>> the pass-specific -fdump-tree- options replacing them with a list of
>>>> generic steps to determine the full list of such options and the names
>>>> of the dump files for each.
>>>>
>>>> The bug only talks about -fdump-tree- options so the attached patch
>>>> only tackles those and leaves the -fdump-rtl- options for another
>>>> time.
>>>
>>> Thanks for tackling this.  I think the patch requires another round of
>>> cleanup, though.
>>
>> Attached is an updated version.
>
> Just a couple more small things.
>
>> @@ -12985,9 +12965,11 @@ whole compilation unit while @samp{-details}
>> dumps every event as
>>  the passes generate them.  The default with no option is to sum
>>  counters for each function compiled.
>>
>> +@item -fdump-tree-all
>>  @item -fdump-tree-@var{switch}
>
> You need to make this one @itemx now since you added @item just above it.
>
>> +To enable the creation of the dump file, append the pass code to
>> +the @option{-fdump-} option prefix and invoke GCC with it.  For example,
>> +to enable the dump from the Early Value Range Propagation pass, invoke
>> +GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
>> +specify the name of the dump file.  If you don't specify one, GCC will
>> +create one as described below.
>
> s/will create one/creates one/
>
>> @@ -15572,7 +15434,7 @@ before calling a function and popped afterwards.
>>
>>  Popping the arguments after the function call can be expensive on
>>  AVR so that accumulating the stack space might lead to smaller
>> -executables because arguments need not to be removed from the
>> +executables because arguments need not be removed from the
>>  stack after such a function call.
>>
>>  This option can lead to reduced code size for functions that perform
>
> This change is good, but it's clearly not related to the other parts of
> the patch, and wasn't present in the previous version.  Did you intend
> to do this?  If so, please commit it separately.  (I often commit big
> patches with collected copy-edits and typo corrections, but I try to
> keep those separate from content rewrites or restructuring patches.)

I was prompted to make the change by your request to replace
"need not be" with "are not".  I wanted to see if there were
other uses of the former.  This one was incorrect so I fixed
it.

Martin

>
> The rest of the patch is OK to commit with the two nits fixed.
>
> -Sandra
>
Thomas Schwinge Feb. 15, 2017, 12:51 p.m. UTC | #3
Hi!

On Wed, 1 Feb 2017 20:26:24 -0700, Martin Sebor <msebor@gmail.com> wrote:
> On 02/01/2017 08:06 PM, Sandra Loosemore wrote:
> > On 02/01/2017 06:57 PM, Martin Sebor wrote:
> 	PR middle-end/32003
> 	* doc/invoke.texi (-fdump-rtl-): Remove pass-specific options from
> 	index.

"rtl" vs. "tree" typo.  ;-)

> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -544,29 +544,9 @@ Objective-C and Objective-C++ Dialects}.
>  -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
>  -fdump-statistics @gol
>  -fdump-tree-all @gol
> --fdump-tree-original@r{[}-@var{n}@r{]}  @gol
> -[...]
> --fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
> --fdump-final-insns=@var{file} @gol

Is it intentional that you've also removed "-fdump-final-insns" here?
(It remains documented further down the file.)


Grüße
 Thomas
Martin Sebor Feb. 15, 2017, 8:13 p.m. UTC | #4
On 02/15/2017 05:51 AM, Thomas Schwinge wrote:
> Hi!
>
> On Wed, 1 Feb 2017 20:26:24 -0700, Martin Sebor <msebor@gmail.com> wrote:
>> On 02/01/2017 08:06 PM, Sandra Loosemore wrote:
>>> On 02/01/2017 06:57 PM, Martin Sebor wrote:
>> 	PR middle-end/32003
>> 	* doc/invoke.texi (-fdump-rtl-): Remove pass-specific options from
>> 	index.
>
> "rtl" vs. "tree" typo.  ;-)
>
>> --- a/gcc/doc/invoke.texi
>> +++ b/gcc/doc/invoke.texi
>> @@ -544,29 +544,9 @@ Objective-C and Objective-C++ Dialects}.
>>  -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
>>  -fdump-statistics @gol
>>  -fdump-tree-all @gol
>> --fdump-tree-original@r{[}-@var{n}@r{]}  @gol
>> -[...]
>> --fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
>> --fdump-final-insns=@var{file} @gol
>
> Is it intentional that you've also removed "-fdump-final-insns" here?
> (It remains documented further down the file.)

No, I meant to only remove the -fdump-tree-xxx options in this pass.
I committed r245493 to restore it and fix the ChangeLog.  Thanks for
the review and for pointing it out!

Martin
diff mbox

Patch

PR middle-end/32003 - Undocumented -fdump-tree options

gcc/ChangeLog:

	PR middle-end/32003
	* doc/invoke.texi (-fdump-rtl-): Remove pass-specific options from
	index.
	(-fdump-tree-@var): Add to index and document how to come up
	with pass-specific option and dump file names.
	(-fdump-passes): Clarify where to look for output.

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 4b13aeb..73732d0 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -544,29 +544,9 @@  Objective-C and Objective-C++ Dialects}.
 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
 -fdump-statistics @gol
 -fdump-tree-all @gol
--fdump-tree-original@r{[}-@var{n}@r{]}  @gol
--fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
--fdump-tree-cfg  -fdump-tree-alias @gol
--fdump-tree-ch @gol
--fdump-tree-ssa@r{[}-@var{n}@r{]}  -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
--fdump-tree-ccp@r{[}-@var{n}@r{]}  -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
--fdump-tree-gimple@r{[}-raw@r{]} @gol
--fdump-tree-dom@r{[}-@var{n}@r{]} @gol
--fdump-tree-dse@r{[}-@var{n}@r{]} @gol
--fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
--fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
--fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
--fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
--fdump-tree-nrv  -fdump-tree-vect @gol
--fdump-tree-sink @gol
--fdump-tree-sra@r{[}-@var{n}@r{]} @gol
--fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
--fdump-tree-fre@r{[}-@var{n}@r{]} @gol
--fdump-tree-vtable-verify @gol
--fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
--fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
--fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
--fdump-final-insns=@var{file} @gol
+-fdump-tree-@var{switch} @gol
+-fdump-tree-@var{switch}-@var{options} @gol
+-fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
 -fenable-@var{kind}-@var{pass} @gol
 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
@@ -12971,8 +12951,8 @@  Dump after function inlining.
 
 @item -fdump-passes
 @opindex fdump-passes
-Dump the list of optimization passes that are turned on and off by
-the current command-line options.
+Print on @file{stderr} the list of optimization passes that are turned
+on and off by the current command-line options.
 
 @item -fdump-statistics-@var{option}
 @opindex fdump-statistics
@@ -12985,9 +12965,11 @@  whole compilation unit while @samp{-details} dumps every event as
 the passes generate them.  The default with no option is to sum
 counters for each function compiled.
 
+@item -fdump-tree-all
 @item -fdump-tree-@var{switch}
 @itemx -fdump-tree-@var{switch}-@var{options}
 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
+@opindex fdump-tree-all
 @opindex fdump-tree
 Control the dumping at various stages of processing the intermediate
 language tree to a file.  The file name is generated by appending a
@@ -13069,7 +13051,7 @@  example,
 
 @smallexample
 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
-     -fdump-tree-pre=stderr file.c
+     -fdump-tree-pre=/dev/stderr file.c
 @end smallexample
 
 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
@@ -13077,11 +13059,6 @@  output on to @file{stderr}. If two conflicting dump filenames are
 given for the same pass, then the latter option overrides the earlier
 one.
 
-@item split-paths
-@opindex fdump-tree-split-paths
-Dump each function after splitting paths to loop backedges.  The file
-name is made by appending @file{.split-paths} to the source file name.
-
 @item all
 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
 and @option{lineno}.
@@ -13091,148 +13068,33 @@  Turn on all optimization options, i.e., @option{optimized},
 @option{missed}, and @option{note}.
 @end table
 
-The following tree dumps are possible:
-@table @samp
-
-@item original
-@opindex fdump-tree-original
-Dump before any tree based optimization, to @file{@var{file}.original}.
-
-@item optimized
-@opindex fdump-tree-optimized
-Dump after all tree based optimization, to @file{@var{file}.optimized}.
-
-@item gimple
-@opindex fdump-tree-gimple
-Dump each function before and after the gimplification pass to a file.  The
-file name is made by appending @file{.gimple} to the source file name.
-
-@item cfg
-@opindex fdump-tree-cfg
-Dump the control flow graph of each function to a file.  The file name is
-made by appending @file{.cfg} to the source file name.
-
-@item ch
-@opindex fdump-tree-ch
-Dump each function after copying loop headers.  The file name is made by
-appending @file{.ch} to the source file name.
-
-@item ssa
-@opindex fdump-tree-ssa
-Dump SSA related information to a file.  The file name is made by appending
-@file{.ssa} to the source file name.
-
-@item alias
-@opindex fdump-tree-alias
-Dump aliasing information for each function.  The file name is made by
-appending @file{.alias} to the source file name.
-
-@item ccp
-@opindex fdump-tree-ccp
-Dump each function after CCP@.  The file name is made by appending
-@file{.ccp} to the source file name.
-
-@item storeccp
-@opindex fdump-tree-storeccp
-Dump each function after STORE-CCP@.  The file name is made by appending
-@file{.storeccp} to the source file name.
-
-@item pre
-@opindex fdump-tree-pre
-Dump trees after partial redundancy elimination and/or code hoisting.
-The file name is made by appending @file{.pre} to the source file name.
-
-@item fre
-@opindex fdump-tree-fre
-Dump trees after full redundancy elimination.  The file name is made
-by appending @file{.fre} to the source file name.
-
-@item copyprop
-@opindex fdump-tree-copyprop
-Dump trees after copy propagation.  The file name is made
-by appending @file{.copyprop} to the source file name.
-
-@item store_copyprop
-@opindex fdump-tree-store_copyprop
-Dump trees after store copy-propagation.  The file name is made
-by appending @file{.store_copyprop} to the source file name.
-
-@item dce
-@opindex fdump-tree-dce
-Dump each function after dead code elimination.  The file name is made by
-appending @file{.dce} to the source file name.
-
-@item sra
-@opindex fdump-tree-sra
-Dump each function after performing scalar replacement of aggregates.  The
-file name is made by appending @file{.sra} to the source file name.
-
-@item sink
-@opindex fdump-tree-sink
-Dump each function after performing code sinking.  The file name is made
-by appending @file{.sink} to the source file name.
-
-@item dom
-@opindex fdump-tree-dom
-Dump each function after applying dominator tree optimizations.  The file
-name is made by appending @file{.dom} to the source file name.
-
-@item dse
-@opindex fdump-tree-dse
-Dump each function after applying dead store elimination.  The file
-name is made by appending @file{.dse} to the source file name.
-
-@item phiopt
-@opindex fdump-tree-phiopt
-Dump each function after optimizing PHI nodes into straightline code.  The file
-name is made by appending @file{.phiopt} to the source file name.
-
-@item backprop
-@opindex fdump-tree-backprop
-Dump each function after back-propagating use information up the definition
-chain.  The file name is made by appending @file{.backprop} to the
-source file name.
-
-@item forwprop
-@opindex fdump-tree-forwprop
-Dump each function after forward propagating single use variables.  The file
-name is made by appending @file{.forwprop} to the source file name.
-
-@item nrv
-@opindex fdump-tree-nrv
-Dump each function after applying the named return value optimization on
-generic trees.  The file name is made by appending @file{.nrv} to the source
-file name.
-
-@item vect
-@opindex fdump-tree-vect
-Dump each function after applying vectorization of loops.  The file name is
-made by appending @file{.vect} to the source file name.
-
-@item slp
-@opindex fdump-tree-slp
-Dump each function after applying vectorization of basic blocks.  The file name
-is made by appending @file{.slp} to the source file name.
-
-@item vrp
-@opindex fdump-tree-vrp
-Dump each function after Value Range Propagation (VRP).  The file name
-is made by appending @file{.vrp} to the source file name.
+To determine what tree dumps are available or find the dump for a pass
+of interest follow the steps below.
 
-@item early vrp
-@opindex fdump-tree-evrp
-Dump each function after Early Value Range Propagation (EVRP).  The file name
-is made by appending @file{.evrp} to the source file name.
-
-@item oaccdevlow
-@opindex fdump-tree-oaccdevlow
-Dump each function after applying device-specific OpenACC transformations.
-The file name is made by appending @file{.oaccdevlow} to the source file name.
-
-@item all
-@opindex fdump-tree-all
-Enable all the available tree dumps with the flags provided in this option.
-@end table
+@enumerate
+@item
+Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
+look for a code that corresponds to the pass you are interested in.
+For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
+@code{tree-vrp2} correspond to the three Value Range Propagation passes.
+The number at the end distinguishes distinct invocations of the same pass.
+@item
+To enable the creation of the dump file, append the pass code to
+the @option{-fdump-} option prefix and invoke GCC with it.  For example,
+to enable the dump from the Early Value Range Propagation pass, invoke
+GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
+specify the name of the dump file.  If you don't specify one, GCC will
+create one as described below.
+@item
+Find the pass dump in a file whose name is composed of three components
+separated by a period: the name of the source file GCC was invoked to
+compile, a numeric suffix indicating the pass number followed by the
+letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
+and finally the pass code.  For example, the Early VRP pass dump might
+be in a file named @file{myfile.c.038t.evrp} in the current working
+directory.  Note that the numeric codes are not stable and may change
+from one version of GCC to another.
+@end enumerate
 
 @item -fopt-info
 @itemx -fopt-info-@var{options}
@@ -15572,7 +15434,7 @@  before calling a function and popped afterwards.
 
 Popping the arguments after the function call can be expensive on
 AVR so that accumulating the stack space might lead to smaller
-executables because arguments need not to be removed from the
+executables because arguments need not be removed from the
 stack after such a function call.
 
 This option can lead to reduced code size for functions that perform