Movatterモバイル変換


[0]ホーム

URL:


Next:, Previous:, Up:GCC Command Options   [Contents][Index]


3.20 GCC Developer Options

This section describes command-line options that are primarily ofinterest to GCC developers, including options to support compilertesting and investigation of compiler bugs and compile-timeperformance problems. This includes options that produce debug dumpsat various points in the compilation; that print statistics such asmemory use and execution time; and that print information about GCC’sconfiguration, such as where it searches for libraries. You shouldrarely need to use any of these options for ordinary compilation andlinking tasks.

Many developer options that cause GCC to dump output to a file take anoptional ‘=filename’ suffix. You can specify ‘stdout’or ‘-’ to dump to standard output, and ‘stderr’ for standarderror.

If ‘=filename’ is omitted, a default dump file name isconstructed by concatenating the base dump file name, a pass number,phase letter, and pass name. The base dump file name is the name ofoutput file produced by the compiler if explicitly specified and notan executable; otherwise it is the source file name.The pass number is determined by the order passes are registered withthe compiler’s pass manager.This is generally the same as the order of execution, but passesregistered by plugins, target-specific passes, or passes that areotherwise registered late are numbered higher than the pass named‘final’, even if they are executed earlier. The phase letter isone of ‘i’ (inter-procedural analysis), ‘l’(language-specific), ‘r’ (RTL), or ‘t’ (tree).The files are created in the directory of the output file.

-fcallgraph-info
-fcallgraph-info=MARKERS

Makes the compiler output callgraph information for the program, on aper-object-file basis. The information is generated in the common VCGformat. It can be decorated with additional, per-node and/or per-edgeinformation, if a list of comma-separated markers is additionallyspecified. When thesu marker is specified, the callgraph isdecorated with stack usage information; it is equivalent to-fstack-usage. When theda marker is specified, thecallgraph is decorated with information about dynamically allocatedobjects.

When compiling with-flto, no callgraph information is outputalong with the object file. At LTO link time,-fcallgraph-infomay generate multiple callgraph information files next to intermediateLTO output files.

-dletters
--dump=letters
--dumpletters
-fdump-rtl-pass
-fdump-rtl-pass-options
-fdump-rtl-pass-options=filename

Says to make debugging dumps during compilation at times specified byletters when using-d or bypass when using-fdump-rtl. This is used for debugging the RTL-based passes of thecompiler.

Some-dletters switches have different meaning when-E is used for preprocessing. SeeOptions Controlling the Preprocessor,for information about preprocessor-specific dump options.

The ‘-options’ form allows greater control over the details of thedump. See-fdump-tree.

Here are actual instances of command-line options following these patterns andtheir meanings:

-fdump-rtl-alignments

Dump after branch alignments have been computed.

-fdump-rtl-asmcons

Dump after fixing rtl statements that have unsatisfied in/out constraints.

-fdump-rtl-auto_inc_dec

Dump after auto-inc-dec discovery. This pass is only run onarchitectures that have auto inc or auto dec instructions.

-fdump-rtl-barriers

Dump after cleaning up the barrier instructions.

-fdump-rtl-bbpart

Dump after partitioning hot and cold basic blocks.

-fdump-rtl-bbro

Dump after block reordering.

-fdump-rtl-btl1
-fdump-rtl-btl2

-fdump-rtl-btl1 and-fdump-rtl-btl2 enable dumpingafter the two branchtarget load optimization passes.

-fdump-rtl-bypass

Dump after jump bypassing and control flow optimizations.

-fdump-rtl-combine

Dump after the RTL instruction combination pass.

-fdump-rtl-compgotos

Dump after duplicating the computed gotos.

-fdump-rtl-ce1
-fdump-rtl-ce2
-fdump-rtl-ce3

-fdump-rtl-ce1,-fdump-rtl-ce2, and-fdump-rtl-ce3 enable dumping after the threeif conversion passes.

-fdump-rtl-cprop_hardreg

Dump after hard register copy propagation.

-fdump-rtl-csa

Dump after combining stack adjustments.

-fdump-rtl-cse1
-fdump-rtl-cse2

-fdump-rtl-cse1 and-fdump-rtl-cse2 enable dumping afterthe two common subexpression elimination passes.

-fdump-rtl-dce

Dump after the standalone dead code elimination passes.

-fdump-rtl-dbr

Dump after delayed branch scheduling.

-fdump-rtl-dce1
-fdump-rtl-dce2

-fdump-rtl-dce1 and-fdump-rtl-dce2 enable dumping afterthe two dead store elimination passes.

-fdump-rtl-eh

Dump after finalization of EH handling code.

-fdump-rtl-eh_ranges

Dump after conversion of EH handling range regions.

-fdump-rtl-expand

Dump after RTL generation.

-fdump-rtl-fwprop1
-fdump-rtl-fwprop2

-fdump-rtl-fwprop1 and-fdump-rtl-fwprop2 enabledumping after the two forward propagation passes.

-fdump-rtl-gcse1
-fdump-rtl-gcse2

-fdump-rtl-gcse1 and-fdump-rtl-gcse2 enable dumpingafter global common subexpression elimination.

-fdump-rtl-init-regs

Dump after the initialization of the registers.

-fdump-rtl-initvals

Dump after the computation of the initial value sets.

-fdump-rtl-into_cfglayout

Dump after converting to cfglayout mode.

-fdump-rtl-ira

Dump after iterated register allocation.

-fdump-rtl-jump

Dump after the second jump optimization.

-fdump-rtl-loop2

-fdump-rtl-loop2 enables dumping after the rtlloop optimization passes.

-fdump-rtl-mach

Dump after performing the machine dependent reorganization pass, if thatpass exists.

-fdump-rtl-mode_sw

Dump after removing redundant mode switches.

-fdump-rtl-rnreg

Dump after register renumbering.

-fdump-rtl-outof_cfglayout

Dump after converting from cfglayout mode.

-fdump-rtl-peephole2

Dump after the peephole pass.

-fdump-rtl-postreload

Dump after post-reload optimizations.

-fdump-rtl-pro_and_epilogue

Dump after generating the function prologues and epilogues.

-fdump-rtl-sched1
-fdump-rtl-sched2

-fdump-rtl-sched1 and-fdump-rtl-sched2 enable dumpingafter the basic block scheduling passes.

-fdump-rtl-ree

Dump after sign/zero extension elimination.

-fdump-rtl-seqabstr

Dump after common sequence discovery.

-fdump-rtl-shorten

Dump after shortening branches.

-fdump-rtl-split1
-fdump-rtl-split2
-fdump-rtl-split3
-fdump-rtl-split4
-fdump-rtl-split5

These options enable dumping after five rounds ofinstruction splitting.

-fdump-rtl-sms

Dump after modulo scheduling. This pass is only run on somearchitectures.

-fdump-rtl-stack

Dump after conversion from GCC’s “flat register file” registers to thex87’s stack-like registers. This pass is only run on x86 variants.

-fdump-rtl-subreg1
-fdump-rtl-subreg2

-fdump-rtl-subreg1 and-fdump-rtl-subreg2 enable dumping afterthe two subreg expansion passes.

-fdump-rtl-vartrack

Dump after variable tracking.

-fdump-rtl-vregs

Dump after converting virtual registers to hard registers.

-fdump-rtl-web

Dump after live range splitting.

-fdump-rtl-regclass
-fdump-rtl-subregs_of_mode_init
-fdump-rtl-subregs_of_mode_finish
-fdump-rtl-dfinit
-fdump-rtl-dfinish

These dumps are defined but always produce empty files.

-da
--dump=a
-fdump-rtl-all

Produce all the dumps listed above.

-dA
--dump=A

Annotate the assembler output with miscellaneous debugging information.

-dD
--dump=D

Dump all macro definitions, at the end of preprocessing, in addition tonormal output.

-dH
--dump=H

Produce a core dump whenever an error occurs.

-dp
--dump=p

Annotate the assembler output with a comment indicating whichpattern and alternative is used. The length and cost of each instruction arealso printed.

-dP
--dump=P

Dump the RTL in the assembler output as a comment before each instruction.Also turns on-dp annotation.

-dx
--dump=x

Just generate RTL for a function instead of compiling it. Usually usedwith-fdump-rtl-expand.

-fdump-debug

Dump debugging information generated during the debuggeneration phase.

-fdump-earlydebug

Dump debugging information generated during the early debuggeneration phase.

-fdump-noaddr

When doing debugging dumps, suppress address output. This makes it morefeasible to use diff on debugging dumps for compiler invocations withdifferent compiler binaries and/or differenttext / bss / data / heap / stack / dso start locations.

-freport-bug

Collect and dump debug information into a temporary file if aninternal compiler error (ICE) occurs.

-fdump-unnumbered

When doing debugging dumps, suppress instruction numbers and address output.This makes it more feasible to use diff on debugging dumps for compilerinvocations with different options, in particular with and without-g.

-fdump-unnumbered-links

When doing debugging dumps (see-d option above), suppressinstruction numbers for the links to the previous and next instructionsin a sequence.

-fdump-internal-locations

Dump detailed information about GCC’s internal representation of source codelocations.

-fdump-ipa-switch
-fdump-ipa-switch-options

Control the dumping at various stages of inter-procedural analysislanguage tree to a file. The file name is generated by appending aswitch specific suffix to the source file name, and the file is createdin the same directory as the output file. The following dumps arepossible:

all

Enables all inter-procedural analysis dumps.

cgraph

Dumps information about call-graph optimization, unused function removal,and inlining decisions.

inline

Dump after function inlining.

strubm

Dump after selectingstrub modes, and recording the selections asfunction attributes.

strub

Dumpstrub transformations: interface changes, function wrapping,and insertion of builtin calls for stack scrubbing and watermarking.

Additionally, the options-optimized,-missed,-note, and-all can be provided, with the same meaningas for-fopt-info, defaulting to-optimized.

For example,-fdump-ipa-inline-optimized-missed will emitinformation on callsites that were inlined, along with callsitesthat were not inlined.

By default, the dump will contain messages about successfuloptimizations (equivalent to-optimized) together withlow-level details about the analysis.

-fdump-ipa-clones

Create a dump file containing information about creation of call graphnode clones and removals of call graph nodes during inter-proceduraloptimizations and transformations. Its main intended use is that toolsthat create live-patches can determine the set of functions that need tobe live-patched to completely replace a particular function (see-flive-patching). The file name is generated by appendingsuffixipa-clones to the source file name, and the file iscreated in the same directory as the output file. Each entry in thefile is on a separate line containing semicolon separated fields.

In the case of call graph clone creation, the individual fields are:

  1. StringCallgraph clone.
  2. Name of the function being cloned as it is presented to the assembler.
  3. A number that uniquely represents the function being cloned in the callgraph. Note that the number is unique only within a compilation unit orwithin whole-program analysis but is likely to be different in the twophases.
  4. The file name of the source file where the function is defined.
  5. The line on which the function definition is located.
  6. The column where the function definition is located.
  7. Name of the new function clone as it is presented to the assembler.
  8. A number that uniquely represents the new function clone in the callgraph. Note that the number is unique only within a compilation unit orwithin whole-program analysis but is likely to be different in the twophases.
  9. The file name of the source file where the source code location of thenew clone points to.
  10. The line to which the source code location of the new clone points to.
  11. The column to which the source code location of the new clone points to.
  12. A string that determines the reason for cloning.

In the case of call graph clone removal, the individual fields are:

  1. StringCallgraph removal.
  2. Name of the function being removed as it would be presented to the assembler.
  3. A number that uniquely represents the function being cloned in the callgraph. Note that the number is unique only within a compilation unit orwithin whole-program analysis but is likely to be different in the twophases.
  4. The file name of the source file where the function is defined.
  5. The line on which the function definition is located.
  6. The column where the function definition is located.
-fdump-lang

Dump language-specific information. The file name is made by appending.lang to the source file name.

-fdump-lang-all
-fdump-lang-switch
-fdump-lang-switch-options
-fdump-lang-switch-options=filename

Control the dumping of language-specific information. Theoptionsandfilename portions behave as described in the-fdump-tree option.-fdump-tree-all enables alllanguage-specific dumps; other options vary with the language. Forinstance, see SeeOptions Controlling C++ Dialect for the-fdump-langflags supported by the C++ front-end.

-fdump-passes

Print onstderr the list of optimization passes that are turnedon and off by the current command-line options.

-fdump-statistics-option

Enable and control dumping of pass statistics in a separate file. Thefile name is generated by appending a suffix ending in‘.statistics’ to the source file name, and the file is created inthe same directory as the output file. If the ‘-option’form is used, ‘-stats’ causes counters to be summed over thewhole compilation unit while ‘-details’ dumps every event asthe passes generate them. The default with no option is to sumcounters for each function compiled.

-fdump-tree-all
-fdump-tree-switch
-fdump-tree-switch-options
-fdump-tree-switch-options=filename

Control the dumping at various stages of processing the intermediatelanguage tree to a file. If the ‘-options’form is used,options is a list of ‘-’ separated optionswhich control the details of the dump. Not all options are applicableto all dumps; those that are not meaningful are ignored. Thefollowing options are available

address

Print the address of each node. Usually this is not meaningful as itchanges according to the environment and source file. Its primary useis for tying up a dump file with a debug environment.

asmname

IfDECL_ASSEMBLER_NAME has been set for a given decl, use thatin the dump instead ofDECL_NAME. Its primary use is ease ofuse working backward from mangled names in the assembly file.

slim

When dumping front-end intermediate representations, inhibit dumpingof members of a scope or body of a function merely because that scopehas been reached. Only dump such items when they are directly reachableby some other path.

When dumping pretty-printed trees, this option inhibits dumping thebodies of control structures.

When dumping RTL, print the RTL in slim (condensed) form instead ofthe default LISP-like representation.

raw

Print a raw representation of the tree. By default, trees arepretty-printed into a C-like representation.

details

Enable more detailed dumps (not honored by every dump option). Alsoinclude information from the optimization passes.

stats

Enable dumping various statistics about the pass (not honored by every dumpoption).

blocks

Enable showing basic block boundaries (disabled in raw dumps).

graph

For each of the other indicated dump files (-fdump-rtl-pass),dump a representation of the control flow graph suitable for viewing withGraphViz tofile.passid.pass.dot. Each function inthe file is pretty-printed as a subgraph, so that GraphViz can render themall in a single plot.

RTL is always dumped in slim form.

vops

Enable showing virtual operands for every statement.

lineno

Enable showing line numbers for statements.

uid

Enable showing the unique ID (DECL_UID) for each variable.

verbose

Enable showing the tree dump for each statement.

eh

Enable showing the EH region number holding each statement.

scev

Enable showing scalar evolution analysis details.

optimized

Enable showing optimization information (only available in certainpasses).

missed

Enable showing missed optimization information (only available in certainpasses).

note

Enable other detailed optimization information (only available incertain passes).

folding

Enable dumping information about match-and-simplify (match.pd) patterns,when they are applied.

all

Turn on all options, exceptraw,slim,verboseandlineno.

optall

Turn on all optimization options, i.e.,optimized,missed, andnote.

To determine what tree dumps are available or find the dump for a passof interest follow the steps below.

  1. Invoke GCC with-fdump-passes and in thestderr outputlook for a code that corresponds to the pass you are interested in.For example, the codestree-evrp,tree-vrp1, andtree-vrp2 correspond to the three Value Range Propagation passes.The number at the end distinguishes distinct invocations of the same pass.
  2. To enable the creation of the dump file, append the pass code tothe-fdump- option prefix and invoke GCC with it. For example,to enable the dump from the Early Value Range Propagation pass, invokeGCC with the-fdump-tree-evrp option. Optionally, you mayspecify the name of the dump file. If you don’t specify one, GCCcreates as described below.
  3. Find the pass dump in a file whose name is composed of three componentsseparated by a period: the name of the source file GCC was invoked tocompile, a numeric suffix indicating the pass number followed by theletter ‘t’ for tree passes (and the letter ‘r’ for RTL passes),and finally the pass code. For example, the Early VRP pass dump mightbe in a file namedmyfile.c.038t.evrp in the current workingdirectory. Note that the numeric codes are not stable and may changefrom one version of GCC to another.
-fopt-info
-fopt-info-options
-fopt-info-options=filename

Controls optimization dumps from various optimization passes. If the‘-options’ form is used,options is a list of‘-’ separated option keywords to select the dump details andoptimizations.

Theoptions can be divided into three groups:

  1. options describing what kinds of messages should be emitted,
  2. options describing the verbosity of the dump, and
  3. options describing which optimizations should be included.

The options from each group can be freely mixed as they arenon-overlapping. However, in case of any conflicts,the later options override the earlier options on the commandline.

The following options control which kinds of messages should be emitted:

optimized

Print information when an optimization is successfully applied. It isup to a pass to decide which information is relevant. For example, thevectorizer passes print the source location of loops which aresuccessfully vectorized.

missed

Print information about missed optimizations. Individual passescontrol which information to include in the output.

note

Print verbose information about optimizations, such as certaintransformations, more detailed messages about decisions etc.

all

Print detailed optimization information. This includes‘optimized’, ‘missed’, and ‘note’.

The following option controls the dump verbosity:

internals

By default, only “high-level” messages are emitted. This option enablesadditional, more detailed, messages, which are likely to only be of interestto GCC developers.

One or more of the following option keywords can be used to describe agroup of optimizations:

ipa

Enable dumps from all interprocedural optimizations.

loop

Enable dumps from all loop optimizations.

inline

Enable dumps from all inlining optimizations.

omp

Enable dumps from all OMP (Offloading and Multi Processing) optimizations.

vec

Enable dumps from all vectorization optimizations.

optall

Enable dumps from all optimizations. This is a superset ofthe optimization groups listed above.

Ifoptions isomitted, it defaults to ‘optimized-optall’, which means to dump messagesabout successful optimizations from all the passes, omitting messagesthat are treated as “internals”.

If thefilename is provided, then the dumps from all theapplicable optimizations are concatenated into thefilename.Otherwise the dump is output ontostderr. Though multiple-fopt-info options are accepted, only one of them can includeafilename. If other filenames are provided then all but thefirst such option are ignored.

Note that the outputfilename is overwrittenin case of multiple translation units. If a combined output frommultiple translation units is desired,stderr should be usedinstead.

In the following example, the optimization info is output tostderr:

gcc -O3 -fopt-info

This example:

gcc -O3 -fopt-info-missed=missed.all

outputs missed optimization report from all the passes intomissed.all, and this one:

gcc -O2 -ftree-vectorize -fopt-info-vec-missed

prints information about missed optimization opportunities fromvectorization passes onstderr.Note that-fopt-info-vec-missed is equivalent to-fopt-info-missed-vec. The order of the optimization groupnames and message types listed after-fopt-info does not matter.

As another example,

gcc -O3 -fopt-info-inline-optimized-missed=inline.txt

outputs information about missed optimizations as well asoptimized locations from all the inlining passes intoinline.txt.

Finally, consider:

gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt

Here the two output filenamesvec.miss andloop.opt arein conflict since only one output file is allowed. In this case, onlythe first option takes effect and the subsequent options areignored. Thus onlyvec.miss is produced which containsdumps from the vectorizer about missed opportunities.

-fsave-optimization-record

Write a SRCFILE.opt-record.json.gz file detailing what optimizationswere performed, for those optimizations that support-fopt-info.

This option is experimental and the format of the data within thecompressed JSON file is subject to change.

It is roughly equivalent to a machine-readable version of-fopt-info-all, as a collection of messages with source file,line number and column number, with the following additional data foreach message:

  • the execution count of the code being optimized, along with metadata aboutwhether this was from actual profile data, or just an estimate, allowingconsumers to prioritize messages by code hotness,
  • the function name of the code being optimized, where applicable,
  • the “inlining chain” for the code being optimized, so that whena function is inlined into several different places (which mightthemselves be inlined), the reader can distinguish between the copies,
  • objects identifying those parts of the message that refer to expressions,statements or symbol-table nodes, which of these categories they are, and,when available, their source code location,
  • the GCC pass that emitted the message, and
  • the location in GCC’s own code from which the message was emitted

Additionally, some messages are logically nested within othermessages, reflecting implementation details of the optimizationpasses.

-fsched-verbose=n

On targets that use instruction scheduling, this option controls theamount of debugging output the scheduler prints to the dump files.

Forn greater than zero,-fsched-verbose outputs thesame information as-fdump-rtl-sched1 and-fdump-rtl-sched2.Forn greater than one, it also output basic block probabilities,detailed ready list information and unit/insn info. Forn greaterthan two, it includes RTL at abort point, control-flow and regions info.And forn over four,-fsched-verbose also includesdependence info.

-fenable-kind-pass
-fdisable-kind-pass=range-list

This is a set of options that are used to explicitly disable/enableoptimization passes. These options are intended for use for debugging GCC.Compiler users should use regular options for enabling/disablingpasses instead.

-fdisable-ipa-pass

Disable IPA passpass.pass is the pass name. If the same pass isstatically invoked in the compiler multiple times, the pass name should beappended with a sequential number starting from 1.

-fdisable-rtl-pass
-fdisable-rtl-pass=range-list

Disable RTL passpass.pass is the pass name. If the same pass isstatically invoked in the compiler multiple times, the pass name should beappended with a sequential number starting from 1.range-list is acomma-separated list of function ranges or assembler names. Each range is a numberpair separated by a colon. The range is inclusive in both ends. If the rangeis trivial, the number pair can be simplified as a single number. If thefunction’s call graph node’suid falls within one of the specified ranges,thepass is disabled for that function. Theuid is shown in thefunction header of a dump file, and the pass names can be dumped by usingoption-fdump-passes.

-fdisable-tree-pass
-fdisable-tree-pass=range-list

Disable tree passpass. See-fdisable-rtl for the description ofoption arguments.

-fenable-ipa-pass

Enable IPA passpass.pass is the pass name. If the same pass isstatically invoked in the compiler multiple times, the pass name should beappended with a sequential number starting from 1.

-fenable-rtl-pass
-fenable-rtl-pass=range-list

Enable RTL passpass. See-fdisable-rtl for option argumentdescription and examples.

-fenable-tree-pass
-fenable-tree-pass=range-list

Enable tree passpass. See-fdisable-rtl for the descriptionof option arguments.

Here are some examples showing uses of these options.

# disable ccp1 for all functions   -fdisable-tree-ccp1# disable complete unroll for function whose cgraph node uid is 1   -fenable-tree-cunroll=1# disable gcse2 for functions at the following ranges [1,1],# [300,400], and [400,1000]# disable gcse2 for functions foo and foo2   -fdisable-rtl-gcse2=foo,foo2# disable early inlining   -fdisable-tree-einline# disable ipa inlining   -fdisable-ipa-inline# enable tree full unroll   -fenable-tree-unroll
-fchecking
-fchecking=n

Enable internal consistency checking. The default depends onthe compiler configuration.-fchecking=2 enables furtherinternal consistency checking that might affect code generation.

-frandom-seed=string

This option provides a seed that GCC uses in place ofrandom numbers in generating certain symbol namesthat have to be different in every compiled file. It is also used toplace unique stamps in coverage data files and the object files thatproduce them. You can use the-frandom-seed option to producereproducibly identical object files.

Thestring can either be a number (decimal, octal or hex) or anarbitrary string (in which case it’s converted to a number bycomputing CRC32).

Thestring should be different for every file you compile.

-save-temps
--save-temps

Store the usual “temporary” intermediate files permanently; name themas auxiliary output files, as specified described under-dumpbase and-dumpdir.

When used in combination with the-x command-line option,-save-temps is sensible enough to avoid overwriting aninput source file with the same extension as an intermediate file.The corresponding intermediate file may be obtained by renaming thesource file before using-save-temps.

-save-temps=cwd

Equivalent to-save-temps -dumpdir ./.

-save-temps=obj

Equivalent to-save-temps -dumpdiroutdir/, whereoutdir/ is the directory of the output file specified after the-o option, including any directory separators. If the-o option is not used, the-save-temps=obj switchbehaves like-save-temps=cwd.

-time[=file]

Report the CPU time taken by each subprocess in the compilationsequence. For C source files, this is the compiler proper and assembler(plus the linker if linking is done).

Without the specification of an output file, the output looks like this:

# cc1 0.12 0.01# as 0.00 0.01

The first number on each line is the “user time”, that is time spentexecuting the program itself. The second number is “system time”,time spent executing operating system routines on behalf of the program.Both numbers are in seconds.

With the specification of an output file, the output is appended to thenamed file, and it looks like this:

0.12 0.01 cc1options0.00 0.01 asoptions

The “user time” and the “system time” are moved before the programname, and the options passed to the program are displayed, so that onecan later tell what file was being compiled, and with which options.

-fdump-final-insns[=file]

Dump the final internal representation (RTL) tofile. If theoptional argument is omitted (or iffile is.), the nameof the dump file is determined by appending.gkd to thedump base name, see-dumpbase.

-fcompare-debug[=opts]

If no error occurs during compilation, run the compiler a second time,addingopts and-fcompare-debug-second to the argumentspassed to the second compilation. Dump the final internalrepresentation in both compilations, and print an error if they differ.

If the equal sign is omitted, the default-gtoggle is used.

The environment variableGCC_COMPARE_DEBUG, if defined, non-emptyand nonzero, implicitly enables-fcompare-debug. IfGCC_COMPARE_DEBUG is defined to a string starting with a dash,then it is used foropts, otherwise the default-gtoggleis used.

-fcompare-debug=, with the equal sign but withoutopts,is equivalent to-fno-compare-debug, which disables the dumpingof the final representation and the second compilation, preventing evenGCC_COMPARE_DEBUG from taking effect.

To verify full coverage during-fcompare-debug testing, setGCC_COMPARE_DEBUG to say-fcompare-debug-not-overridden,which GCC rejects as an invalid option in any actual compilation(rather than preprocessing, assembly or linking). To get just awarning, settingGCC_COMPARE_DEBUG to ‘-w%n-fcompare-debugnot overridden’ will do.

-fcompare-debug-second

This option is implicitly passed to the compiler for the secondcompilation requested by-fcompare-debug, along with options tosilence warnings, and omitting other options that would cause the compilerto produce output to files or to standard output as a side effect. Dumpfiles and preserved temporary files are renamed so as to contain the.gk additional extension during the second compilation, to avoidoverwriting those generated by the first.

When this option is passed to the compiler driver, it causes thefirst compilation to be skipped, which makes it useful for littleother than debugging the compiler proper.

-gtoggle

Turn off generation of debug info, if leaving out this optiongenerates it, or turn it on at level 2 otherwise. The position of thisargument in the command line does not matter; it takes effect after allother options are processed, and it does so only once, no matter howmany times it is given. This is mainly intended to be used with-fcompare-debug.

-fvar-tracking-assignments-toggle

Toggle-fvar-tracking-assignments, in the same way that-gtoggle toggles-g.

-Q

When used on the command line prior to--help=,-Qacts as a modifier to the help output. SeeOptions Controlling the Kind of Output,for details about--help=.

Otherwise, this option makes the compiler print out each function nameas it is compiled, and print some statistics about each pass when itfinishes.

-ftime-report

Makes the compiler print some statistics to stderr about the time consumedby each pass when it finishes.

If SARIF output of diagnostics was requested via-fdiagnostics-format=sarif-file or-fdiagnostics-format=sarif-stderr then the-ftime-reportinformation is instead emitted in JSON form as part of SARIF output. Theprecise format of this JSON data is subject to change, and the values maynot exactly match those emitted to stderr due to being written out at aslightly different place within the compiler.

-ftime-report-details

Record the time consumed by infrastructure parts separately for each pass.

-fira-verbose=n

Control the verbosity of the dump file for the integrated register allocator.The default value is 5. If the valuen is greater or equal to 10,the dump output is sent to stderr using the same format asn minus 10.

-flto-report

Prints a report with internal details on the workings of the link-timeoptimizer. The contents of this report vary from version to version.It is meant to be useful to GCC developers when processing objectfiles in LTO mode (via-flto).

Disabled by default.

-flto-report-wpa

Like-flto-report, but only print for the WPA phase of link-timeoptimization.

-fmem-report

Makes the compiler print some statistics about permanent memoryallocation when it finishes.

-fmem-report-wpa

Makes the compiler print some statistics about permanent memoryallocation for the WPA phase only.

-fpre-ipa-mem-report
-fpost-ipa-mem-report

Makes the compiler print some statistics about permanent memoryallocation before or after interprocedural optimization.

-fmultiflags

This option enables multilib-awareTFLAGS to be used to buildtarget libraries with options different from those the compiler isconfigured to use by default, through the use of specs (seeSpecifying Subprocesses and the Switches to Pass to Them) set up by compiler internals, by the target, or by builders atconfigure time.

LikeTFLAGS, this allows the target libraries to be built forportable baseline environments, while the compiler defaults to moredemanding ones. That’s useful because users can easily override thedefaults the compiler is configured to use to build their own programs,if the defaults are not ideal for their target environment, whereasrebuilding the runtime libraries is usually not as easy or desirable.

UnlikeTFLAGS, the use of specs enables different flags to beselected for different multilibs. The way to accomplish that is tobuild with ‘make TFLAGS=-fmultiflags’, after configuring‘--with-specs=%{fmultiflags:...}’.

This option is discarded by the driver once it’s done processing driverself spec.

It is also useful to check thatTFLAGS are being used to buildall target libraries, by configuring a non-bootstrap compiler‘--with-specs='%{!fmultiflags:%emissing TFLAGS}'’ and buildingthe compiler and target libraries.

-fprofile-report

Makes the compiler print some statistics about consistency of the(estimated) profile and effect of individual passes.

-fstack-usage

Makes the compiler output stack usage information for the program, on aper-function basis. The filename for the dump is made by appending.su to theauxname.auxname is generated from the name ofthe output file, if explicitly specified and it is not an executable,otherwise it is the basename of the source file. An entry is made upof three fields:

  • The name of the function.
  • A number of bytes.
  • One or more qualifiers:static,dynamic,bounded.

The qualifierstatic means that the function manipulates the stackstatically: a fixed number of bytes are allocated for the frame on functionentry and released on function exit; no stack adjustments are otherwise madein the function. The second field is this fixed number of bytes.

The qualifierdynamic means that the function manipulates the stackdynamically: in addition to the static allocation described above, stackadjustments are made in the body of the function, for example to push/poparguments around function calls. If the qualifierbounded is alsopresent, the amount of these adjustments is bounded at compile time andthe second field is an upper bound of the total amount of stack used bythe function. If it is not present, the amount of these adjustments isnot bounded at compile time and the second field only represents thebounded part.

-fstats

Emit statistics about front-end processing at the end of the compilation.This option is supported only by the C++ front end, andthe information is generally only useful to the G++ development team.

-fdbg-cnt-list

Print the name and the counter upper bound for all debug counters.

-fdbg-cnt=counter-value-list

Set the internal debug counter lower and upper bound.counter-value-listis a comma-separated list ofname:lower_bound1-upper_bound1[:lower_bound2-upper_bound2...] tuples which setsthe name of the counter and list of closed intervals.Thelower_bound is optional and is zeroinitialized if not set.For example, with-fdbg-cnt=dce:2-4:10-11,tail_call:10,dbg_cnt(dce) returns true only for second, third, fourth, tenth andeleventh invocation.Fordbg_cnt(tail_call) true is returned for first 10 invocations.

-print-file-name=library
--print-file-name=library
--print-file-namelibrary

Print the full absolute name of the library filelibrary thatwould be used when linking—and don’t do anything else. With thisoption, GCC does not compile or link anything; it just prints thefile name.

-print-multi-directory
--print-multi-directory

Print the directory name corresponding to the multilib selected by anyother switches present in the command line. This directory is supposedto exist inGCC_EXEC_PREFIX.

-print-multi-lib
--print-multi-lib

Print the mapping from multilib directory names to compiler switchesthat enable them. The directory name is separated from the switches by‘;’, and each switch starts with an ‘@’ instead of the‘-’, without spaces between multiple switches. This is supposed toease shell processing.

-print-multi-os-directory
--print-multi-os-directory

Print the path to OS libraries for the selectedmultilib, relative to somelib subdirectory. If OS libraries arepresent in thelib subdirectory and no multilibs are used, this isusually just., if OS libraries are present inlibsuffixsibling directories this prints e.g.../lib64,../lib or../lib32, or if OS libraries are present inlib/subdirsubdirectories it prints e.g.amd64,sparcv9 orev6.

-print-multiarch
--print-multiarch

Print the path to OS libraries for the selected multiarch,relative to somelib subdirectory.

-print-prog-name=program
--print-prog-name=program
--print-prog-nameprogram

Like-print-file-name, but searches for a program such ascpp.

-print-libgcc-file-name
--print-libgcc-file-name

Same as-print-file-name=libgcc.a.

This is useful when you use-nostdlib or-nodefaultlibsbut you do want to link withlibgcc.a. You can do:

gcc -nostdlibfiles… `gcc -print-libgcc-file-name`
-print-search-dirs
--print-search-dirs

Print the name of the configured installation directory and a list ofprogram and library directoriesgcc searches—and don’t do anything else.

This is useful whengcc prints the error message‘installation problem, cannot exec cpp0: No such file or directory’.To resolve this you either need to putcpp0 and the other compilercomponents wheregcc expects to find them, or you can set the environmentvariableGCC_EXEC_PREFIX to the directory where you installed them.Don’t forget the trailing ‘/’.SeeEnvironment Variables Affecting GCC.

-print-sysroot
--print-sysroot

Print the target sysroot directory that is used duringcompilation. This is the target sysroot specified either at configuretime or using the--sysroot option, possibly with an extrasuffix that depends on compilation options. If no target sysroot isspecified, the option prints nothing.

-print-sysroot-headers-suffix
--print-sysroot-headers-suffix

Print the suffix added to the target sysroot when searching forheaders, or give an error if the compiler is not configured with sucha suffix—and don’t do anything else.

-dumpmachine

Print the compiler’s target machine (for example,‘i686-pc-linux-gnu’)—and don’t do anything else.

-dumpversion

Print the compiler version (for example,3.0,6.3.0 or7)—and don’t doanything else. This is the compiler version used in filesystem paths andspecs. Depending on how the compiler has been configured it can be justa single number (major version), two numbers separated by a dot (major andminor version) or three numbers separated by dots (major, minor and patchlevelversion).

-dumpfullversion

Print the full compiler version—and don’t do anything else. The output isalways three numbers separated by dots, major, minor and patchlevel version.

-dumpspecs

Print the compiler’s built-in specs—and don’t do anything else. (Thisis used when GCC itself is being built.) SeeSpecifying Subprocesses and the Switches to Pass to Them.

--paramname=value
--param=name=value

GCC by convention uses parameters that can be specified on the commandline instead of hard-wired constants to represent arbitrary compilerlimits or heuristics. Many parameters are related to optimization;for example, GCC does not inline functions that contain more than acertain number of instructions. The static analyzer similarly usesparameters to limit complexity, link-time optimization uses parametersto control partitioning, and so on. Other parameters control aspectsof GCC that are completely internal, such as its memory allocation andgarbage collection strategy. Still others control target-specificbehavior.

The--param option provides a uniform interface forspecifying values for these compiler parameters. However, the namesof specific parameters, and the meaning of the values, are tied to theinternals of the compiler, and are subject to change without notice infuture releases. You should not depend on parameter settings forcorrect compilation of your program. They are exposed via the commandline for the convenience of developers in debugging compilationproblems or, in some cases, to provide workarounds for compiler bugs.

SeeParameters inGNU Compiler Collection (GCC) Internals,for documentation of these internal parameters.


Next:Machine-Dependent Options, Previous:Options for Code Generation Conventions, Up:GCC Command Options   [Contents][Index]


[8]ページ先頭

©2009-2026 Movatter.jp