[<<][meta][>>][..]
Mon Aug 8 10:05:25 CEST 2011

LLVM's SSA

It might be a good idea to make sure the low level representation can
express the form needed by LLVM.  One of the differences with the
current approach is that all arguments are type-tagged, instead of the
return value, which is probably inferred.

Or maybe I get this wrong: could be that the op is tagged, and the
literals are tagged, but not the registers, as their type is known.

Here it might really be better to not start reinventing things.  There
are LLVM bindings in Haskell already[1].  It uses template haskell and
type-level[2].

It seems to have bidings for the full LLVM API, and generates bitcode,
not assembler text.  Is this useful for me?  From a question on the
Racket list I got the answer that for just generating code, it's not
worth it to use the API calls directly, and much simpler to generate
the asm.  Since I'm probably going to generate LLVM from different
programming systems (Haskell + Racket) it might be best to get to get
to know the textual syntax.

Otoh, using the programmatic interface might be interesting to perform
other kinds of tests on the code, i.e. meta-optimizations that measure
execution speed.  It might go straight into the interpreter too (if
the monadic type isn't an issue as mentioned before).


mAddMul :: CodeGenModule (Function (Int32 -> Int32 -> Int32 -> IO Int32))
mAddMul = 
  createFunction ExternalLinkage $ \ x y z -> do
    t <- add x y
    r <- mul t z
    ret r

[1] http://hackage.haskell.org/package/llvm
[2] http://augustss.blogspot.com/2009/01/llvm-llvm-low-level-virtual-machine-is.html





[Reply][About]
[<<][meta][>>][..]