I have almost completed the implementation of a linux/ppc backend in llvm. There were a few things to modify in
lib/Target/PowerPC with a lot of "if (!isDarwin)".
There are some places where I need help before saying the port is complete. I attached the diff file as a reference
1) In order to generate a creqv instruction before a vararg call, I created a new instruction in PPCInstrInfo.td: SETCR which
uses the new XForm_1_ext format. It does not use the XForm_1 format because I wanted to give only one register as operand.
I'm not sure if this is the correct way to do this, but it works.
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
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.
If anyone's kind enough to help me out
diff-powerpc-linux.patch (36.2 KB)