[haskell-llvm] Limitation of API - omissions or design?
uzytkownik2 at gmail.com
Thu Dec 16 07:47:23 EST 2010
On Thu, 2010-12-16 at 05:51 +0100, Henning Thielemann wrote:
> Maciej Piechotka schrieb:
> > I tried to use Haskell + LLVM binding to it to write university
> > compilers assignment and I run into some problems with API:
> > - Many functions are non-existing or not exported.
> It's also a problem of LLVM that not all LLVM functions are exported by
> the LLVM interface to C. Haskell can only call the C interface, not the
> C++ one.
I meant by the functionality of low-level api. At least things like
greating global from CodeGenFunction scope.
> > For example it seems
> > to be not possible to create array containing other things that 0 and -1
> > other then String.
> I have already successfully worked with arrays. Can you please show a
> piece of code that does not do what it should?
Now that I know that constOf is exported (I missed it from export list)
> > The constOf function is also not exported.
> The constOf function is exported, but for some unknown reason Haddock
> does not show it.
> > - Higher API enforces type safety, which is good thing if one uses LLVM
> > to DSL - however if LLVM is used as backend it causes problems as I
> > don't know types at compile time and checking is part of other part of
> > code.
> You can use Rank2Types in order to construct Haskell types at runtime.
> The technique is illustrated by converting a Haskell number to a Haskell
> type level number:
I use this technique often. Well the code is secure but I have things
like infinite space of values of infinite space of functions.
Possibly I am doing something wrong but there is small amount of
examples on web.
> > GADTs allows workaround problem but
> > - Higher API cannot jump into lower API for a few instructions but uses
> > all-or-nothing approach. Normally it would be good thing if not the
> > previous problems.
> Maybe if you show a specific problem we can turn Nothing to All. Note
> that there is another Haskell LLVM interface that, as far as I know, is
> not as strongly typed and is used for the GHC LLVM backend.
Unfortunatly targe compiler is GHC 6.12.x not 7.0.x
PS. I'm sorry for the content of list but it was sent on 4am after whole
day of trying to understend LLVM.
PPS. I'm not sure how to solve this problem - it is separate to the
above issues. On Gentoo there seems that MISP target is not built even
with alltargets USE flag:
ghci> x <- newModule
Loading package syb-0.2.2 ... linking ... done.
Loading package array-0.3.0.2 ... linking ... done.
Loading package containers-0.4.0.0 ... linking ... done.
Loading package pretty-188.8.131.52 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package type-level-0.2.4 ... linking ... done.
Loading package mtl-184.108.40.206 ... linking ... done.
Loading package bytestring-0.9.1.8 ... linking ... done.
Loading package filepath-220.127.116.11 ... linking ... done.
Loading package old-locale-18.104.22.168 ... linking ... done.
Loading package old-time-22.214.171.124 ... linking ... done.
Loading package unix-126.96.36.199 ... linking ... done.
Loading package directory-188.8.131.52 ... linking ... done.
Loading package process-184.108.40.206 ... linking ... done.
Loading package llvm-0.9.0.1 ... linking ...
<interactive>: /home/mpiechotka/.cabal/lib/llvm-0.9.0.1/ghc-7.0.1/HSllvm-0.9.0.1.o: unknown symbol `LLVMInitializeMSILTargetInfo'
ghc: unable to load package `llvm-0.9.0.1'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 836 bytes
Desc: This is a digitally signed message part
Url : http://projects.haskell.org/pipermail/haskell-llvm/attachments/20101216/138fac6e/attachment.pgp
More information about the Haskell-llvm