• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1(*===-- llvm_analysis.mli - 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(** Intermediate representation analysis.
11
12    This interface provides an OCaml API for LLVM IR analyses, the classes in
13    the Analysis library. *)
14
15(** [verify_module m] returns [None] if the module [m] is valid, and
16    [Some reason] if it is invalid. [reason] is a string containing a
17    human-readable validation report. See [llvm::verifyModule]. *)
18external verify_module : Llvm.llmodule -> string option = "llvm_verify_module"
19
20(** [verify_function f] returns [None] if the function [f] is valid, and
21    [Some reason] if it is invalid. [reason] is a string containing a
22    human-readable validation report. See [llvm::verifyFunction]. *)
23external verify_function : Llvm.llvalue -> bool = "llvm_verify_function"
24
25(** [verify_module m] returns if the module [m] is valid, but prints a
26    validation report to [stderr] and aborts the program if it is invalid. See
27    [llvm::verifyModule]. *)
28external assert_valid_module : Llvm.llmodule -> unit
29                             = "llvm_assert_valid_module"
30
31(** [verify_function f] returns if the function [f] is valid, but prints a
32    validation report to [stderr] and aborts the program if it is invalid. See
33    [llvm::verifyFunction]. *)
34external assert_valid_function : Llvm.llvalue -> unit
35                               = "llvm_assert_valid_function"
36
37(** [view_function_cfg f] opens up a ghostscript window displaying the CFG of
38    the current function with the code for each basic block inside.
39    See [llvm::Function::viewCFG]. *)
40external view_function_cfg : Llvm.llvalue -> unit = "llvm_view_function_cfg"
41
42(** [view_function_cfg_only f] works just like [view_function_cfg], but does not
43    include the contents of basic blocks into the nodes.
44    See [llvm::Function::viewCFGOnly]. *)
45external view_function_cfg_only : Llvm.llvalue -> unit
46                                = "llvm_view_function_cfg_only"
47