LLVM API Documentation
00001 /*===-- llvm-c/Analysis.h - Analysis Library C Interface --------*- C++ -*-===*\ 00002 |* *| 00003 |* The LLVM Compiler Infrastructure *| 00004 |* *| 00005 |* This file is distributed under the University of Illinois Open Source *| 00006 |* License. See LICENSE.TXT for details. *| 00007 |* *| 00008 |*===----------------------------------------------------------------------===*| 00009 |* *| 00010 |* This header declares the C interface to libLLVMAnalysis.a, which *| 00011 |* implements various analyses of the LLVM IR. *| 00012 |* *| 00013 |* Many exotic languages can interoperate with C code but have a harder time *| 00014 |* with C++ due to name mangling. So in addition to C, this interface enables *| 00015 |* tools written in such languages. *| 00016 |* *| 00017 \*===----------------------------------------------------------------------===*/ 00018 00019 #ifndef LLVM_C_ANALYSIS_H 00020 #define LLVM_C_ANALYSIS_H 00021 00022 #include "llvm-c/Core.h" 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 00029 typedef enum { 00030 LLVMAbortProcessAction, /* verifier will print to stderr and abort() */ 00031 LLVMPrintMessageAction, /* verifier will print to stderr and return 1 */ 00032 LLVMReturnStatusAction /* verifier will just return 1 */ 00033 } LLVMVerifierFailureAction; 00034 00035 00036 /* Verifies that a module is valid, taking the specified action if not. 00037 Optionally returns a human-readable description of any invalid constructs. 00038 OutMessage must be disposed with LLVMDisposeMessage. */ 00039 int LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action, 00040 char **OutMessage); 00041 00042 /* Verifies that a single function is valid, taking the specified action. Useful 00043 for debugging. */ 00044 int LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action); 00045 00046 /* Open up a ghostview window that displays the CFG of the current function. 00047 Useful for debugging. */ 00048 void LLVMViewFunctionCFG(LLVMValueRef Fn); 00049 void LLVMViewFunctionCFGOnly(LLVMValueRef Fn); 00050 00051 #ifdef __cplusplus 00052 } 00053 #endif 00054 00055 #endif