Source

TyLLVM / LLVM.mli

type link_type = [
  | `Private
  | `Linker_private
  | `Linker_private_weak
  | `Internal
  | `Available_externally (* only allowed on definitions, not declarations *)
  | `Linkonce
  | `Weak
  | `Common
  | `Appending
  | `Extern_weak
  | `Linkonce_odr
  | `Weak_odr
  | `Linkonce_odr_auto_hide
  | `External
  | `Dllimport
  | `Dllexport
  ]

type data_type =
  | Int of int
  | Array of int * data_type
  | Pointer of data_type
  | Pointer_function of data_type array * data_type

type address =
  | Addrspace of int
  | Unnamed_addr
  | None_addr

type thread_local =
  | Localdynamic
  | Initialexec
  | Localexec

type calling_convention =
  | CCC
  | FastCC
  | ColdCC
  | CC of int

type visibility =
  | Default
  | Hidden
  | Protected

type function_attribute =
  | Alignstack of int
  | Alwaysinline
  | Cold
  | Nonlazybind
  | Inlinehint
  | Naked
  | Nobuiltin
  | Noduplicate
  | Noimplicitefloat
  | Noinline
  | Noredzone
  | Noreturn
  | Nounwind
  | Optsize
  | Readnone
  | Readonly
  | Returns_twice
  | Sanitize_address
  | Sanitize_memory
  | Sanitize_thread
  | Ssp
  | Sspreq
  | Sspstrong
  | Uwtable

type instr =
  | Ret

type context_module =
  | Global of
    (string * thread_local option *
    address * link_type option * bool *
    data_type * string option * int option)
  | Declaration of
    (data_type * string * data_type array *
    [`External | `Dllimport | `Extern_weak ] option)
  | Definition of
    ((data_type * string * data_type array) * instr list)

(*
 *  Global:
 *    - identifier
 *    - may be defined as thread_local
 *    - can be marked with unnamed_address | may be declared to reside in a
 *      target-specific numbered address space
 *    - have one of types of linkage
 *    - may be defined as a global constant
 *    - may optionally be initialized (not present)
 *    - may have an explicit section to be placed in
 *    - may have an optional explicit alignment specified (power of 2)
 *)

(*
 * Function declaration:
 *    - it is illegal for a function declaration to have any linkage type
 *      other than external, dllimport or extern_weak
 *    - function attribute
 *)

val new_global:
  ?thread_local:thread_local option ->
  ?address: address ->
  ?link_type: link_type option ->
  ?constant: bool ->
  ?section: string option ->
  ?alignment: int option ->
  string -> data_type -> context_module

val new_declaration:
  ?link_type: [< `External | `Dllimport | `Extern_weak ] option ->
  data_type -> string -> data_type array -> context_module

val new_definition:
  data_type -> string -> data_type array -> instr list -> context_module

val print_context_module: context_module -> unit
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.