[LLVMdev] Linux/ppc backend
nicolas.geoffray at lip6.fr
Sun Feb 4 05:19:33 PST 2007
Chris Lattner wrote:
> On Fri, 2 Feb 2007, Nicolas Geoffray wrote:
> Some meta comments:
> 1. Please don't change PPC -> llvmPPC. I assume that you did this because
> PPC is a #define in some system header. Please just add a '#undef PPC'
> where appropriate to make this unneeded.
> 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.
> 3. Please split up the patch into independent chunks for easier review.
> This will make it much more likely that your pieces will be applied in
> a timely fashion :). This will also let you get pieces in before the
> whole thing is "done".
>> 2) Line 369 of PPCInstrInfo.td, we declare the non-callee saved registers.
>> However, Linux and Darwin do not have the same set
>> of non-callee saved registers. I don't know how to make the if(isDarwin) test
>> in here
> Take a look at ARM/ARMRegisterInfo.td for an example of this.
Great, thx for the hint
>> 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
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
does not select it.
> Thanks a lot for doing this, linux/ppc support is a major new feature!
No problem, that way I'll be able to work with llvm on my own box :)
More information about the llvm-dev