pass machinemoduleinfo down into getSymbolForDwarfGlobalReference,
[llvm/avr.git] / test / Bindings / Ocaml / target.ml
blob3c3b7339fef87337b9deb17bf25afdd8f4cd423e
1 (* RUN: %ocamlopt -warn-error A llvm.cmxa llvm_target.cmxa %s -o %t
2 *)
4 (* Note: It takes several seconds for ocamlopt to link an executable with
5 libLLVMCore.a, so it's better to write a big test than a bunch of
6 little ones. *)
8 open Llvm
9 open Llvm_target
11 let context = global_context ()
12 let i32_type = Llvm.i32_type context
13 let i64_type = Llvm.i64_type context
15 (* Tiny unit test framework - really just to help find which line is busted *)
16 let suite name f =
17 prerr_endline (name ^ ":");
18 f ()
21 (*===-- Fixture -----------------------------------------------------------===*)
23 let filename = Sys.argv.(1)
24 let m = create_module context filename
27 (*===-- Target Data -------------------------------------------------------===*)
29 let test_target_data () =
30 let td = TargetData.create (target_triple m) in
31 let sty = struct_type context [| i32_type; i64_type |] in
33 ignore (TargetData.as_string td);
34 ignore (TargetData.invalidate_struct_layout td sty);
35 ignore (byte_order td);
36 ignore (pointer_size td);
37 ignore (intptr_type td);
38 ignore (size_in_bits td sty);
39 ignore (store_size td sty);
40 ignore (abi_size td sty);
41 ignore (stack_align td sty);
42 ignore (preferred_align td sty);
43 ignore (preferred_align_of_global td (declare_global sty "g" m));
44 ignore (element_at_offset td sty (Int64.of_int 1));
45 ignore (offset_of_element td sty 1);
47 TargetData.dispose td
50 (*===-- Driver ------------------------------------------------------------===*)
52 let _ =
53 suite "target data" test_target_data;
54 dispose_module m