Emitting constants to the .data section from the NatM monad

Simon Marlow marlowsd at gmail.com
Thu Dec 6 22:34:09 CET 2012


On 06/12/12 00:29, Johan Tibell wrote:
> Hi!
>
> I'm trying to implement word2Double# and I've looked at how e.g. LLVM
> does it. LLVM outputs quite clever branchless code that uses two
> predefined constants in the .data section. Is it possible to add
> contents to the current .data section from a function in the NatM
> monad e.g.
>
>      coerceWord2FP :: Width -> Width -> CmmExpr -> NatM Register
>
> ?

Yes, you can emit data.  Look at the LDATA instruction in the X86 
backend, for example, and see how we generate things like table jumps.

So are you going to add the two missing MachOps, MO_UF_Conv & MO_FU_Conv?

Cheers,
	Simon




More information about the Glasgow-haskell-users mailing list