search for: value_ty

Displaying 5 results from an estimated 5 matches for "value_ty".

Did you mean: value_r
2011 Apr 06
2
[LLVMdev] Target independency using "opaque"? How to do it else?
...the "opaque" to either i64 or i32, depending on which target I'm using. For example I currently have ; these opaque types are replaced at load time by codegen::RuntimeLib %sizet_ty = type opaque %intptrt_ty = type opaque ; ... then in a function I do: %sizeof_value_ty = ptrtoint %value_ty* getelementptr (%value_ty* null, i32 1) to i32 %numBytesToAlloc = mul i32 %num, %sizeof_value_ty %numBytesSizeT = bitcast i32 %numBytesToAlloc to %sizet_ty %memory = call i8* @malloc(%sizet_ty %numBytesSizeT) However, it always fails to compile this li-file to bitcod...
2007 Nov 26
2
[LLVMdev] Fibonacci example in OCaml
...tagged object model (and it does have some nice properties), you'll want to slam every value to some generic value type and use lots of bitcasts. The value type is either the native integer (i32 or i64 depending on target) or a pointer type, probably the recursive pointer type: let value_ty = let temp_ty = opaque_type () in let h = handle_to_type temp_ty in refine_type temp_ty (pointer_type temp_ty); type_of_handle h Since LLVM does not have an intptr type, you'd need to know your target and parameterize your codegen accordingly to use the integer types....
2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
...(and it does have some > nice properties), you'll want to slam every value to some generic > value type and use lots of bitcasts. The value type is either the > native integer (i32 or i64 depending on target) or a pointer type, > probably the recursive pointer type: > > let value_ty = > let temp_ty = opaque_type () in > let h = handle_to_type temp_ty in > refine_type temp_ty (pointer_type temp_ty); > type_of_handle h > > Since LLVM does not have an intptr type, you'd need to know your > target and parameterize your codegen according...
2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
Here is a complete 104-line native code compiler for a tiny subset of OCaml that is expressive enough to compile an external Fibonacci program: type expr = | Int of int | Var of string | BinOp of [ `Add | `Sub | `Leq ] * expr * expr | If of expr * expr * expr | Apply of expr * expr type defn = | LetRec of string * string * expr open Camlp4.PreCast;; let expr = Gram.Entry.mk
2007 Nov 25
2
[LLVMdev] Fibonacci example in OCaml
Here's my translation of the Fibonacci example into OCaml: open Printf open Llvm let build_fib m = let fibf = define_function "fib" (function_type i32_type [| i32_type |]) m in let bb = builder_at_end (entry_block fibf) in let one = const_int i32_type 1 and two = const_int i32_type 2 in let argx = param fibf 0 in set_value_name "AnArg" argx; let