xref: /minix3/external/bsd/llvm/dist/llvm/bindings/ocaml/analysis/llvm_analysis.mli (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc(*===-- llvm_analysis.mli - LLVM OCaml Interface --------------*- OCaml -*-===*
2f4a2713aSLionel Sambuc *
3f4a2713aSLionel Sambuc *                     The LLVM Compiler Infrastructure
4f4a2713aSLionel Sambuc *
5f4a2713aSLionel Sambuc * This file is distributed under the University of Illinois Open Source
6f4a2713aSLionel Sambuc * License. See LICENSE.TXT for details.
7f4a2713aSLionel Sambuc *
8f4a2713aSLionel Sambuc *===----------------------------------------------------------------------===*)
9f4a2713aSLionel Sambuc
10f4a2713aSLionel Sambuc(** Intermediate representation analysis.
11f4a2713aSLionel Sambuc
12f4a2713aSLionel Sambuc    This interface provides an OCaml API for LLVM IR analyses, the classes in
13f4a2713aSLionel Sambuc    the Analysis library. *)
14f4a2713aSLionel Sambuc
15f4a2713aSLionel Sambuc(** [verify_module m] returns [None] if the module [m] is valid, and
16f4a2713aSLionel Sambuc    [Some reason] if it is invalid. [reason] is a string containing a
17f4a2713aSLionel Sambuc    human-readable validation report. See [llvm::verifyModule]. *)
18f4a2713aSLionel Sambucexternal verify_module : Llvm.llmodule -> string option = "llvm_verify_module"
19f4a2713aSLionel Sambuc
20f4a2713aSLionel Sambuc(** [verify_function f] returns [None] if the function [f] is valid, and
21f4a2713aSLionel Sambuc    [Some reason] if it is invalid. [reason] is a string containing a
22f4a2713aSLionel Sambuc    human-readable validation report. See [llvm::verifyFunction]. *)
23f4a2713aSLionel Sambucexternal verify_function : Llvm.llvalue -> bool = "llvm_verify_function"
24f4a2713aSLionel Sambuc
25f4a2713aSLionel Sambuc(** [verify_module m] returns if the module [m] is valid, but prints a
26f4a2713aSLionel Sambuc    validation report to [stderr] and aborts the program if it is invalid. See
27f4a2713aSLionel Sambuc    [llvm::verifyModule]. *)
28f4a2713aSLionel Sambucexternal assert_valid_module : Llvm.llmodule -> unit
29f4a2713aSLionel Sambuc                             = "llvm_assert_valid_module"
30f4a2713aSLionel Sambuc
31f4a2713aSLionel Sambuc(** [verify_function f] returns if the function [f] is valid, but prints a
32f4a2713aSLionel Sambuc    validation report to [stderr] and aborts the program if it is invalid. See
33f4a2713aSLionel Sambuc    [llvm::verifyFunction]. *)
34f4a2713aSLionel Sambucexternal assert_valid_function : Llvm.llvalue -> unit
35f4a2713aSLionel Sambuc                               = "llvm_assert_valid_function"
36f4a2713aSLionel Sambuc
37f4a2713aSLionel Sambuc(** [view_function_cfg f] opens up a ghostscript window displaying the CFG of
38f4a2713aSLionel Sambuc    the current function with the code for each basic block inside.
39f4a2713aSLionel Sambuc    See [llvm::Function::viewCFG]. *)
40f4a2713aSLionel Sambucexternal view_function_cfg : Llvm.llvalue -> unit = "llvm_view_function_cfg"
41f4a2713aSLionel Sambuc
42f4a2713aSLionel Sambuc(** [view_function_cfg_only f] works just like [view_function_cfg], but does not
43f4a2713aSLionel Sambuc    include the contents of basic blocks into the nodes.
44f4a2713aSLionel Sambuc    See [llvm::Function::viewCFGOnly]. *)
45f4a2713aSLionel Sambucexternal view_function_cfg_only : Llvm.llvalue -> unit
46f4a2713aSLionel Sambuc                                = "llvm_view_function_cfg_only"
47