[LLVMdev] Request for merge: GHC/ARM calling convention.

Karel Gardas karel.gardas at centrum.cz
Sun Jun 24 07:18:28 PDT 2012


first of all: one of the LLVM 3.0 new feature was a support for GHC 
specific calling convention on ARM platform. It looks like this support 
was merged just into 3.0 branch, specifically it appeared in 3.0 RC2.
Anyway, I hope this is just a mistake or omission that such support was 
merged only into 3.0 and not also into HEAD. I've just found it by 
testing LLVM 3.1 with GHC 7.4.2 and LLVM complained to me about 
unsupported calling convention which was surprising for me and I've gone 
for a little bit investigation and found all the GHC/ARM calling 
convention code missing from it.

So I've grabbed LLVM HEAD and applied the GHC/ARM calling convention 
patch to it with some tweaks to resolve rejects. I've also changed a 
patch a little bit to use LLVM's facility to generate callee-saved regs 
list automatically from ARMCallingConv.td. However either I don't know 
well syntax for callee save regs specification or the tool does not 
support empty list, I've needed to use simple work around to come to the 
same result as was in the previous patch version. (For those interested, 
the error with empty list was "expected identifier in dag init")

+// GHC set of callee saved regs is empty as all those regs are
+// used for passing STG regs around
+// sub/add LR is a workaround for not being able to compile empty list:
+// def CSR_GHC : CalleeSavedRegs<()>;
+def CSR_GHC : CalleeSavedRegs<(sub (add LR), LR)>;

otherwise, the patch is the same like it was merged into 3.0 release as 
submitted here: 

Please see attached patch and tell me if it's all right for inclusion 
into LLVM HEAD or not and if not, what else shall I provide in order to 
make LLVM team happy about it.

BTW: of course, LLVM HEAD with this patch applied is already tested here 
with GHC 7.4.2. (i.e. the compiler bootstrap well with it) and LLVM's 
own testsuite does not reveal any new regression caused by this patch.

Thanks a lot!

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ghc-arm-llvm.diff
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120624/891b3ca2/attachment.ksh>

More information about the llvm-dev mailing list