Home | History | Annotate | Download | only in target
      1 (*===-- llvm_target.ml - LLVM Ocaml Interface ------------------*- OCaml -*-===*
      2  *
      3  *                     The LLVM Compiler Infrastructure
      4  *
      5  * This file is distributed under the University of Illinois Open Source
      6  * License. See LICENSE.TXT for details.
      7  *
      8  *===----------------------------------------------------------------------===*)
      9 
     10 module Endian = struct
     11   type t =
     12   | Big
     13   | Little
     14 end
     15 
     16 module TargetData = struct
     17   type t
     18 
     19   external create : string -> t = "llvm_targetdata_create"
     20   external add : t -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
     21                = "llvm_targetdata_add"
     22   external as_string : t -> string = "llvm_targetdata_as_string"
     23   external invalidate_struct_layout : t -> Llvm.lltype -> unit
     24                                     = "llvm_targetdata_invalidate_struct_layout"
     25   external dispose : t -> unit = "llvm_targetdata_dispose"
     26 end
     27 
     28 external byte_order : TargetData.t -> Endian.t = "llvm_byte_order"
     29 external pointer_size : TargetData.t -> int = "llvm_pointer_size"
     30 external intptr_type : TargetData.t -> Llvm.lltype = "LLVMIntPtrType"
     31 external size_in_bits : TargetData.t -> Llvm.lltype -> Int64.t
     32                       = "llvm_size_in_bits"
     33 external store_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
     34 external abi_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
     35 external abi_align : TargetData.t -> Llvm.lltype -> int = "llvm_abi_align"
     36 external stack_align : TargetData.t -> Llvm.lltype -> int = "llvm_stack_align"
     37 external preferred_align : TargetData.t -> Llvm.lltype -> int
     38                          = "llvm_preferred_align"
     39 external preferred_align_of_global : TargetData.t -> Llvm.llvalue -> int
     40                                    = "llvm_preferred_align_of_global"
     41 external element_at_offset : TargetData.t -> Llvm.lltype -> Int64.t -> int
     42                            = "llvm_element_at_offset"
     43 external offset_of_element : TargetData.t -> Llvm.lltype -> int -> Int64.t
     44                            = "llvm_offset_of_element"
     45