1 (* RUN: %ocamlopt -warn-error A llvm.cmxa llvm_target.cmxa %s -o %t
6 (* Note: It takes several seconds for ocamlopt to link an executable with
7 libLLVMCore.a, so it's better to write a big test than a bunch of
14 let context = global_context ()
15 let i32_type = Llvm.i32_type context
16 let i64_type = Llvm.i64_type context
18 (* Tiny unit test framework - really just to help find which line is busted *)
19 let print_checkpoints = false
22 if print_checkpoints then
23 prerr_endline (name ^ ":");
27 (*===-- Fixture -----------------------------------------------------------===*)
29 let filename = Sys.argv.(1)
30 let m = create_module context filename
33 (*===-- Target Data -------------------------------------------------------===*)
35 let test_target_data () =
36 let td = DataLayout.create (target_triple m) in
37 let sty = struct_type context [| i32_type; i64_type |] in
39 ignore (DataLayout.as_string td);
40 ignore (byte_order td);
41 ignore (pointer_size td);
42 ignore (intptr_type td);
43 ignore (size_in_bits td sty);
44 ignore (store_size td sty);
45 ignore (abi_size td sty);
46 ignore (stack_align td sty);
47 ignore (preferred_align td sty);
48 ignore (preferred_align_of_global td (declare_global sty "g" m));
49 ignore (element_at_offset td sty (Int64.of_int 1));
50 ignore (offset_of_element td sty 1);
55 (*===-- Driver ------------------------------------------------------------===*)
58 suite "target data" test_target_data;