[cfe-dev] PPC asm register definitions

Richard Pennington rich at pennware.com
Mon Sep 14 16:46:02 PDT 2009

Mike Stump wrote:
> On Sep 14, 2009, at 3:01 PM, Richard Pennington wrote:
>> I filed bug http://llvm.org/bugs/show_bug.cgi?id=4976 this morning. Dale
>> Johannesen mentioned that "3" is not a valid register name
> Actually, he didn't say exactly that.  He said that there is a bug in 
> llvm that prevents "3" from working.
>> for the LLVM  PPC code generator, it wants "r3".
>> Should I change Targets.cpp to use "r0"... instead?
> I think it would be reasonable to add r0 as the canonical spelling (I 
> don't think any assemblers we support can't support r0, do they?), but a 
> ppc assembly expert might have a better idea.  Note, we still have to 
> support 3 as a register name, you can't just remove it.
>> Also, the names GCCReg* don't seem right. Wouldn't LLVMRegNames* fit 
>> better?
> The naming comes from gcc's naming convention.  This convention is at 
> times necessary to follow as these names can be exposed in the source 
> code.  Changing it to LLVMRegNames just obscures that fact.

The point is the canonical form in clang is "3". The PPC code generator 
recognizes "r3".

What I was saying is that where register names are normalized and 
aliased in Targets.cpp perhaps "r3" should be returned instead of "3".

That change would mean that "3" could still be used, it would just be 
translated to "r3", just as "r3" is translated to "3" now.

I'm not sure I understand the GCC naming convention, but it really 
doesn't matter to me.


More information about the cfe-dev mailing list