llvm.org GIT mirror llvm / 12c0e3a
Silence warnings in OCaml bindings * LLVMDisposeMessage lives in llvm-c/Core.h, include this file where necessary * LLVMAddTargetData has been removed, follow suit in the bindings Differential Revision: http://reviews.llvm.org/D18633 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265001 91177308-0d34-0410-b5e6-96231b3b80d8 Jeroen Ketema 4 years ago
6 changed file(s) with 4 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
1414 |* *|
1515 \*===----------------------------------------------------------------------===*/
1616
17 #include "llvm-c/Core.h"
1718 #include "llvm-c/Analysis.h"
1819 #include "caml/alloc.h"
1920 #include "caml/mlvalues.h"
1616
1717 #include
1818 #include
19 #include "llvm-c/Core.h"
1920 #include "llvm-c/ExecutionEngine.h"
2021 #include "llvm-c/Target.h"
2122 #include "caml/alloc.h"
5353
5454 external of_string : string -> t = "llvm_datalayout_of_string"
5555 external as_string : t -> string = "llvm_datalayout_as_string"
56 external add_to_pass_manager : [
57 Llvm.PassManager.t -> t -> unit
58 = "llvm_datalayout_add_to_pass_manager"
5956 external byte_order : t -> Endian.t = "llvm_datalayout_byte_order"
6057 external pointer_size : t -> int = "llvm_datalayout_pointer_size"
6158 external intptr_type : Llvm.llcontext -> t -> Llvm.lltype
6666 See the method [llvm::DataLayout::getStringRepresentation]. *)
6767 val as_string : t -> string
6868
69 (** [add_to_pass_manager pm dl] adds the data layout [dl] to
70 the pass manager [pm].
71 See the method [llvm::PassManagerBase::add]. *)
72 val add_to_pass_manager : [
73 t -> unit
74
7569 (** Returns the byte order of a target, either [Endian.Big] or
7670 [Endian.Little].
7771 See the method [llvm::DataLayout::isLittleEndian]. *)
1414 |* *|
1515 \*===----------------------------------------------------------------------===*/
1616
17 #include "llvm-c/Core.h"
1718 #include "llvm-c/Target.h"
1819 #include "llvm-c/TargetMachine.h"
1920 #include "caml/alloc.h"
6162 value Copy = copy_string(StringRep);
6263 LLVMDisposeMessage(StringRep);
6364 return Copy;
64 }
65
66 /* [ DataLayout.t -> unit */
67 CAMLprim value llvm_datalayout_add_to_pass_manager(LLVMPassManagerRef PM,
68 value DL) {
69 LLVMAddTargetData(DataLayout_val(DL), PM);
70 return Val_unit;
7165 }
7266
7367 /* DataLayout.t -> Endian.t */
5757 assert_equal (DL.preferred_align sty dl) 8;
5858 assert_equal (DL.preferred_align_of_global (declare_global sty "g" m) dl) 8;
5959 assert_equal (DL.element_at_offset sty (Int64.of_int 1) dl) 0;
60 assert_equal (DL.offset_of_element sty 1 dl) (Int64.of_int 4);
61
62 let pm = PassManager.create () in
63 ignore (DL.add_to_pass_manager pm dl)
60 assert_equal (DL.offset_of_element sty 1 dl) (Int64.of_int 4)
6461
6562
6663 (*===-- Target ------------------------------------------------------------===*)