1 (*===-- llvm_target.mli - LLVM OCaml Interface -----------------*- OCaml -*-===*
3 * The LLVM Compiler Infrastructure
5 * This file is distributed under the University of Illinois Open Source
6 * License. See LICENSE.TXT for details.
8 *===----------------------------------------------------------------------===*)
10 (** Target Information.
12 This interface provides an OCaml API for LLVM target information,
13 the classes in the Target library. *)
21 module DataLayout : sig
24 (** [DataLayout.create rep] parses the target data string representation [rep].
25 See the constructor llvm::DataLayout::DataLayout. *)
26 external create : string -> t = "llvm_targetdata_create"
28 (** [add_target_data td pm] adds the target data [td] to the pass manager [pm].
29 Does not take ownership of the target data.
30 See the method llvm::PassManagerBase::add. *)
31 external add : t -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
32 = "llvm_targetdata_add"
34 (** [as_string td] is the string representation of the target data [td].
35 See the constructor llvm::DataLayout::DataLayout. *)
36 external as_string : t -> string = "llvm_targetdata_as_string"
39 (** Returns the byte order of a target, either LLVMBigEndian or
41 See the method llvm::DataLayout::isLittleEndian. *)
42 external byte_order : DataLayout.t -> Endian.t = "llvm_byte_order"
44 (** Returns the pointer size in bytes for a target.
45 See the method llvm::DataLayout::getPointerSize. *)
46 external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
48 (** Returns the integer type that is the same size as a pointer on a target.
49 See the method llvm::DataLayout::getIntPtrType. *)
50 external intptr_type : DataLayout.t -> Llvm.llcontext -> Llvm.lltype
53 (** Computes the size of a type in bits for a target.
54 See the method llvm::DataLayout::getTypeSizeInBits. *)
55 external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
58 (** Computes the storage size of a type in bytes for a target.
59 See the method llvm::DataLayout::getTypeStoreSize. *)
60 external store_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
62 (** Computes the ABI size of a type in bytes for a target.
63 See the method llvm::DataLayout::getTypeAllocSize. *)
64 external abi_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
66 (** Computes the ABI alignment of a type in bytes for a target.
67 See the method llvm::DataLayout::getTypeABISize. *)
68 external abi_align : DataLayout.t -> Llvm.lltype -> int = "llvm_abi_align"
70 (** Computes the call frame alignment of a type in bytes for a target.
71 See the method llvm::DataLayout::getTypeABISize. *)
72 external stack_align : DataLayout.t -> Llvm.lltype -> int = "llvm_stack_align"
74 (** Computes the preferred alignment of a type in bytes for a target.
75 See the method llvm::DataLayout::getTypeABISize. *)
76 external preferred_align : DataLayout.t -> Llvm.lltype -> int
77 = "llvm_preferred_align"
79 (** Computes the preferred alignment of a global variable in bytes for a target.
80 See the method llvm::DataLayout::getPreferredAlignment. *)
81 external preferred_align_of_global : DataLayout.t -> Llvm.llvalue -> int
82 = "llvm_preferred_align_of_global"
84 (** Computes the structure element that contains the byte offset for a target.
85 See the method llvm::StructLayout::getElementContainingOffset. *)
86 external element_at_offset : DataLayout.t -> Llvm.lltype -> Int64.t -> int
87 = "llvm_element_at_offset"
89 (** Computes the byte offset of the indexed struct element for a target.
90 See the method llvm::StructLayout::getElementContainingOffset. *)
91 external offset_of_element : DataLayout.t -> Llvm.lltype -> int -> Int64.t
92 = "llvm_offset_of_element"