PassBuilder.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. /*===-- llvm-c/Transform/PassBuilder.h - PassBuilder for LLVM C ---*- 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 contains the LLVM-C interface into the new pass manager *|
  16. |* *|
  17. \*===----------------------------------------------------------------------===*/
  18. #ifndef LLVM_C_TRANSFORMS_PASSBUILDER_H
  19. #define LLVM_C_TRANSFORMS_PASSBUILDER_H
  20. #include "llvm-c/Error.h"
  21. #include "llvm-c/TargetMachine.h"
  22. #include "llvm-c/Types.h"
  23. /**
  24. * @defgroup LLVMCCoreNewPM New Pass Manager
  25. * @ingroup LLVMCCore
  26. *
  27. * @{
  28. */
  29. LLVM_C_EXTERN_C_BEGIN
  30. /**
  31. * A set of options passed which are attached to the Pass Manager upon run.
  32. *
  33. * This corresponds to an llvm::LLVMPassBuilderOptions instance
  34. *
  35. * The details for how the different properties of this structure are used can
  36. * be found in the source for LLVMRunPasses
  37. */
  38. typedef struct LLVMOpaquePassBuilderOptions *LLVMPassBuilderOptionsRef;
  39. /**
  40. * Construct and run a set of passes over a module
  41. *
  42. * This function takes a string with the passes that should be used. The format
  43. * of this string is the same as opt's -passes argument for the new pass
  44. * manager. Individual passes may be specified, separated by commas. Full
  45. * pipelines may also be invoked using `default<O3>` and friends. See opt for
  46. * full reference of the Passes format.
  47. */
  48. LLVMErrorRef LLVMRunPasses(LLVMModuleRef M, const char *Passes,
  49. LLVMTargetMachineRef TM,
  50. LLVMPassBuilderOptionsRef Options);
  51. /**
  52. * Create a new set of options for a PassBuilder
  53. *
  54. * Ownership of the returned instance is given to the client, and they are
  55. * responsible for it. The client should call LLVMDisposePassBuilderOptions
  56. * to free the pass builder options.
  57. */
  58. LLVMPassBuilderOptionsRef LLVMCreatePassBuilderOptions(void);
  59. /**
  60. * Toggle adding the VerifierPass for the PassBuilder, ensuring all functions
  61. * inside the module is valid.
  62. */
  63. void LLVMPassBuilderOptionsSetVerifyEach(LLVMPassBuilderOptionsRef Options,
  64. LLVMBool VerifyEach);
  65. /**
  66. * Toggle debug logging when running the PassBuilder
  67. */
  68. void LLVMPassBuilderOptionsSetDebugLogging(LLVMPassBuilderOptionsRef Options,
  69. LLVMBool DebugLogging);
  70. void LLVMPassBuilderOptionsSetLoopInterleaving(
  71. LLVMPassBuilderOptionsRef Options, LLVMBool LoopInterleaving);
  72. void LLVMPassBuilderOptionsSetLoopVectorization(
  73. LLVMPassBuilderOptionsRef Options, LLVMBool LoopVectorization);
  74. void LLVMPassBuilderOptionsSetSLPVectorization(
  75. LLVMPassBuilderOptionsRef Options, LLVMBool SLPVectorization);
  76. void LLVMPassBuilderOptionsSetLoopUnrolling(LLVMPassBuilderOptionsRef Options,
  77. LLVMBool LoopUnrolling);
  78. void LLVMPassBuilderOptionsSetForgetAllSCEVInLoopUnroll(
  79. LLVMPassBuilderOptionsRef Options, LLVMBool ForgetAllSCEVInLoopUnroll);
  80. void LLVMPassBuilderOptionsSetLicmMssaOptCap(LLVMPassBuilderOptionsRef Options,
  81. unsigned LicmMssaOptCap);
  82. void LLVMPassBuilderOptionsSetLicmMssaNoAccForPromotionCap(
  83. LLVMPassBuilderOptionsRef Options, unsigned LicmMssaNoAccForPromotionCap);
  84. void LLVMPassBuilderOptionsSetCallGraphProfile(
  85. LLVMPassBuilderOptionsRef Options, LLVMBool CallGraphProfile);
  86. void LLVMPassBuilderOptionsSetMergeFunctions(LLVMPassBuilderOptionsRef Options,
  87. LLVMBool MergeFunctions);
  88. /**
  89. * Dispose of a heap-allocated PassBuilderOptions instance
  90. */
  91. void LLVMDisposePassBuilderOptions(LLVMPassBuilderOptionsRef Options);
  92. /**
  93. * @}
  94. */
  95. LLVM_C_EXTERN_C_END
  96. #endif // LLVM_C_TRANSFORMS_PASSBUILDER_H
  97. #ifdef __GNUC__
  98. #pragma GCC diagnostic pop
  99. #endif