[LLVMdev] Inserting an assembly instruction in the calling sequence of the powerpc target

Nicolas Geoffray nicolas.geoffray at lip6.fr
Fri Jan 12 04:22:19 PST 2007


Hi all,

I'm currently implementing a linux/ppc target in llvm. The abis between 
Darwin/ppc and
linux/ppc are different and I'm running into problems with vararg calls.

Before a variadic method is called, an extra instruction must be 
executed (which is creqv 6, 6, 6). This
instruction is not necessary in Darwin/ppc.
I looked into the PowerPC target implementation and the code generation uses
Dags (lib/Target/PowerPC/PPCISelLowering.cpp, LowerCALL).

I need some help on how to insert the creqv instruction in the calling 
sequence.

After this is implemented, I will be able to send a patch for linux/ppc 
support.

I also need to know what is your preference for a linux/ppc target 
implementation? I can either
1) Use macros (#ifdef __MACH__ for darwin or #ifdef __PPC__ for linux)
2) Test the target in the code when needed
   if (os == linux && ppc32) then...
   else if (os == linux && ppc64) then ...
   else if (os == darwin && ppc32) then ...
   else if (os == darwin && ppc64) then ...
3) Create a new subtarget (but does it worth it? considering that the 
difference between the 2 abis is minor)

Thx for your help.

Cheers,
Nicolas



More information about the llvm-dev mailing list