[LLVMdev] Linux/ppc backend

Chris Lattner sabre at nondot.org
Sun Feb 4 11:28:20 PST 2007


On Sun, 4 Feb 2007, Nicolas Geoffray wrote:
>> 2. The X86 backend has the unfortunate habit of saying "if !darwin" "if
>>     !cygwin" etc.  Most of the changes you've made are actually ABI related
>>     changes, not OS-specific changes.  As such, I'd prefer it if you added
>>     two methods to PPCSubtarget: isMachoABI() and isELF_ABI() (or whatever
>>     is the right name of the ABI that linux uses) and use those instead.
>>
> Well all of the changes are ABI related. In fact, could you give me an
> example of what is os-specific and not abi-specific? I'm not sure.

Most of the things you are doing are ABI-related, and until we have 
multiple targets using the same ABI, it doesn't make sense to have 
os-specific aspects.

An example of an OS-specific aspect: cygwin and mingw on x86 use the same 
ABI, however, mingw refers to longjmp as "longjmp" and cygwin refers to it 
as "_longjmp".

>>> 3) R31, which replaces R1 as stack pointer when there is a dynamic allocation
>>> in a method, must be seen as a callee-saved register and must not be saved
>>> and restored like it is actually for Darwin. I don't know how to specify
>>> that, when there is a dynamic allocation, R31 must be added to the set of
>>> registers that are saved before entering the method and restored at the end.
>>>
>>
>> Can you just mark it callee saved?  If so, and if there is an instruction
>> in the function that clobbers R31, it should automatically be saved and
>> restored.

> It is marked callee saved. Because when it is not needed as frame 
> pointer it is used like an ordinary register. But when it is used as 
> frame pointer, the prologue and epilogue change its value, but the 
> algorithm in llvm that finds clobbered register does not select it.

Okay, I'm not sure.  If you describe the constraints better, perhaps Jim 
or Evan will have an idea :)

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list