> I'm currently working on a native code generator for PowerPC. I've
> already got some modules to compile and run :-), but now I need the
> help of a NCG wizard...
Hurrah! I'm afraid you won't find any NCG wizards around here though,
only NCG neophytes. There's lots of useful stuff in the GHC Commentary,
though, so take a look there if you haven't already.
> *) I'm confused about the way the NCG handles floating-point:
> It seems to introduce a distinction between Float and Double FP
> registers (Normally, on PowerPC, every FP reg can be used as either
> single or double precision). The x86 NCG seems to be using
> only Double
> regs, and the sparc NCG seems to partition the available registers in
> Double and Float registers.
> I've got 14 caller-save FP Regs (of which up to 13 are used for
> parameter passing), 6 callee-saves mapped to STG regs and 12 free
> callee-save FP Regs. What shall I do with them?
> I can't label the parameter-passing regs as either Float or Double,
> they have to be used for both types (for a ccall, at least).
Looking at the code, I think it could do with beefing up a little to
cope with the fact that some registers can contain either a Float or a
Double. Or you could just use RcDouble like x86 does; the floating
point instructions should contain the operand size anyhow.
> *) Eventually, I'll need to generate stub code for symbols that might
> be imported from shared libraries. For every symbol mentioned in a
> ccall, I'll need to append a few lines to the output file (with only
> little variation). Where would something like that fit into the
> structure of the code?
If it has to be placed at the end of the file, then you'll need either a
separate pass to collect it up and append it to the file, or keep it in
the monad as you go along. Currently the monad is a standard UniqSM, so
you'd need to change it to a specialised NCG monad to do that.
The easiest way is to place the extra bits of code in a different
section (i.e. not text or data), then you can just drop them in the
output as required. That might not be possible, I don't know much about
PPC dynamic linking.
Cheers,
Simon
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc