LLVM for functional languages?

Hi,

I was looking at LLVM as a target for EHC
(http://catamaran.labs.cs.uu.nl/twiki/st/bin/view/Ehc) which is a
Haskell compiler. I got some questions on the status of LLVM.

I read some discussions on tail calls, and was wondering if they are
implemented.

Furthermore many comments in lib/Target/.. state:
'// FIXME: Implement the invoke/unwind instructions!'
I understood this is an old comment. Is it? If so, It might be good to
remove them. :slight_smile:

The model targeted by the code generation is based on GRIN
(http://www.cs.chalmers.se/~boquist/phd/index.html) which promotes a
calling convention based on passing arguments in registers as much as
possible.

Is it possible to return multiple values in registers? I could not find
anyting on this.

Regards,
Christof Douma

I was looking at LLVM as a target for EHC
(http://catamaran.labs.cs.uu.nl/twiki/st/bin/view/Ehc) which is a
Haskell compiler. I got some questions on the status of LLVM.

Ok, cool. :slight_smile:

I read some discussions on tail calls, and was wondering if they are
implemented.

Unfortunately, not yet. This is something that has been on the todo list for a long time, but noone has done it yet.

In the short term, you can probably make a lot of progress without needing this. By the time you will really need it, you will probably know enough about LLVM to implement it yourself if noone beats you to it.

Here are some notes on the subject:
http://nondot.org/sabre/LLVMNotes/GuaranteedEfficientTailCalls.txt

Furthermore many comments in lib/Target/.. state:
'// FIXME: Implement the invoke/unwind instructions!'
I understood this is an old comment. Is it? If so, It might be good to
remove them. :slight_smile:

The LLVM code generators fully support invoke/unwind.

The model targeted by the code generation is based on GRIN
(Data- och informationsteknik | Chalmers) which promotes a
calling convention based on passing arguments in registers as much as
possible.

Is it possible to return multiple values in registers? I could not find
anyting on this.

Not yet, but this too is in the plans:
http://nondot.org/sabre/LLVMNotes/MultipleReturnValues.txt

-Chris