Displaying 15 results from an estimated 15 matches for "write_bitcode_fil".
Did you mean:
write_bitcode_file
2007 Oct 02
2
[LLVMdev] OCaml Install Error
...e in
let str = build_gep greeting [| zero; zero |] "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"...
2007 Nov 25
2
[LLVMdev] Fibonacci example in OCaml
...let main = define_function "main" (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....
2008 Dec 14
1
[LLVMdev] Tail calls from OCaml
How do you get a tail call using the OCaml's LLVM API?
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
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
...ot;%d\n") [| int 0; int 0 |] "int_spec" 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 d...
2007 Oct 19
0
[LLVMdev] OCaml Install Error
...[| zero; zero |] "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...
2007 Sep 14
0
[LLVMdev] C interface
...implemented in ocaml, so the info on stdout
> shows that make_*_type 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*
&g...
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
...in
(* string_of_lltype is implemented in ocaml, so the info on stdout
shows that make_*_type 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...
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
...quot;) [| int 0; int 0 |] "int_spec" 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/li...
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
...= build_gep greeting [| zero; zero |] "tmp" 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
$ ll...