This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc instruction cost
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: htio2 <wenbin dot leong at gmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Thu, 15 Oct 2015 04:15:09 -0500
- Subject: Re: gcc instruction cost
- Authentication-results: sourceware.org; auth=none
- References: <1444795882532-1194316 dot post at n5 dot nabble dot com> <561E7176 dot 3020404 at redhat dot com> <1444841277722-1194519 dot post at n5 dot nabble dot com> <561E8E91 dot 1090408 at redhat dot com> <1444888228737-1194674 dot post at n5 dot nabble dot com> <561F61A5 dot 7090207 at arm dot com>
On Thu, Oct 15, 2015 at 09:19:49AM +0100, Kyrill Tkachov wrote:
> >I can see all the fprintf in combine.c but I just dont know how to triggle
> >the dump.
>
> If you specify -fdump-rtl-combine on the command line gcc will create a
> dump file
> with the information that combine dumps.
>
> Usually I just dump all rtl passes with -da.
You can also use -fdump-rtl-combine-details to view whatever the pass
considers to be "the details", just like with tree dumps. Unfortunately
this seems to not be documented. For combine, all the combination attempts
are printed with this, which is usually the more interesting information.
Combine then also prints the costs of all potential combinations (it uses
insn_rtx_cost as the cost: if the insn is a single SET, or a PARALLEL
of a single SET (and other things), it computes set_src_cost of the src
of that set; if positive, it returns that; otherwise, COST_N_INSNS (1);
in other cases (not a single set) it returns 0).
You can also use -fdump-rtl-combine-all to just have it print *everything*,
often the best thing to do. -da is -fdump-rtl-all-all. I recommend -da
(and cleaning up after yourself, there are rather many dumps ;-) )
Segher