search for: llvalu

Displaying 20 results from an estimated 31 matches for "llvalu".

Did you mean: llvalue
2010 Feb 18
6
[LLVMdev] ocaml survey
...fer to keep the API clean. 3. Are there any llvm functionality that you need exposed to ocaml? Right now I plan to expose: add Union to TypeKind.t external union_type: llcontext -> lltype array -> lltype external union_element_types : lltype -> lltype array external build_indirect_br : llvalue -> int -> llbuilder -> llvalue external add_destination: llvalue -> llbasicblock -> unit external build_nsw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue external build_nuw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue external buil...
2010 Feb 18
0
[LLVMdev] ocaml survey
...#39;d like is exceptions on the OCaml side from LLVM errors. > Right now I plan to expose: > > add Union to TypeKind.t > external union_type: llcontext -> lltype array -> lltype > external union_element_types : lltype -> lltype array > > external build_indirect_br : llvalue -> int -> llbuilder -> llvalue > external add_destination: llvalue -> llbasicblock -> unit > > external build_nsw_add : llvalue -> llvalue -> string -> llbuilder -> > llvalue external build_nuw_add : llvalue -> llvalue -> string -> llbuilder > -&g...
2010 Feb 19
0
[LLVMdev] ocaml survey
...there any llvm functionality that you need exposed to ocaml? > Right now I plan to expose: > > add Union to TypeKind.t > external union_type: llcontext -> lltype array -> lltype > external union_element_types : lltype -> lltype array > > external build_indirect_br : llvalue -> int -> llbuilder -> llvalue > external add_destination: llvalue -> llbasicblock -> unit > > external build_nsw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue > external build_nuw_add : llvalue -> llvalue -> string -> llbuilder -> l...
2007 Nov 27
0
[LLVMdev] Fibonacci example in OCaml
...f these > > constraints in the static type system. Has anyone tried to leverage > > this? > > Any specific ideas? Provide a type enumerating the valid terminators and restrict the last instruction in a block to be a terminator. Something like this: type terminator = [ `ret of llvalue | `br of llvalue ] type instruction = [ terminator | `add of llvalue * llvalue | `sub of llvalue * llvalue ] type block = instruction list * terminator If you want to avoid having a data structure representing the input to LLVM then you can probably achieve the same result...
2007 Nov 26
4
[LLVMdev] Fibonacci example in OCaml
On Nov 26, 2007, at 14:18, Jon Harrop wrote: > On Monday 26 November 2007 16:21, Gordon Henriksen wrote: >> > >> Unfortunately, even if the bindings were more strongly typed, it >> would still be structurally possible to build invalid LLVM code, so >> you've just got to take care not to violate the invariants, then >> use the verifier as a
2008 Mar 15
4
[LLVMdev] improving the ocaml binding's type safety
...ar ], like [ `Foo ]. *) type e = [> `Foo | `Bar ] (* match any polymorphic variant that has a superset of [ `Foo | `Bar ] like [ `Foo | `Baz ] or even `Baz, since without brackets `Baz has the type of all the possible variants. *) So with this we can construct a simplified type hierarchy: type llvalue = [ `Value ] type llfunction = [ llvalue | `Function ] Finally, we'll create a polymorphic type that holds the phantom type: type 'a t And then define functions that work on these types. Since we want a function that can take an llvalue, we need to specify it like this: val use_value:...
2007 Nov 27
1
[LLVMdev] Fibonacci example in OCaml
On 2007-11-26, at 21:12, Jon Harrop wrote: > Provide a type enumerating the valid terminators and restrict the > last instruction in a block to be a terminator. Something like this: > > type terminator = [ `ret of llvalue | `br of llvalue ] > type instruction = > [ terminator > | `add of llvalue * llvalue > | `sub of llvalue * llvalue ] > type block = instruction list * terminator > > If you want to avoid having a data structure representing the input > to LLVM then you ca...
2008 Mar 15
3
[LLVMdev] improving the ocaml binding's type safety
...This also means that we can't add another library that subclasses from something and still use these functions: type 'a t type llfunction = [ `Function ] type llglobalvariable = [ `GlobalVariable ] type llglobalvalue = [ llfunction | llglobalvariable ] type llconstant = [ `Constant ] type llvalue = [ llconstant | llglobalvalue ] val value_name : [< llvalue] t -> string val is_null : [< llconstant] t -> bool val is_declaration : [< llglobalvalue] t -> bool val is_global_constant : [< llglobalvariable] t -> bool val is_var_arg : [< llfunction] t -> bool The...
2008 Mar 15
0
[LLVMdev] improving the ocaml binding's type safety
...type t -> `FunctionTy t For Value, it will be important to push the ISA routines through all of the layers (esp. for Value), but I think you can implement ISA routines in Ocaml relatively painlessly for Type. > Here's the full example: > > foo.mli: > type 'a t > type llvalue = [ `Value ] > type llfunction = [ llvalue | `Function ] > > val use_value : [> `Value] t -> unit > val use_function : [> `Function] t -> unit > > val make_value : unit -> llvalue t > val make_function : unit -> llfunction t > > Does this sound like it...
2010 Aug 18
0
[LLVMdev] a typo in OCaml bindings
Hi, revision 111418 binding/ocaml/llvm/llvm_ocaml.c /* llvalue -> int -> llvalue */ CAMLprim value llvm_params(LLVMValueRef Fn, value Index) { value Params = alloc(LLVMCountParams(Fn), 0); LLVMGetParams(Fn, (LLVMValueRef *) Op_val(Params)); return Params; } does not match the interface at binding/ocaml/llvm/llvm.ml external params : llvalue -&gt...
2010 Aug 15
4
[LLVMdev] Ocaml bindings in 2.8
Hi, Does 2.8 release plan to change anything in Ocaml bindings? http://llvm.org/docs/ReleaseNotes.html#whatsnew does not list any relevant features. 2.7 added 'operand' that can access each operand from a value. external operand : llvalue -> int -> llvalue = "llvm_operand" Does this binding also expose a primitive to return how many operands a given value has? I need some primitives that check kinds of instructions, and access operands or other properties of a kind of instruction. Can 'operand' work for thi...
2010 Feb 16
2
[LLVMdev] LLVM-OCaml Bindings Tutorial (2.6-2.7)
...logs. I'd much rather > the bindings reraised errors 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 mos...
2010 Aug 17
0
[LLVMdev] Ocaml bindings in 2.8
...l around nowish before a release to sync llvm-c and the ocaml bindings. I'll start the process. Is there anything in particular you are looking for? I'm happy to integrate patches for you. > 2.7 added 'operand' that can access each operand from a value. >  external operand : llvalue -> int -> llvalue = "llvm_operand" > Does this binding also expose a primitive to return how many operands > a given value has? Oops, I forgot to expose an equivalent LLVMGetNumOperands. I'll get that into 2.8. > I need some primitives that check kinds of instruction...
2008 Mar 15
0
[LLVMdev] improving the ocaml binding's type safety
...aar wrote: > The other way 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...
2011 Jun 13
2
[LLVMdev] Reading Instructions from Ocaml
Hello, I'm interested in the OCaml bindings, but I've been digging through them and it doesn't seem possible to actually write a transformation with them. Specifically, there are a lot of functions to build each type of instruction, but there doesn't seem to be any way to query an llvalue and determine what kind of instruction it is. Is there something that I am missing? Thank you. -- gregory malecha -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110613/edef6cb4/attachment.html>
2013 Jan 14
0
[LLVMdev] OCaml binding: error with the function "has_metadata"
...VM download page and this is a small code sample that is crashing, giving the error message above: ************************************ let load_module filename = let mb = Llvm.MemoryBuffer.of_file filename in Llvm_bitreader.parse_bitcode (Llvm.global_context ()) mb let stats m = let print llvalue = if Llvm.has_metadata llvalue then Printf.printf "%s\n%!" (Llvm.value_name llvalue) in Llvm.iter_functions print m let _ = let m = load_module Sys.argv.(1) in stats m ************************************* Does anbody know if I am doing something wrong...
2010 Dec 22
0
[LLVMdev] the optional function return attribute and the llvm-c bindings
...propose to add the corresponding OCaml functions to the "Operations on functions" section of the Llvm module in the OCaml bindings too, of course: (** [add_return_attr f a] adds the return parameter attribute [a] to the return type of the function [f]. *) val add_return_attr: llvalue -> Attribute.t -> unit (** [remove_return_attr f a] removes the return parameter attribute [a] from the return type of the function [f]. *) val remove_return_attr: llvalue -> Attribute.t -> unit I also propose to update the ocamldoc text for the following OCaml functions...
2010 Dec 21
2
[LLVMdev] the optional function return attribute and the llvm-c bindings
On Dec 21, 2010, at 00:43, Duncan Sands wrote: > > IIRC the function return value is considered to be the parameter with index 0. > The function itself is considered to be the parameter with index ~0U. Yes, that's what the documentation seems to say is the proper mode for indexing the return parameter, but when I set an attribute on the parameter with index zero, it gets applied to
2007 Oct 19
0
[LLVMdev] OCaml Install Error
...in OCaml and I have to pull of some stunts to be able to change the definition of a function. (emit a .ll file containing the code, looking up the function and calling removeBody, then reading the .ll file back in using ParseAssemblyString). I noticed that functions are represented as an llvalue which makes turning it into a Function* unsafe if I'm correct? greetings, Jan On 2. Okt 2007, at 19:51, Gordon Henriksen wrote: > On 2007-10-02, at 10:46, Jan Rehders wrote: > >> where can I read more about this? I assume (hope) the lib provides >> some kind of OCaml b...
2007 Oct 02
2
[LLVMdev] OCaml Install Error
On 2007-10-02, at 10:46, Jan Rehders wrote: > where can I read more about this? I assume (hope) the lib provides > some kind of OCaml bindings? I could not find any trace of it in > the 2.1 release source so I guess it's currently SVN only? Jan, Here's a trivial example. $ cat metahelloworld.ml (* metahelloworld.ml *) open Llvm open Llvm_bitwriter let _ = let filename