> On Mar 11, 2015, at 8:53 PM, David Wohlferd <d...@limegreensocks.com> wrote:
> 
>>> ...
>>> I would agree that one should avoid it.  I'd be wary of removing it
>>> from GCC at this point since it might break working code.
>> It certainly would.  It’s not all that common, but I have seen this done in 
>> production code.  Come to think of it, this certainly makes sense in 
>> machines where some instructions act on fixed registers.
> 
> Really?  While I've seen much code that uses clobbers, I have never (until 
> this week) see anyone attempt to clobber by index.  Since I'm basically an 
> i386 guy, maybe this is a platform thing?  Do you have some examples/links?

The example I remember was not in open code.  It may have been cleaned up by 
now, but as supplied to us by the vendor, there were some bits of assembly code 
that needed a scratch register and used a fixed register (t0 == %8) for that 
purpose rather than having GCC deal with temporaries.  So there was a clobber 
with “8” in it.  Obviously there’s a better way in that instance, but if GCC 
had removed the feature before we found and cleaned up that code, we would have 
had a failure on our hands.

An example of hardwired registers I remember is some VAX instructions (string 
instructions).  You could write those by name, of course, but if you didn’t 
know that GCC supports names, you might just use numbers.  On machines like VAX 
where the register names are really just numbers (R0, R1, etc.) that isn’t such 
a strange thing to do.

>> Register names would be nice as an additional capability.
> 
> Every example I've ever seen uses register names.  Perhaps that what you've 
> seen before?

No; I didn’t know that gcc supports register names.  The examples I had seen 
all use numbers.  Or more often, preprocessor symbols.  It may be that’s 
because the most common asm code I run into is MIPS coprocessor references, and 
while general registers may be known by name, coprocessor registers may not be. 
 Or it may just be a case of lack of awareness.

        paul

Reply via email to