Utils.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- llvm/Transforms/Utils.h - Utility Transformations --------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This header file defines prototypes for accessor functions that expose passes
  15. // in the Utils transformations library.
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_TRANSFORMS_UTILS_H
  19. #define LLVM_TRANSFORMS_UTILS_H
  20. namespace llvm {
  21. class ModulePass;
  22. class FunctionPass;
  23. class Pass;
  24. //===----------------------------------------------------------------------===//
  25. // createMetaRenamerPass - Rename everything with metasyntatic names.
  26. //
  27. ModulePass *createMetaRenamerPass();
  28. //===----------------------------------------------------------------------===//
  29. //
  30. // LowerInvoke - This pass removes invoke instructions, converting them to call
  31. // instructions.
  32. //
  33. FunctionPass *createLowerInvokePass();
  34. extern char &LowerInvokePassID;
  35. //===----------------------------------------------------------------------===//
  36. //
  37. // InstructionNamer - Give any unnamed non-void instructions "tmp" names.
  38. //
  39. FunctionPass *createInstructionNamerPass();
  40. extern char &InstructionNamerID;
  41. //===----------------------------------------------------------------------===//
  42. //
  43. // LowerSwitch - This pass converts SwitchInst instructions into a sequence of
  44. // chained binary branch instructions.
  45. //
  46. FunctionPass *createLowerSwitchPass();
  47. extern char &LowerSwitchID;
  48. //===----------------------------------------------------------------------===//
  49. //
  50. // BreakCriticalEdges - Break all of the critical edges in the CFG by inserting
  51. // a dummy basic block. This pass may be "required" by passes that cannot deal
  52. // with critical edges. For this usage, a pass must call:
  53. //
  54. // AU.addRequiredID(BreakCriticalEdgesID);
  55. //
  56. // This pass obviously invalidates the CFG, but can update forward dominator
  57. // (set, immediate dominators, tree, and frontier) information.
  58. //
  59. FunctionPass *createBreakCriticalEdgesPass();
  60. extern char &BreakCriticalEdgesID;
  61. //===----------------------------------------------------------------------===//
  62. //
  63. // LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
  64. // optimizations.
  65. //
  66. Pass *createLCSSAPass();
  67. extern char &LCSSAID;
  68. //===----------------------------------------------------------------------===//
  69. //
  70. // AddDiscriminators - Add DWARF path discriminators to the IR.
  71. FunctionPass *createAddDiscriminatorsPass();
  72. //===----------------------------------------------------------------------===//
  73. //
  74. // PromoteMemoryToRegister - This pass is used to promote memory references to
  75. // be register references. A simple example of the transformation performed by
  76. // this pass is:
  77. //
  78. // FROM CODE TO CODE
  79. // %X = alloca i32, i32 1 ret i32 42
  80. // store i32 42, i32 *%X
  81. // %Y = load i32* %X
  82. // ret i32 %Y
  83. //
  84. FunctionPass *createPromoteMemoryToRegisterPass();
  85. //===----------------------------------------------------------------------===//
  86. //
  87. // LoopSimplify - Insert Pre-header blocks into the CFG for every function in
  88. // the module. This pass updates dominator information, loop information, and
  89. // does not add critical edges to the CFG.
  90. //
  91. // AU.addRequiredID(LoopSimplifyID);
  92. //
  93. Pass *createLoopSimplifyPass();
  94. extern char &LoopSimplifyID;
  95. /// This function returns a new pass that downgrades the debug info in the
  96. /// module to line tables only.
  97. ModulePass *createStripNonLineTableDebugLegacyPass();
  98. //===----------------------------------------------------------------------===//
  99. //
  100. // InjectTLIMappingsLegacy - populates the VFABI attribute with the
  101. // scalar-to-vector mappings from the TargetLibraryInfo.
  102. //
  103. FunctionPass *createInjectTLIMappingsLegacyPass();
  104. //===----------------------------------------------------------------------===//
  105. //
  106. // UnifyLoopExits - For each loop, creates a new block N such that all exiting
  107. // blocks branch to N, and then N distributes control flow to all the original
  108. // exit blocks.
  109. //
  110. FunctionPass *createUnifyLoopExitsPass();
  111. //===----------------------------------------------------------------------===//
  112. //
  113. // FixIrreducible - Convert each SCC with irreducible control-flow
  114. // into a natural loop.
  115. //
  116. FunctionPass *createFixIrreduciblePass();
  117. //===----------------------------------------------------------------------===//
  118. //
  119. // AssumeSimplify - remove redundant assumes and merge assumes in the same
  120. // BasicBlock when possible.
  121. //
  122. FunctionPass *createAssumeSimplifyPass();
  123. //===----------------------------------------------------------------------===//
  124. //
  125. // CanonicalizeFreezeInLoops - Canonicalize freeze instructions in loops so they
  126. // don't block SCEV.
  127. //
  128. Pass *createCanonicalizeFreezeInLoopsPass();
  129. //===----------------------------------------------------------------------===//
  130. // LowerGlobalDtorsLegacy - Lower @llvm.global_dtors by creating wrapper
  131. // functions that are registered in @llvm.global_ctors and which contain a call
  132. // to `__cxa_atexit` to register their destructor functions.
  133. ModulePass *createLowerGlobalDtorsLegacyPass();
  134. } // namespace llvm
  135. #endif
  136. #ifdef __GNUC__
  137. #pragma GCC diagnostic pop
  138. #endif