Displaying 15 results from an estimated 15 matches for "i8_type".
Did you mean:
d_type
2007 Nov 25
2
[LLVMdev] How to declare and use sprintf
...claration 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 i8_type) [| pointer_type i8_type;
pointer_type i8_type;
i32_type |]) m in
which gives:
declare i8* @sprintf(i8*, i8*, i32)
What is the correct way to do this?
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e
2007 Nov 26
0
[LLVMdev] How to declare and use sprintf
...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 = pointer_type i8_type in
var_arg_function_type sp [| sp; sp |]
— Gordon
2007 Nov 26
1
[LLVMdev] How to declare and use sprintf
On Monday 26 November 2007 00:40, Gordon Henriksen wrote:
> The type you want is:
>
> let sp = pointer_type i8_type in
> var_arg_function_type sp [| sp; sp |]
Awesome stuff. Here is my most elegant Fibonacci example in OCaml so far:
open Llvm
let ( |> ) x f = f x
let int n = const_int i32_type n
let return b x = build_ret x b |> ignore
let build_fib m =
let ty = function_type i32_type [| i32...
2007 Oct 02
2
[LLVMdev] OCaml Install Error
...l "greeting" (make_string_constant
"Hello, world!" true) m in
(* declare i32 @puts(i8*) *)
let puts = declare_function "puts" (make_function_type i32_type [|
make_pointer_type i8_type |]
false) m in
(* define i32 @main() {
entry: *)
let main = define_function "main" (make_function_type
i32_type [| |] false) m in
let at_entry = builder_at_end (entry_block main) in
(* %tmp = getelementptr [14 x i...
2007 Nov 25
2
[LLVMdev] Fibonacci example in OCaml
...ot;fibx2" recurseb in
let sum = build_add callfibx1 callfibx2 "addresult" recurseb in
build_ret sum recurseb;
fibf
let main filename =
let m = create_module filename in
let puts =
declare_function "puts"
(function_type i32_type [|pointer_type i8_type|]) m in
let fib = build_fib m in
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...
2007 Dec 23
0
[LLVMdev] Ocaml JIT example
...reeting = global [14 x i8] c"Hello, world!\00" *)
let greeting = define_global "greeting" (const_stringz "Hello,
world!") m in
(* declare i32 @puts(i8* ) *)
let puts = declare_function "puts"
(function_type i32_type [| pointer_type i8_type |]) m in
(* define i32 @main() {
entry: *)
let main = define_function "main" (function_type i32_type [| |]) m in
let at_entry = builder_at_end (entry_block main) in
(* %tmp = getelementptr [14 x i8]* @greeting, i32 0, i32 0 *)
let zero = const_int i32_t...
2007 Oct 19
0
[LLVMdev] OCaml Install Error
...e_string_constant
> "Hello, world!" true)
> m in
>
> (* declare i32 @puts(i8*) *)
> let puts = declare_function "puts" (make_function_type i32_type [|
> make_pointer_type i8_type
> |] false) m in
>
> (* define i32 @main() {
> entry: *)
> let main = define_function "main" (make_function_type
> i32_type [| |] false) m in
> let at_entry = builder_at_end (entry_block main) in
>
&...
2007 Sep 14
0
[LLVMdev] C interface
...ppc_fp128_type ()
> |] true);
> make_pointer_type
> (make_struct_type [| make_integer_type 1;
> make_integer_type 3;
> i8_type ();
> i32_type () |] false);
> make_pointer_type
> (make_array_type (make_opaque_type ()) 4) |]
> false) in
>
> (* string_of_lltype is implemented in...
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
...ppc_fp128_type ()
|] true);
make_pointer_type
(make_struct_type [| make_integer_type 1;
make_integer_type 3;
i8_type ();
i32_type () |]
false);
make_pointer_type
(make_array_type (make_opaque_type ())
4) |]
false) in
(* string_of_lltype is implemented in ocaml, so the info...
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
...:: (f, fn) :: vars in
let body, state =
expr { fn = fn; blk = entry_block fn; vars = vars' } body in
build_ret body (bb state) |> ignore;
(f, fn) :: vars
let int n = const_int i32_type n
let main filename =
let m = create_module filename in
let string = pointer_type i8_type in
let print =
declare_function "printf" (var_arg_function_type i32_type [|string|]) m in
let main = define_function "main" (function_type i32_type [| |]) m in
let blk = entry_block main in
let bb = builder_at_end blk in
let str s = define_global "buf"...
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
...eeting = global [14 x i8] c"Hello, world!\00" *)
let greeting =
define_global "greeting" (const_string "Hello, world!\000") m in
(* declare i32 @puts(i8* ) *)
let puts =
declare_function "puts"
(function_type i32_type [|pointer_type i8_type|]) m in
(* define i32 @main() { entry: *)
let main = define_function "main" (function_type i32_type [| |]) m in
let at_entry = builder_at_end (entry_block main) in
(* %tmp = getelementptr [14 x i8]* @greeting, i32 0, i32 0 *)
let zero = const_int i32_type 0 in
let s...