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 (** [of_string rep] parses the data layout string representation [rep].
25 See the constructor [llvm::DataLayout::DataLayout]. *)
26 val of_string : string -> t
28 (** [as_string dl] is the string representation of the data layout [dl].
29 See the method [llvm::DataLayout::getStringRepresentation]. *)
30 val as_string : t -> string
32 (** [add_to_pass_manager dl pm] adds the target data [dl] to
33 the pass manager [pm].
34 See the method [llvm::PassManagerBase::add]. *)
35 val add_to_pass_manager : [<Llvm.PassManager.any] Llvm.PassManager.t ->
38 (** Returns the byte order of a target, either [Endian.Big] or
40 See the method [llvm::DataLayout::isLittleEndian]. *)
41 val byte_order : t -> Endian.t
43 (** Returns the pointer size in bytes for a target.
44 See the method [llvm::DataLayout::getPointerSize]. *)
45 val pointer_size : t -> int
47 (** Returns the integer type that is the same size as a pointer on a target.
48 See the method [llvm::DataLayout::getIntPtrType]. *)
49 val intptr_type : Llvm.llcontext -> t -> Llvm.lltype
51 (** Returns the pointer size in bytes for a target in a given address space.
52 See the method [llvm::DataLayout::getPointerSize]. *)
53 val qualified_pointer_size : int -> t -> int
55 (** Returns the integer type that is the same size as a pointer on a target
56 in a given address space.
57 See the method [llvm::DataLayout::getIntPtrType]. *)
58 val qualified_intptr_type : Llvm.llcontext -> int -> t -> Llvm.lltype
60 (** Computes the size of a type in bits for a target.
61 See the method [llvm::DataLayout::getTypeSizeInBits]. *)
62 val size_in_bits : Llvm.lltype -> t -> Int64.t
64 (** Computes the storage size of a type in bytes for a target.
65 See the method [llvm::DataLayout::getTypeStoreSize]. *)
66 val store_size : Llvm.lltype -> t -> Int64.t
68 (** Computes the ABI size of a type in bytes for a target.
69 See the method [llvm::DataLayout::getTypeAllocSize]. *)
70 val abi_size : Llvm.lltype -> t -> Int64.t
72 (** Computes the ABI alignment of a type in bytes for a target.
73 See the method [llvm::DataLayout::getTypeABISize]. *)
74 val abi_align : Llvm.lltype -> t -> int
76 (** Computes the call frame alignment of a type in bytes for a target.
77 See the method [llvm::DataLayout::getTypeABISize]. *)
78 val stack_align : Llvm.lltype -> t -> int
80 (** Computes the preferred alignment of a type in bytes for a target.
81 See the method [llvm::DataLayout::getTypeABISize]. *)
82 val preferred_align : Llvm.lltype -> t -> int
84 (** Computes the preferred alignment of a global variable in bytes for
85 a target. See the method [llvm::DataLayout::getPreferredAlignment]. *)
86 val preferred_align_of_global : Llvm.llvalue -> t -> int
88 (** Computes the structure element that contains the byte offset for a target.
89 See the method [llvm::StructLayout::getElementContainingOffset]. *)
90 val element_at_offset : Llvm.lltype -> Int64.t -> t -> int
92 (** Computes the byte offset of the indexed struct element for a target.
93 See the method [llvm::StructLayout::getElementContainingOffset]. *)
94 val offset_of_element : Llvm.lltype -> int -> t -> Int64.t