1 (* RUN: %ocamlopt -warn-error A llvm.cmxa llvm_target.cmxa %s -o %t
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
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 *)
17 prerr_endline
(name ^
":");
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);
50 (*===-- Driver ------------------------------------------------------------===*)
53 suite "target data" test_target_data;