This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC patch: invariant addresses too cheap
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>, Richard Guenther <richard dot guenther at gmail dot com>, gcc-patches at gcc dot gnu dot org, rdsandiford at googlemail dot com
- Date: Tue, 17 Nov 2009 09:14:57 -0800
- Subject: Re: RFC patch: invariant addresses too cheap
- References: <Pine.LNX.4.64.0910191743440.15566@wotan.suse.de> <f865508f0910190942h1440349aqf88abbb135586d3c@mail.gmail.com> <84fc9c000910200201j264856cfi6ac7a2360883d748@mail.gmail.com> <f865508f0910200506m1664a75et9dce10aa7fa094de@mail.gmail.com> <878werq41v.fsf@firetop.home> <hch59e$tpv$1@ger.gmane.org> <84fc9c000910310414l40824315m45ff282e98e3b640@mail.gmail.com> <4AEC1C84.9050606@gnu.org> <873a4zpth9.fsf@firetop.home>
Richard Sandiford wrote:
>>> But then you should document that address-cost is supposed to be
>>> insn-cost based. Otherwise comparing apples with oranges doesn't
>>> make sense, even if it might look less magic to you.
>> That's true.
>
> Yeah. We'd also have to document that "half an insn" is considered cheap.
> And what does that really mean? Are we saying that "at most half of an
> insn can be given over to address calculation"? Seems a bit of a weird
> concept to hard-wire into the compiler.
I'm late to this party, but I agree.
I've been bothered by the COST_N_INSNS costs vs. random-integer costs
discrepancy in the past, and at one point I tracked down some bad
optimization decisions to a case where we comparing between the two.
(Maybe we weren't supposed to be doing that, but we were.)
I think COST_N_INSNS, while an approximation of reality (not all
instructions have the same cost of course), is a plausible framework,
but it seems more general just to use integers for costs, with all such
integers coming from the back end, and the target-independent code
limited to combining those integers using formulas.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713