Utils.h 5.7 KB

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