Utils.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. // createUniqueInternalLinkageNamesPass - Make internal linkage symbol names
  30. // unique.
  31. //
  32. ModulePass *createUniqueInternalLinkageNamesPass();
  33. //===----------------------------------------------------------------------===//
  34. //
  35. // LowerInvoke - This pass removes invoke instructions, converting them to call
  36. // instructions.
  37. //
  38. FunctionPass *createLowerInvokePass();
  39. extern char &LowerInvokePassID;
  40. //===----------------------------------------------------------------------===//
  41. //
  42. // InstructionNamer - Give any unnamed non-void instructions "tmp" names.
  43. //
  44. FunctionPass *createInstructionNamerPass();
  45. extern char &InstructionNamerID;
  46. //===----------------------------------------------------------------------===//
  47. //
  48. // LowerSwitch - This pass converts SwitchInst instructions into a sequence of
  49. // chained binary branch instructions.
  50. //
  51. FunctionPass *createLowerSwitchPass();
  52. extern char &LowerSwitchID;
  53. //===----------------------------------------------------------------------===//
  54. //
  55. // EntryExitInstrumenter pass - Instrument function entry/exit with calls to
  56. // mcount(), @__cyg_profile_func_{enter,exit} and the like. There are two
  57. // variants, intended to run pre- and post-inlining, respectively.
  58. //
  59. FunctionPass *createEntryExitInstrumenterPass();
  60. FunctionPass *createPostInlineEntryExitInstrumenterPass();
  61. //===----------------------------------------------------------------------===//
  62. //
  63. // BreakCriticalEdges - Break all of the critical edges in the CFG by inserting
  64. // a dummy basic block. This pass may be "required" by passes that cannot deal
  65. // with critical edges. For this usage, a pass must call:
  66. //
  67. // AU.addRequiredID(BreakCriticalEdgesID);
  68. //
  69. // This pass obviously invalidates the CFG, but can update forward dominator
  70. // (set, immediate dominators, tree, and frontier) information.
  71. //
  72. FunctionPass *createBreakCriticalEdgesPass();
  73. extern char &BreakCriticalEdgesID;
  74. //===----------------------------------------------------------------------===//
  75. //
  76. // LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
  77. // optimizations.
  78. //
  79. Pass *createLCSSAPass();
  80. extern char &LCSSAID;
  81. //===----------------------------------------------------------------------===//
  82. //
  83. // AddDiscriminators - Add DWARF path discriminators to the IR.
  84. FunctionPass *createAddDiscriminatorsPass();
  85. //===----------------------------------------------------------------------===//
  86. //
  87. // PromoteMemoryToRegister - This pass is used to promote memory references to
  88. // be register references. A simple example of the transformation performed by
  89. // this pass is:
  90. //
  91. // FROM CODE TO CODE
  92. // %X = alloca i32, i32 1 ret i32 42
  93. // store i32 42, i32 *%X
  94. // %Y = load i32* %X
  95. // ret i32 %Y
  96. //
  97. FunctionPass *createPromoteMemoryToRegisterPass();
  98. //===----------------------------------------------------------------------===//
  99. //
  100. // LoopSimplify - Insert Pre-header blocks into the CFG for every function in
  101. // the module. This pass updates dominator information, loop information, and
  102. // does not add critical edges to the CFG.
  103. //
  104. // AU.addRequiredID(LoopSimplifyID);
  105. //
  106. Pass *createLoopSimplifyPass();
  107. extern char &LoopSimplifyID;
  108. /// This function returns a new pass that downgrades the debug info in the
  109. /// module to line tables only.
  110. ModulePass *createStripNonLineTableDebugLegacyPass();
  111. //===----------------------------------------------------------------------===//
  112. //
  113. // ControlHeightReudction - Merges conditional blocks of code and reduces the
  114. // number of conditional branches in the hot paths based on profiles.
  115. //
  116. FunctionPass *createControlHeightReductionLegacyPass();
  117. //===----------------------------------------------------------------------===//
  118. //
  119. // InjectTLIMappingsLegacy - populates the VFABI attribute with the
  120. // scalar-to-vector mappings from the TargetLibraryInfo.
  121. //
  122. FunctionPass *createInjectTLIMappingsLegacyPass();
  123. //===----------------------------------------------------------------------===//
  124. //
  125. // UnifyLoopExits - For each loop, creates a new block N such that all exiting
  126. // blocks branch to N, and then N distributes control flow to all the original
  127. // exit blocks.
  128. //
  129. FunctionPass *createUnifyLoopExitsPass();
  130. //===----------------------------------------------------------------------===//
  131. //
  132. // FixIrreducible - Convert each SCC with irreducible control-flow
  133. // into a natural loop.
  134. //
  135. FunctionPass *createFixIrreduciblePass();
  136. //===----------------------------------------------------------------------===//
  137. //
  138. // AssumeSimplify - remove redundant assumes and merge assumes in the same
  139. // BasicBlock when possible.
  140. //
  141. FunctionPass *createAssumeSimplifyPass();
  142. //===----------------------------------------------------------------------===//
  143. //
  144. // CanonicalizeFreezeInLoops - Canonicalize freeze instructions in loops so they
  145. // don't block SCEV.
  146. //
  147. Pass *createCanonicalizeFreezeInLoopsPass();
  148. } // namespace llvm
  149. #endif
  150. #ifdef __GNUC__
  151. #pragma GCC diagnostic pop
  152. #endif