On Wed, Jul 11, 2012 at 12:19:17PM +0200, Gabor Greif wrote:
>
> (**) ultimately we'll need a 3-stage build for cross compilation,
> because I consider Template Haskell as essential.
An alternative would be a "full" cross-compiler, where a single ghc can
target multiple platforms. This would mean a little build system work,
e.g. building
libraries/*/dist-install-$platform
for each $platform.
But the main obstacle to making this possible is the functions like
callerSaves :: GlobalReg -> Bool
which are currently defined for the target platform with ifdefs. We'd
need
callerSaves :: Platform -> GlobalReg -> Bool
without ifdefs. I experimented with trying to generate this a while ago
(I think http://lambda.haskell.org/~igloo/genmachregs.hs is as far as I
got; it needs a little build system integration too, but it's probably
not worth me trying to dig that out), but the generation code felt very
ugly, so I put it aside.
Another possible approach would be to #include the CPP definitions
multiple times, with different platform variables #defined, e.g.
callerSaves X86 = callerSaves_X86
callerSaves X86_64 = callerSaves_X86_64
...
#define REGS_PLATFORM X86
#include "Regs.hs" -- generates callerSaves_X86
#define REGS_PLATFORM X86_64
#include "Regs.hs" -- generates callerSaves_X86_64
This wouldn't get rid of the ifdefs, but at least we'd be compiling
exactly the same code on all platforms.
Thanks
Ian
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc