Request for merge: GHC/ARM calling convention.

Hello,

today is the last day[1] when someone might ask for feature merge into the LLVM 3.0 release. I'd like to ask you to merge attached patch. This is implementation of GHC calling convention on ARM platform which is made by Stephen Blackheath with few additions by me. I hope that although the patch does not contain any test case, it still will be merged. The reason for this is that the patch itself is short and easy to read and it should not affect other parts of LLVM at all (from reading the code). Also the patch itself is already tested quite a lot by me, since using this I've built various GHC HEAD version over the time of last 3 months[2]. Also the patch does not add new feature (GHC calling convention) since this is already well supported on x86/x64 platform, but the patch just enhances this support to also support ARM platform and its really just ARM specific hence not affecting any other platform.

By including this patch you will easy adoption of GHC on ARM platform, and although GHC is already available on ARM platform in its "unregisterised" form, when LLVM is available with patch applied, GHC might be build in "registerised" form. This provides not only a lot of nice features of GHC (GHCi, Template Haskell, DPH etc.) but also significant performance improvement[3]. This all is missing from "unregisterised" built and might be presented in case of LLVM-supported "registerised" build of GHC.

If you insist an even minimalistic test-case, then please let me know. I do have quite a lot of commitments now, but I'll try to come with something till the end of this month. Anyway, I still hope that missing test is not merge-stopper especially when GHC/LLVM/ARM is tested with its own set of tests...

Thanks for considering this!
Karel

[1]: http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-September/043287.html

[2]: Current status: merged into GHC HEAD! | GHC on ARM

[3]: http://ghcarm.wordpress.com/tag/nofib/

llvm-ghc-arm.diff (4.65 KB)

Hi Karel,

today is the last day[1] when someone might ask for feature merge into the LLVM
3.0 release. I'd like to ask you to merge attached patch. This is implementation
of GHC calling convention on ARM platform which is made by Stephen Blackheath
with few additions by me.

I don't know enough to comment on your patch technically, but it should at least
be perfectly safe to apply: I don't see how it can impact any code that doesn't
use the GHC calling convention.

const unsigned*
ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
+ bool ghcCall = false;
+
+ if (MF) {
+ const Function *F = MF->getFunction();
+ ghcCall = (F ? F->getCallingConv() == CallingConv::GHC : false);
+ }

This bit looks dubious. Why do you need to do it?

Ciao, Duncan.