basic asm and memory clobbers
Richard Henderson
rth@redhat.com
Fri Nov 20 15:30:00 GMT 2015
On 11/20/2015 04:20 PM, Segher Boessenkool wrote:
> On Fri, Nov 20, 2015 at 02:05:01PM +0100, Richard Henderson wrote:
>> I'd be perfectly happy to deprecate and later completely remove basic asm
>> within functions.
>>
>> Because IMO it's essentially useless. It has no inputs, no outputs, and no
>> way to tell the compiler what machine state has been changed. We can say
>> that "it clobbers everything", but that's not actually useful, and quite
>> difficult as you're finding out.
>>
>> It seems to me that it would be better to remove the feature, forcing what
>> must be an extremely small number of users to audit and update to extended
>> asm.
>
> Should asm("bla"); then be an extended asm with no input, no outputs,
> no (non-automatic) clobbers? That would be the most straightforward and
> logical semantics, but will it break user code?
I'm suggesting that we don't accept that at all inside a function. One must
audit the source and make a conscious decision to write asm("bla" : ); instead.
Accepting basic asm outside of a function is perfectly ok, since that's just a
mechanism by which one can inject complete assembly routines into a C
translation unit.
r~
More information about the Gcc
mailing list