[haskell-llvm] Constructing the array of argument types

José Romildo Malaquias j.romildo at gmail.com
Thu Nov 22 20:28:58 GMT 2012


Hello.

The low level LLVM bindings to Haskell (module LLVM.FFI.Core) has the
function

  functionType
    :: TypeRef     -- return type
    -> Ptr TypeRef -- array of argument types
    -> CUInt       -- number of elements in array
    -> CInt        -- non-zero if function is varargs
    -> TypeRef

to create a LLVM function type.

Supposing that my toy compiler uses the following type to represent
types internally:

  data Type = INTEGER | LOGIC

How can a list of formal parameter types reprented as a list of type

  [Type]

can be converted to the low level array (expected by the above function)
of type

   Ptr TypeRef

?

Romildo



More information about the Haskell-llvm mailing list