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 = TargetData.create
(target_triple
m) in
37 let sty = struct_type
context [| i32_type; i64_type |] in
39 ignore
(TargetData.as_string
td);
40 ignore
(TargetData.invalidate_struct_layout
td sty);
41 ignore
(byte_order
td);
42 ignore
(pointer_size
td);
43 ignore
(intptr_type
td);
44 ignore
(size_in_bits
td sty);
45 ignore
(store_size
td sty);
46 ignore
(abi_size
td sty);
47 ignore
(stack_align
td sty);
48 ignore
(preferred_align
td sty);
49 ignore
(preferred_align_of_global
td (declare_global
sty "g" m));
50 ignore
(element_at_offset
td sty (Int64.of_int
1));
51 ignore
(offset_of_element
td sty 1);
56 (*===-- Driver ------------------------------------------------------------===*)
59 suite "target data" test_target_data;