Implement bswap
[llvm/msp430.git] / test / Bindings / Ocaml / target.ml
blobe6d08ed6db754c3817bb92b606157cb1d051ec0a
1 (* RUN: %ocamlc -warn-error A llvm.cma llvm_target.cma %s -o %t 2> /dev/null
2 *)
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
6 little ones. *)
8 open Llvm
9 open Llvm_target
12 (* Tiny unit test framework - really just to help find which line is busted *)
13 let suite name f =
14 prerr_endline (name ^ ":");
15 f ()
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);
44 TargetData.dispose td
47 (*===-- Driver ------------------------------------------------------------===*)
49 let _ =
50 suite "target data" test_target_data;
51 dispose_module m