xref: /minix3/external/bsd/llvm/dist/llvm/include/llvm-c/Analysis.h (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc /*===-- llvm-c/Analysis.h - Analysis Library C Interface --------*- C++ -*-===*\
2*f4a2713aSLionel Sambuc |*                                                                            *|
3*f4a2713aSLionel Sambuc |*                     The LLVM Compiler Infrastructure                       *|
4*f4a2713aSLionel Sambuc |*                                                                            *|
5*f4a2713aSLionel Sambuc |* This file is distributed under the University of Illinois Open Source      *|
6*f4a2713aSLionel Sambuc |* License. See LICENSE.TXT for details.                                      *|
7*f4a2713aSLionel Sambuc |*                                                                            *|
8*f4a2713aSLionel Sambuc |*===----------------------------------------------------------------------===*|
9*f4a2713aSLionel Sambuc |*                                                                            *|
10*f4a2713aSLionel Sambuc |* This header declares the C interface to libLLVMAnalysis.a, which           *|
11*f4a2713aSLionel Sambuc |* implements various analyses of the LLVM IR.                                *|
12*f4a2713aSLionel Sambuc |*                                                                            *|
13*f4a2713aSLionel Sambuc |* Many exotic languages can interoperate with C code but have a harder time  *|
14*f4a2713aSLionel Sambuc |* with C++ due to name mangling. So in addition to C, this interface enables *|
15*f4a2713aSLionel Sambuc |* tools written in such languages.                                           *|
16*f4a2713aSLionel Sambuc |*                                                                            *|
17*f4a2713aSLionel Sambuc \*===----------------------------------------------------------------------===*/
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc #ifndef LLVM_C_ANALYSIS_H
20*f4a2713aSLionel Sambuc #define LLVM_C_ANALYSIS_H
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc #include "llvm-c/Core.h"
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc #ifdef __cplusplus
25*f4a2713aSLionel Sambuc extern "C" {
26*f4a2713aSLionel Sambuc #endif
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc /**
29*f4a2713aSLionel Sambuc  * @defgroup LLVMCAnalysis Analysis
30*f4a2713aSLionel Sambuc  * @ingroup LLVMC
31*f4a2713aSLionel Sambuc  *
32*f4a2713aSLionel Sambuc  * @{
33*f4a2713aSLionel Sambuc  */
34*f4a2713aSLionel Sambuc 
35*f4a2713aSLionel Sambuc typedef enum {
36*f4a2713aSLionel Sambuc   LLVMAbortProcessAction, /* verifier will print to stderr and abort() */
37*f4a2713aSLionel Sambuc   LLVMPrintMessageAction, /* verifier will print to stderr and return 1 */
38*f4a2713aSLionel Sambuc   LLVMReturnStatusAction  /* verifier will just return 1 */
39*f4a2713aSLionel Sambuc } LLVMVerifierFailureAction;
40*f4a2713aSLionel Sambuc 
41*f4a2713aSLionel Sambuc 
42*f4a2713aSLionel Sambuc /* Verifies that a module is valid, taking the specified action if not.
43*f4a2713aSLionel Sambuc    Optionally returns a human-readable description of any invalid constructs.
44*f4a2713aSLionel Sambuc    OutMessage must be disposed with LLVMDisposeMessage. */
45*f4a2713aSLionel Sambuc LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
46*f4a2713aSLionel Sambuc                           char **OutMessage);
47*f4a2713aSLionel Sambuc 
48*f4a2713aSLionel Sambuc /* Verifies that a single function is valid, taking the specified action. Useful
49*f4a2713aSLionel Sambuc    for debugging. */
50*f4a2713aSLionel Sambuc LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action);
51*f4a2713aSLionel Sambuc 
52*f4a2713aSLionel Sambuc /* Open up a ghostview window that displays the CFG of the current function.
53*f4a2713aSLionel Sambuc    Useful for debugging. */
54*f4a2713aSLionel Sambuc void LLVMViewFunctionCFG(LLVMValueRef Fn);
55*f4a2713aSLionel Sambuc void LLVMViewFunctionCFGOnly(LLVMValueRef Fn);
56*f4a2713aSLionel Sambuc 
57*f4a2713aSLionel Sambuc /**
58*f4a2713aSLionel Sambuc  * @}
59*f4a2713aSLionel Sambuc  */
60*f4a2713aSLionel Sambuc 
61*f4a2713aSLionel Sambuc #ifdef __cplusplus
62*f4a2713aSLionel Sambuc }
63*f4a2713aSLionel Sambuc #endif
64*f4a2713aSLionel Sambuc 
65*f4a2713aSLionel Sambuc #endif
66