This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/6 v4]: Merge from Stack Branch - Collect Alignment Info
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: "Ye\, Joey" <joey dot ye at intel dot com>, gcc-patches at gcc dot gnu dot org, Richard Guenther <richard dot guenther at gmail dot com>, "Guo\, Xuepeng" <xuepeng dot guo at intel dot com>, Jan Hubicka <hubicka at ucw dot cz>, "Jason Merrill" <jason at redhat dot com>, "Ian Lance Taylor" <iant at google dot com>, "Gerald Pfeifer" <gerald at pfeifer dot com>, "Bernd Schmidt" <bernds_cb1 at t-online dot de>, "Mark Mitchell" <mark at codesourcery dot com>
- Date: Sun, 08 Jun 2008 10:12:39 +0100
- Subject: Re: [PATCH 2/6 v4]: Merge from Stack Branch - Collect Alignment Info
- References: <BB577BF501703042AD7E08EADD8E514FF5DDCA@pdsmsx415.ccr.corp.intel.com> <87k5h1wnsg.fsf@firetop.home> <20080607150222.GA15988@lucon.org> <87ve0lm95d.fsf@firetop.home> <20080607223559.GA18457@lucon.org> <87r6b81eef.fsf@firetop.home>
Richard Sandiford <rdsandiford@googlemail.com> writes:
y> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>> What did you think of having the separate function? The idiom
>>> occurs quite often in your patch.
>>
>> There are 4 places with
>>
>> if (crtl->stack_alignment_estimated < align)
>> {
>> gcc_assert(!crtl->stack_realign_processed);
>> crtl->stack_alignment_estimated = align;
>> }
>>
>> in 2 different files and 2 places with some differences. A signle
>> helper function may make people think it should be used everywhere.
>
> It's the "2 places with differences" I'm concerned about. I think
> one of the differences you mean is:
>
> + if (!crtl->stack_realign_processed)
> + {
> + /* Can't exceed MAX_STACK_ALIGNMENT. */
> + if (boundary >= MAX_STACK_ALIGNMENT)
> + boundary = MAX_STACK_ALIGNMENT;
> + crtl->stack_alignment_estimated = boundary;
> + }
> + else
> + gcc_assert (!crtl->stack_realign_finalized
> + && crtl->stack_realign_needed);
>
> but it looked to me like this was strictly more general than the
> version you give. Let's call the version you quote "A" and the
> version immediately above "B". If A isn't strictly more general
> than B -- in other words, if it isn't safe to use B in places
> where we use A -- then why? This wasn't obvious (to me anyroad).
> That's why I used B in the suggested helper function.
Dammit, I knew those letters would catch me out. I meant
"if B isn't strictly more general than A".
Richard