1 (* RUN: %ocamlc -warn-error A llvm.cma llvm_target.cma %s -o %t
4 (* Note: It takes several seconds for ocamlc to link an executable with
5 libLLVMCore.a, so it's better to write a big test than a bunch of
12 (* Tiny unit test framework - really just to help find which line is busted *)
14 prerr_endline (name ^ ":");
18 (*===-- Fixture -----------------------------------------------------------===*)
20 let filename = Sys.argv.(1)
21 let m = create_module filename
24 (*===-- Target Data -------------------------------------------------------===*)
26 let test_target_data () =
27 let td = TargetData.create (target_triple m) in
28 let sty = struct_type [| i32_type; i64_type |] in
30 ignore (TargetData.as_string td);
31 ignore (TargetData.invalidate_struct_layout td sty);
32 ignore (byte_order td);
33 ignore (pointer_size td);
34 ignore (intptr_type td);
35 ignore (size_in_bits td sty);
36 ignore (store_size td sty);
37 ignore (abi_size td sty);
38 ignore (stack_align td sty);
39 ignore (preferred_align td sty);
40 ignore (preferred_align_of_global td (declare_global sty "g" m));
41 ignore (element_at_offset td sty (Int64.of_int 1));
42 ignore (offset_of_element td sty 1);
47 (*===-- Driver ------------------------------------------------------------===*)
50 suite "target data" test_target_data;