search for: llconstant

Displaying 9 results from an estimated 9 matches for "llconstant".

2008 Mar 15
3
[LLVMdev] improving the ocaml binding's type safety
...implementations. One is bottom down, the other bottom up. This is an example of the following functions: string Value::getName() bool Constant::isNull() bool GlobalValue::isDeclaration() bool GlobalVariable::isGlobalConstant() bool Function::isVarArg() Driver code: val make_constant : unit -> llconstant t val make_global_variable : unit -> llglobalvariable t val make_function : unit -> llfunction t (* typesafe *) value_name (make_constant ());; value_name (make_global_variable ());; value_name (make_function ());; is_null (make_constant ());; is_declaration (make_global_variable ());; is_de...
2010 Feb 16
2
[LLVMdev] LLVM-OCaml Bindings Tutorial (2.6-2.7)
...rrors as exceptions on the OCaml side. Unfortunately most errors are assertions, which we can't hook into. Perhaps though we can recover some type safety. Hypothetically, I can imagine using polymorphic variants just like lablgtk, and type llvalue = [`Value] type lluser = [value | `User] type llconstant = [user | `Constant] type llfunction = [llconstant | `Function] val value_name : [> llvalue] -> string val is_tail_call : [>llfunction] -> bool Would something like this be worthwhile? If we do it right, I think we could be mostly source compatible.
2008 Mar 15
0
[LLVMdev] improving the ocaml binding's type safety
...is top down. This lets us extend our types, but > sacrifices some type safety, as we're saying that the arguments are > a superset of the variants. We can control this by limiting who can > create 't's: > > type 'a t > > type llvalue = [ `Value ] > type llconstant = [ llvalue | `Constant ] > type llglobalvalue = [ llvalue | `GlobalValue ] > type llglobalvariable = [ llglobalvalue | `GlobalVariable ] > type llfunction = [ llglobalvalue | `Function ] > > val value_name : [> `Value] t -> string > val is_null : [> `Constant] t -> bo...
2008 Mar 15
0
[LLVMdev] improving the ocaml binding's type safety
Hi Erick, On 2008-03-15, at 04:03, Erick Tryzelaar wrote: > I was talking to Gordon on #llvm earlier, and he challenged me with > coming up with a way to improve the ocaml binding's type safety. I > think I got an easy solution with phantom types. This could be a good step. I'm not sure I can predict all of the implications; I'd suggest you work up a proof of concept.
2008 Mar 15
4
[LLVMdev] improving the ocaml binding's type safety
I was talking to Gordon on #llvm earlier, and he challenged me with coming up with a way to improve the ocaml binding's type safety. We can't go letting haskell beat us now, can we? I think I got an easy solution with phantom types. For those who don't know what the problem is, the ocaml bindings share one type between whole class branches (like values). This means we need to downcast
2010 Feb 16
0
[LLVMdev] LLVM-OCaml Bindings Tutorial (2.6-2.7)
On Tuesday 16 February 2010 03:51:00 Jianzhou Zhao wrote: > Does anyone know if there is any realistic project using LLVM-OCaml > Bindings? I've written a VM in OCaml built upon LLVM using LLVM's OCaml bindings: http://www.ffconsultancy.com/ocaml/hlvm/ There are at least two other significant users of LLVM's OCaml bindings, AFAIK. > How is the performance? Performance
2010 Feb 16
3
[LLVMdev] LLVM-OCaml Bindings Tutorial (2.6-2.7)
Attached are updated LLVM-OCaml Bindings Tutorial from Chris Wailes. (http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-April/021804.html) We changed them to work with the latest APIs(LLVM2.6 and the latest LLVM from SVN). Does anyone know if there is any realistic project using LLVM-OCaml Bindings? How is the performance? Jianzhou -------------- next part -------------- A non-text attachment was
2008 Mar 16
0
[LLVMdev] improving the ocaml binding's type safety
On Sat, Mar 15, 2008 at 7:33 PM, Gordon Henriksen <gordonhenriksen at mac.com> wrote: > After some experimentation, I'd prefer the closed system. LLVM has some type > peculiarities like the commonality between CallInst and InvokeInst. I find > that the closed type system lets me express such constraints more naturally. > Expressing these constraints explicitly in the open
2008 Mar 16
2
[LLVMdev] improving the ocaml binding's type safety
Erick, After some experimentation, I'd prefer the closed system. LLVM has some type peculiarities like the commonality between CallInst and InvokeInst. I find that the closed type system lets me express such constraints more naturally. Expressing these constraints explicitly in the open system involves annotating the C++ class hierarchy with extra variants which are unnecessary in