[llvm-commits] Stub calls in Linux/PPC

Nate Begeman nbegeman at apple.com
Wed May 23 22:47:00 PDT 2007


On May 23, 2007, at 6:55 AM, Nicolas Geoffray wrote:

> Here's a patch to make stubs work in linux/ppc. I'll commit it if
> there's no objection.
>
> Chris: Just a question. I noticed on cvsweb that you wrote the lines:
>      MCE.emitWordBE(0x9421ffe0);     // stwu r1,-32(r1)
>      MCE.emitWordBE(0x7d6802a6);     // mflr r11
>      MCE.emitWordBE(0x91610028);     // stw r11, 40(r1)
>
> Why 32 when calling the stub?

Parameter area + 16 byte stack alignment.  We only bother to set this  
up when we're going to call the compilation callback, which will want  
to store the LR at the very least here.  In a nutshell, the ABI  
requires it :)

> Cheers,
> Nicolas
> Index: lib/Target/PowerPC/PPCJITInfo.cpp
> ===================================================================
> RCS file: /var/cvs/llvm/llvm/lib/Target/PowerPC/PPCJITInfo.cpp,v
> retrieving revision 1.37
> diff -t -d -u -p -5 -r1.37 PPCJITInfo.cpp
> --- lib/Target/PowerPC/PPCJITInfo.cpp	25 Feb 2007 05:04:13 -0000	1.37
> +++ lib/Target/PowerPC/PPCJITInfo.cpp	23 May 2007 13:51:52 -0000
> @@ -12,10 +12,11 @@
>  // 
> ===------------------------------------------------------------------- 
> ---===//
>
>  #define DEBUG_TYPE "jit"
>  #include "PPCJITInfo.h"
>  #include "PPCRelocations.h"
> +#include "PPCTargetMachine.h"
>  #include "llvm/CodeGen/MachineCodeEmitter.h"
>  #include "llvm/Config/alloca.h"
>  #include "llvm/Support/Debug.h"
>  #include <set>
>  using namespace llvm;
> @@ -145,60 +146,56 @@ asm(
>  asm(
>      ".text\n"
>      ".align 2\n"
>      ".globl PPC32CompilationCallback\n"
>  "PPC32CompilationCallback:\n"
> -    // Make space for 8 ints r[3-10] and 13 doubles f[1-13] and the
> +    // Make space for 8 ints r[3-10] and 8 doubles f[1-8] and the

This is an ABI change on Darwin, the first 13 fp regs might have  
arguments in them, and we have to save them, since presumably the  
compilation callback could clobber anything it wanted.  Please revert  
this part of the patch.

Thanks,
Nate

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070523/f629e695/attachment.html>


More information about the llvm-commits mailing list