bscarlet / llvm-general

Rich LLVM bindings for Haskell (with transfer of LLVM IR to and from C++, detailed compilation pass control, etc.)
http://hackage.haskell.org/package/llvm-general
132 stars 38 forks source link

Documentation #71

Closed ghost closed 11 years ago

ghost commented 11 years ago

I am using this library to generate a backend for a small compiler project. I am stuck on a point in the LLVM-General-Pure package.

In LLVM-General-AST

A function is defined: Function Linkage Visibility CallingConvention [ParameterAttribute] Type Name ([Parameter], Bool) [FunctionAttribute](Maybe String) Word32 [BasicBlock]

My main question is in the parameter list, why is a boolean value wrapped up with it; i.e. why ([Parameter],Bool). The LLVM language reference just asks for a possibly empty list of parameters, so it is unclear what this boolean value is used for.

The second question regards the garbage collector name. In the LLVM reference, part of a function declaration is an optional garbage collector name. Is this feature not supported?

I am writing a small compiler backend using your library. If it would help your documentation, I could link you to it once I am finished... I would volunteer to help with the documentation, but I don't know the internals of LLVM that well, so I am not sure that would be useful.

bscarlet commented 11 years ago

The Bool which is the second half of the parameters pair is for indicating varargs functions - it should usually be False, but be True for functions like printf.

The omission of the garbage collector name is a bug.

bscarlet commented 11 years ago

Fixed in llvm-3.2 as 3.2.8.0, llvm-3.3 as 3.3.8.0, and master.