llvm_sys/
analysis.rs

1//! Various analyses of the LLVM IR.
2
3use super::prelude::*;
4
5#[repr(C)]
6#[derive(Clone, Copy, Debug, PartialEq)]
7pub enum LLVMVerifierFailureAction {
8    /// Print to stderr and abort the process.
9    LLVMAbortProcessAction = 0,
10    /// Print to stderr and return 1.
11    LLVMPrintMessageAction = 1,
12    /// Return 1 and print nothing.
13    LLVMReturnStatusAction = 2,
14}
15
16extern "C" {
17    /// Verify that a module is valid, taking the specified action if not.
18    ///
19    /// Optionally returns a human-readable description of any invalid constructs,
20    /// which must be disposed with `LLVMDisposeMessage`.
21    pub fn LLVMVerifyModule(
22        M: LLVMModuleRef,
23        Action: LLVMVerifierFailureAction,
24        OutMessage: *mut *mut ::libc::c_char,
25    ) -> LLVMBool;
26    /// Verify that a single function is valid, taking the specified action.
27    ///
28    /// Useful for debugging.
29    pub fn LLVMVerifyFunction(Fn: LLVMValueRef, Action: LLVMVerifierFailureAction) -> LLVMBool;
30    /// Open a ghostview window displaying the CFG of the given function.
31    ///
32    /// Useful for debugging.
33    pub fn LLVMViewFunctionCFG(Fn: LLVMValueRef);
34    pub fn LLVMViewFunctionCFGOnly(Fn: LLVMValueRef);
35}