10b57cec5SDimitry Andric /*===-- llvm-c/Analysis.h - Analysis Library C Interface --------*- C++ -*-===*\ 20b57cec5SDimitry Andric |* *| 30b57cec5SDimitry Andric |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| 40b57cec5SDimitry Andric |* Exceptions. *| 50b57cec5SDimitry Andric |* See https://llvm.org/LICENSE.txt for license information. *| 60b57cec5SDimitry Andric |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| 70b57cec5SDimitry Andric |* *| 80b57cec5SDimitry Andric |*===----------------------------------------------------------------------===*| 90b57cec5SDimitry Andric |* *| 100b57cec5SDimitry Andric |* This header declares the C interface to libLLVMAnalysis.a, which *| 110b57cec5SDimitry Andric |* implements various analyses of the LLVM IR. *| 120b57cec5SDimitry Andric |* *| 130b57cec5SDimitry Andric |* Many exotic languages can interoperate with C code but have a harder time *| 140b57cec5SDimitry Andric |* with C++ due to name mangling. So in addition to C, this interface enables *| 150b57cec5SDimitry Andric |* tools written in such languages. *| 160b57cec5SDimitry Andric |* *| 170b57cec5SDimitry Andric \*===----------------------------------------------------------------------===*/ 180b57cec5SDimitry Andric 190b57cec5SDimitry Andric #ifndef LLVM_C_ANALYSIS_H 200b57cec5SDimitry Andric #define LLVM_C_ANALYSIS_H 210b57cec5SDimitry Andric 22*480093f4SDimitry Andric #include "llvm-c/ExternC.h" 230b57cec5SDimitry Andric #include "llvm-c/Types.h" 240b57cec5SDimitry Andric 25*480093f4SDimitry Andric LLVM_C_EXTERN_C_BEGIN 260b57cec5SDimitry Andric 270b57cec5SDimitry Andric /** 280b57cec5SDimitry Andric * @defgroup LLVMCAnalysis Analysis 290b57cec5SDimitry Andric * @ingroup LLVMC 300b57cec5SDimitry Andric * 310b57cec5SDimitry Andric * @{ 320b57cec5SDimitry Andric */ 330b57cec5SDimitry Andric 340b57cec5SDimitry Andric typedef enum { 350b57cec5SDimitry Andric LLVMAbortProcessAction, /* verifier will print to stderr and abort() */ 360b57cec5SDimitry Andric LLVMPrintMessageAction, /* verifier will print to stderr and return 1 */ 370b57cec5SDimitry Andric LLVMReturnStatusAction /* verifier will just return 1 */ 380b57cec5SDimitry Andric } LLVMVerifierFailureAction; 390b57cec5SDimitry Andric 400b57cec5SDimitry Andric 410b57cec5SDimitry Andric /* Verifies that a module is valid, taking the specified action if not. 420b57cec5SDimitry Andric Optionally returns a human-readable description of any invalid constructs. 430b57cec5SDimitry Andric OutMessage must be disposed with LLVMDisposeMessage. */ 440b57cec5SDimitry Andric LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action, 450b57cec5SDimitry Andric char **OutMessage); 460b57cec5SDimitry Andric 470b57cec5SDimitry Andric /* Verifies that a single function is valid, taking the specified action. Useful 480b57cec5SDimitry Andric for debugging. */ 490b57cec5SDimitry Andric LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action); 500b57cec5SDimitry Andric 510b57cec5SDimitry Andric /* Open up a ghostview window that displays the CFG of the current function. 520b57cec5SDimitry Andric Useful for debugging. */ 530b57cec5SDimitry Andric void LLVMViewFunctionCFG(LLVMValueRef Fn); 540b57cec5SDimitry Andric void LLVMViewFunctionCFGOnly(LLVMValueRef Fn); 550b57cec5SDimitry Andric 560b57cec5SDimitry Andric /** 570b57cec5SDimitry Andric * @} 580b57cec5SDimitry Andric */ 590b57cec5SDimitry Andric 60*480093f4SDimitry Andric LLVM_C_EXTERN_C_END 610b57cec5SDimitry Andric 620b57cec5SDimitry Andric #endif 63