45 lines · plain
1(*===-- llvm_analysis.mli - LLVM OCaml Interface --------------*- OCaml -*-===*2 *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-exception6 *7 *===----------------------------------------------------------------------===*)8 9(** Intermediate representation analysis.10 11 This interface provides an OCaml API for LLVM IR analyses, the classes in12 the Analysis library. *)13 14(** [verify_module m] returns [None] if the module [m] is valid, and15 [Some reason] if it is invalid. [reason] is a string containing a16 human-readable validation report. See [llvm::verifyModule]. *)17external verify_module : Llvm.llmodule -> string option = "llvm_verify_module"18 19(** [verify_function f] returns [true] if the function [f] is valid, and20 [false] if it is invalid. See [llvm::verifyFunction]. *)21external verify_function : Llvm.llvalue -> bool = "llvm_verify_function"22 23(** [verify_module m] returns if the module [m] is valid, but prints a24 validation report to [stderr] and aborts the program if it is invalid. See25 [llvm::verifyModule]. *)26external assert_valid_module : Llvm.llmodule -> unit27 = "llvm_assert_valid_module"28 29(** [verify_function f] returns if the function [f] is valid, but prints a30 validation report to [stderr] and aborts the program if it is invalid. See31 [llvm::verifyFunction]. *)32external assert_valid_function : Llvm.llvalue -> unit33 = "llvm_assert_valid_function"34 35(** [view_function_cfg f] opens up a ghostscript window displaying the CFG of36 the current function with the code for each basic block inside.37 See [llvm::Function::viewCFG]. *)38external view_function_cfg : Llvm.llvalue -> unit = "llvm_view_function_cfg"39 40(** [view_function_cfg_only f] works just like [view_function_cfg], but does not41 include the contents of basic blocks into the nodes.42 See [llvm::Function::viewCFGOnly]. *)43external view_function_cfg_only : Llvm.llvalue -> unit44 = "llvm_view_function_cfg_only"45