LLVM API Documentation

c/Analysis.h
Go to the documentation of this file.
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  * @defgroup LLVMCAnalysis Analysis
00030  * @ingroup LLVMC
00031  *
00032  * @{
00033  */
00034 
00035 typedef enum {
00036   LLVMAbortProcessAction, /* verifier will print to stderr and abort() */
00037   LLVMPrintMessageAction, /* verifier will print to stderr and return 1 */
00038   LLVMReturnStatusAction  /* verifier will just return 1 */
00039 } LLVMVerifierFailureAction;
00040 
00041 
00042 /* Verifies that a module is valid, taking the specified action if not.
00043    Optionally returns a human-readable description of any invalid constructs.
00044    OutMessage must be disposed with LLVMDisposeMessage. */
00045 LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
00046                           char **OutMessage);
00047 
00048 /* Verifies that a single function is valid, taking the specified action. Useful
00049    for debugging. */
00050 LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action);
00051 
00052 /* Open up a ghostview window that displays the CFG of the current function.
00053    Useful for debugging. */
00054 void LLVMViewFunctionCFG(LLVMValueRef Fn);
00055 void LLVMViewFunctionCFGOnly(LLVMValueRef Fn);
00056 
00057 /**
00058  * @}
00059  */
00060 
00061 #ifdef __cplusplus
00062 }
00063 #endif
00064 
00065 #endif