basic asm and memory clobbers

David Wohlferd dw@LimeGreenSocks.com
Mon Nov 23 21:36:00 GMT 2015


On 11/23/2015 12:37 PM, Jeff Law wrote:
> On 11/23/2015 03:04 AM, Andrew Haley wrote:
>> On 21/11/15 12:56, David Wohlferd wrote:
>>> So, what now?
>>>
>>> While I'd like to take the big step and start kicking out warnings for
>>> non-top-level right now, that may be too bold for phase 3.  A more
>>> modest step for v6 would just provide a way to find them (maybe
>>> something like -Wnon-top-basic-asm or -Wonly-top-basic-asm) and doc the
>>> current behavior as well as the upcoming change.
>>
>> Warnings would be good.
>>
>> My warning still holds: there are modes of compilation on some
>> machines where you can't clobber all registers without causing reload
>> failures.  This is why Jeff didn't fix this in 1999.  So, if we really
>> do want to clobber "all" registers in basic asm it'll take a lot of
>> work.
> Exactly.  In retrospect, I probably should have generated more tests 
> for those conditions back in '99.  Essentially they'd document a class 
> of problems we'd like to fix over time.
>
> I know some have been addressed in various forms, but it hasn't been 
> systematic.
>
> My recommendation here is to:
>
>   1. Note in the docs what the behaviour should be.  This guides where
>   we want to go from an implementation standpoint.  I think it'd be fine
>   to *suggest* only using old style asms at the toplevel, but I'm less
>   convinced that mandating that restriction is wise.

I hear your concerns about mandating this.  Perhaps starting by 
providing an option to find them, then (someday) enabling that option by 
default?

>   2. As we come across failures for adhere to the desired behaviour,
>   fix or document them as known inconsistencies.  If we find that some
>   are inherently un-fixable, then we'll need to tighten the docs around
>   those.

It's your expectation that extended asm won't be sufficient to resolve 
these issues?

> The more I think about it, I'm just not keen on forcing all those 
> old-style asms to change.

If you mean you aren't keen to change them to "clobber all," I'm with 
you.  If you are worried about changing them from basic to extended, 
what kinds of problems do you foresee?  I've been reading a lot of basic 
asm lately, and it seems to me that most of it would be fine with a 
simple colon.  Certainly no worse than the current behavior.

dw



More information about the Gcc mailing list