[LLVMdev] Please review my patch to make GHC calling convention work on ARM

Stephen Blackheath [to LLVM-dev] effusively.proffer.stephen at blacksapphire.com
Thu Jun 30 17:16:40 PDT 2011


All,

I would like to submit the attached patch, which allows the GHC (Glasgow 
Haskell Compiler) calling convention to work on ARM targets.

Could some nice person please review this code, so I can move towards 
getting it committed?

I have thoroughly tested this patch again GHC on a Debian-ARM (armel) 
system.  Unfortunately my understanding of LLVM is limited, so it's 
likely I'm not doing things the best way.

Some explanation:
In the GHC calling convention, all calls are "tail calls" (really just 
jumps) and there is no returning. The meanings of the registers are 
determined by the GHC compiler. GHC calling convention code must not 
touch the stack pointer, because that's used to preserve the state for 
our return to C-land. Jumps between C and GHC are implemented directly 
in assembly language so LLVM doesn't have to deal with them.

So, I disabled the generation of prologues and epilogues, and I found 
that I also needed to tell it that there are no callee-saves registers 
in the GHC calling convention.

Thanks very much and keep up the excellent work, everyone!


Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm.patch
Type: text/x-patch
Size: 4371 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110701/01f5e675/attachment.bin>


More information about the llvm-dev mailing list