Displaying 15 results from an estimated 15 matches for "dispose_module".
2010 Feb 16
1
[LLVMdev] LLVM+OCaml Bindings for the latest LLVM is slower than 2.6
LLVM-2.6 takes 3s from OCamlbuild, but the lastest LLVM (I am using
r95712) takes 34s. I attached the code.
But the new LLVM fixed a problem of dispose_module in 2.6.
I got this error in 2.6, but the new LLVM works well.
While deleting: [14 x i8]* %greeting
An asserting value handle still pointed to this value!
UNREACHABLE executed at
/mnt/eclipse/acg/users/jianzhou/download/llvm-2.6/lib/VMCore/Value.cpp:492!
Aborted
I had some problem to debug assert...
2007 Oct 02
2
[LLVMdev] OCaml Install Error
...ero |] "tmp" at_entry in
(* call i32 @puts( i8* %tmp ) *)
ignore (build_call puts [| str |] "" at_entry);
(* ret void *)
ignore (build_ret (make_null i32_type) at_entry);
(* write the module to a file *)
if not (write_bitcode_file m filename) then exit 1;
dispose_module m
$ ocamlopt -cc g++ llvm.cmxa llvm_bitwriter.cmxa -o metahelloworld
metahelloworld.ml
$ ./metahelloworld helloworld.bc
$ llvm-dis < helloworld.bc
; ModuleID = '<stdin>'
@greeting = global [14 x i8] c"Hello, world!\00" ; <
[14 x i8]*> [#uses=1]
d...
2007 Nov 25
2
[LLVMdev] Fibonacci example in OCaml
...function_type i32_type [| |]) m in
let at_entry = builder_at_end (entry_block main) in
let n = build_call fib [| const_int i32_type 40 |] "" at_entry in
ignore (build_ret (const_null i32_type) at_entry);
if not (Llvm_bitwriter.write_bitcode_file m filename) then exit 1;
dispose_module m
let () = match Sys.argv with
| [|_; filename|] -> main filename
| _ as a -> eprintf "Usage: %s <file>\n" a.(0)
I'd appreciate it if someone could gloss over this and let me know if I'm
going in the correct direction. Also, I have a really stupid question: what...
2007 Nov 26
0
[LLVMdev] How to declare and use sprintf
On Nov 25, 2007, at 18:53, Jon Harrop wrote:
> So my Fib program is segfaulting and I'm not sure why. I think it
> might be because my declaration and use of sprintf is wrong.
>
> I notice llvm-gcc produces declarations containing "..." like:
>
> declare int %printf(sbyte*, ...)
>
> What is the correct way to do this?
The type you want is:
let sp =
2007 Nov 25
2
[LLVMdev] How to declare and use sprintf
So my Fib program is segfaulting and I'm not sure why. I think it might be
because my declaration and use of sprintf is wrong.
I notice llvm-gcc produces declarations containing "..." like:
declare int %printf(sbyte*, ...)
but I'm not sure how to do this so I've used:
let sprintf =
declare_function "sprintf"
(function_type (pointer_type
2007 Nov 26
1
[LLVMdev] How to declare and use sprintf
...c" main in
let n = build_call (build_fib m) [| const_int i32_type 40 |] "" main in
let _ = build_call printf [| int_spec; n |] "" main in
build_ret (const_null i32_type) main |> ignore;
if not (Llvm_bitwriter.write_bitcode_file m filename) then exit 1;
dispose_module m
let () = match Sys.argv with
| [|_; filename|] -> main filename
| _ as a -> Printf.eprintf "Usage: %s <file>\n" a.(0)
as you can see it already uses some functional features. Next, I'll move the
hard-coded program into data and write a more generic compiler in it....
2007 Oct 19
0
[LLVMdev] OCaml Install Error
...> (* call i32 @puts( i8* %tmp ) *)
> ignore (build_call puts [| str |] "" at_entry);
>
> (* ret void *)
> ignore (build_ret (make_null i32_type) at_entry);
>
> (* write the module to a file *)
> if not (write_bitcode_file m filename) then exit 1;
> dispose_module m
>
> $ ocamlopt -cc g++ llvm.cmxa llvm_bitwriter.cmxa -o metahelloworld
> metahelloworld.ml
> $ ./metahelloworld helloworld.bc
> $ llvm-dis < helloworld.bc
> ; ModuleID = '<stdin>'
> @greeting = global [14 x i8] c"Hello, world!\00" ;...
2007 Sep 14
0
[LLVMdev] C interface
...rface. *)
> print_endline ("big_fn_ty = " ^ (string_of_lltype big_fn_ty));
>
> ignore(add_type_name m "big_fn_ty" big_fn_ty);
>
> if not (write_bitcode_file m filename)
> then print_endline ("write failed: " ^ filename);
>
> dispose_module m
>
> let _ =
> if 2 = /Array./length /Sys./argv
> then emit_bc /Sys./argv.(1)
> else print_endline "Usage: emit_bc FILE"
>
> *$ make emit_bc*
> ocamlc -cc g++ -I ../llvm/Release/lib/ocaml llvm_ml.cma -o emit_bc
> emit_bc.ml
> *$ ./emit_bc test.bc...
2007 Oct 02
0
[LLVMdev] OCaml Install Error
Hi,
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?
greetings,
Jan
On 2. Okt 2007, at 12:22, Gordon Henriksen wrote:
> On 2007-10-02, at 03:19, Gordon Henriksen wrote:
>
>> On Oct 2, 2007, at 00:17, Bill Wendling wrote:
>>
2007 Sep 12
7
[LLVMdev] C interface
...pe isn't a write-once/read-never interface. *)
print_endline ("big_fn_ty = " ^ (string_of_lltype big_fn_ty));
ignore(add_type_name m "big_fn_ty" big_fn_ty);
if not (write_bitcode_file m filename)
then print_endline ("write failed: " ^ filename);
dispose_module m
let _ =
if 2 = Array.length Sys.argv
then emit_bc Sys.argv.(1)
else print_endline "Usage: emit_bc FILE"
$ make emit_bc
ocamlc -cc g++ -I ../llvm/Release/lib/ocaml llvm_ml.cma -o emit_bc
emit_bc.ml
$ ./emit_bc test.bc
big_fn_ty = void (< 4 x float >, { double, x86f...
2007 Oct 02
4
[LLVMdev] OCaml Install Error
On 2007-10-02, at 03:19, Gordon Henriksen wrote:
> On Oct 2, 2007, at 00:17, Bill Wendling wrote:
>
>> I get this error duing a "make install":
>>
>> llvm[3]: Installing Debug /usr/local/lib/ocaml/libllvm.a
>> install: /usr/local/lib/ocaml/libllvm.a: Permission denied
>> make[3]: *** [install-a] Error 71
>> make[2]: *** [install] Error 1
2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
...bb in
let vars = List.fold_left (defn m) [] program in
let n, _ = expr { fn = main; blk = blk; vars = vars } run in
build_call print [| int_spec; n |] "" bb |> ignore;
build_ret (int 0) bb |> ignore;
if not (Llvm_bitwriter.write_bitcode_file m filename) then exit 1;
dispose_module m
let () = match Sys.argv with
| [|_; filename|] -> main filename
| _ as a -> Printf.eprintf "Usage: %s <file>\n" a.(0)
Compile with:
$ ocamlc -dtypes -pp camlp4oof -I +camlp4 dynlink.cma camlp4lib.cma -cc
g++ -I /usr/local/lib/ocaml/ llvm.cma llvm_bitwriter.cma minml....
2007 Nov 25
0
[LLVMdev] OCaml
Jon,
On 2007-11-24, at 21:58, Jon Harrop wrote:
> I just took another look at the LLVM project and it has come along
> in leaps and bounds since I last looked. I've been working through
> the (awesome!) tutorial and am now really hyped about the project.
Excellent!
> I am particularly interested in using LLVM to write compilers for
> OCaml-like languages in OCaml-like
2007 Nov 25
9
[LLVMdev] OCaml
Hi!
I just took another look at the LLVM project and it has come along in leaps
and bounds since I last looked. I've been working through the (awesome!)
tutorial and am now really hyped about the project.
I am particularly interested in using LLVM to write compilers for OCaml-like
languages in OCaml-like languages. This requires some core functionality that
would be generically useful:
2007 Nov 25
5
[LLVMdev] OCaml
..." at_entry in
(* call i32 @puts( i8* %tmp ) *)
ignore (build_call puts [| str |] "" at_entry);
(* ret void *)
ignore (build_ret (const_null i32_type) at_entry);
(* write the module to a file *)
if not (Llvm_bitwriter.write_bitcode_file m filename) then exit 1;
dispose_module m
let () = match Sys.argv with
| [|_; filename|] -> main filename
| _ -> main "a.out"
To use it I just do:
$ ocamlopt -dtypes -cc g++ -I /usr/local/lib/ocaml/ llvm.cmxa
llvm_bitwriter.cmxa hellow.ml -o hellow
$ ./hellow run.bc
$ llc -f -march=c run.bc -o run.c
$ gcc run.c -o...