Analysis.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. /*===-- llvm-c/Analysis.h - Analysis Library C Interface --------*- C++ -*-===*\
  7. |* *|
  8. |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
  9. |* Exceptions. *|
  10. |* See https://llvm.org/LICENSE.txt for license information. *|
  11. |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
  12. |* *|
  13. |*===----------------------------------------------------------------------===*|
  14. |* *|
  15. |* This header declares the C interface to libLLVMAnalysis.a, which *|
  16. |* implements various analyses of the LLVM IR. *|
  17. |* *|
  18. |* Many exotic languages can interoperate with C code but have a harder time *|
  19. |* with C++ due to name mangling. So in addition to C, this interface enables *|
  20. |* tools written in such languages. *|
  21. |* *|
  22. \*===----------------------------------------------------------------------===*/
  23. #ifndef LLVM_C_ANALYSIS_H
  24. #define LLVM_C_ANALYSIS_H
  25. #include "llvm-c/ExternC.h"
  26. #include "llvm-c/Types.h"
  27. LLVM_C_EXTERN_C_BEGIN
  28. /**
  29. * @defgroup LLVMCAnalysis Analysis
  30. * @ingroup LLVMC
  31. *
  32. * @{
  33. */
  34. typedef enum {
  35. LLVMAbortProcessAction, /* verifier will print to stderr and abort() */
  36. LLVMPrintMessageAction, /* verifier will print to stderr and return 1 */
  37. LLVMReturnStatusAction /* verifier will just return 1 */
  38. } LLVMVerifierFailureAction;
  39. /* Verifies that a module is valid, taking the specified action if not.
  40. Optionally returns a human-readable description of any invalid constructs.
  41. OutMessage must be disposed with LLVMDisposeMessage. */
  42. LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
  43. char **OutMessage);
  44. /* Verifies that a single function is valid, taking the specified action. Useful
  45. for debugging. */
  46. LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action);
  47. /* Open up a ghostview window that displays the CFG of the current function.
  48. Useful for debugging. */
  49. void LLVMViewFunctionCFG(LLVMValueRef Fn);
  50. void LLVMViewFunctionCFGOnly(LLVMValueRef Fn);
  51. /**
  52. * @}
  53. */
  54. LLVM_C_EXTERN_C_END
  55. #endif
  56. #ifdef __GNUC__
  57. #pragma GCC diagnostic pop
  58. #endif