1 (*===-- llvm_analysis.mli - LLVM OCaml Interface --------------*- OCaml -*-===*
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 *===----------------------------------------------------------------------===*)
9 (** Intermediate representation analysis.
11 This interface provides an OCaml API for LLVM IR analyses, the classes in
12 the Analysis library. *)
14 (** [verify_module m] returns [None] if the module [m] is valid, and
15 [Some reason] if it is invalid. [reason] is a string containing a
16 human-readable validation report. See [llvm::verifyModule]. *)
17 external verify_module
: Llvm.llmodule
-> string option = "llvm_verify_module"
19 (** [verify_function f] returns [None] if the function [f] is valid, and
20 [Some reason] if it is invalid. [reason] is a string containing a
21 human-readable validation report. See [llvm::verifyFunction]. *)
22 external verify_function
: Llvm.llvalue
-> bool = "llvm_verify_function"
24 (** [verify_module m] returns if the module [m] is valid, but prints a
25 validation report to [stderr] and aborts the program if it is invalid. See
26 [llvm::verifyModule]. *)
27 external assert_valid_module
: Llvm.llmodule
-> unit
28 = "llvm_assert_valid_module"
30 (** [verify_function f] returns if the function [f] is valid, but prints a
31 validation report to [stderr] and aborts the program if it is invalid. See
32 [llvm::verifyFunction]. *)
33 external assert_valid_function
: Llvm.llvalue
-> unit
34 = "llvm_assert_valid_function"
36 (** [view_function_cfg f] opens up a ghostscript window displaying the CFG of
37 the current function with the code for each basic block inside.
38 See [llvm::Function::viewCFG]. *)
39 external view_function_cfg
: Llvm.llvalue
-> unit = "llvm_view_function_cfg"
41 (** [view_function_cfg_only f] works just like [view_function_cfg], but does not
42 include the contents of basic blocks into the nodes.
43 See [llvm::Function::viewCFGOnly]. *)
44 external view_function_cfg_only
: Llvm.llvalue
-> unit
45 = "llvm_view_function_cfg_only"