Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

352 lines
12 KiB

  1. //===-- Scalar.h - Scalar Transformations -----------------------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This header file defines prototypes for accessor functions that expose passes
  11. // in the Scalar transformations library.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_TRANSFORMS_SCALAR_H
  15. #define LLVM_TRANSFORMS_SCALAR_H
  16. namespace llvm {
  17. class FunctionPass;
  18. class Pass;
  19. class GetElementPtrInst;
  20. class PassInfo;
  21. class TerminatorInst;
  22. class TargetLowering;
  23. //===----------------------------------------------------------------------===//
  24. //
  25. // ConstantPropagation - A worklist driven constant propagation pass
  26. //
  27. FunctionPass *createConstantPropagationPass();
  28. //===----------------------------------------------------------------------===//
  29. //
  30. // SCCP - Sparse conditional constant propagation.
  31. //
  32. FunctionPass *createSCCPPass();
  33. //===----------------------------------------------------------------------===//
  34. //
  35. // DeadInstElimination - This pass quickly removes trivially dead instructions
  36. // without modifying the CFG of the function. It is a BasicBlockPass, so it
  37. // runs efficiently when queued next to other BasicBlockPass's.
  38. //
  39. Pass *createDeadInstEliminationPass();
  40. //===----------------------------------------------------------------------===//
  41. //
  42. // DeadCodeElimination - This pass is more powerful than DeadInstElimination,
  43. // because it is worklist driven that can potentially revisit instructions when
  44. // their other instructions become dead, to eliminate chains of dead
  45. // computations.
  46. //
  47. FunctionPass *createDeadCodeEliminationPass();
  48. //===----------------------------------------------------------------------===//
  49. //
  50. // DeadStoreElimination - This pass deletes stores that are post-dominated by
  51. // must-aliased stores and are not loaded used between the stores.
  52. //
  53. FunctionPass *createDeadStoreEliminationPass();
  54. //===----------------------------------------------------------------------===//
  55. //
  56. // AggressiveDCE - This pass uses the SSA based Aggressive DCE algorithm. This
  57. // algorithm assumes instructions are dead until proven otherwise, which makes
  58. // it more successful are removing non-obviously dead instructions.
  59. //
  60. FunctionPass *createAggressiveDCEPass();
  61. //===----------------------------------------------------------------------===//
  62. //
  63. // SROA - Replace aggregates or pieces of aggregates with scalar SSA values.
  64. //
  65. FunctionPass *createSROAPass(bool RequiresDomTree = true);
  66. //===----------------------------------------------------------------------===//
  67. //
  68. // ScalarReplAggregates - Break up alloca's of aggregates into multiple allocas
  69. // if possible.
  70. //
  71. FunctionPass *createScalarReplAggregatesPass(signed Threshold = -1,
  72. bool UseDomTree = true,
  73. signed StructMemberThreshold = -1,
  74. signed ArrayElementThreshold = -1,
  75. signed ScalarLoadThreshold = -1);
  76. //===----------------------------------------------------------------------===//
  77. //
  78. // InductionVariableSimplify - Transform induction variables in a program to all
  79. // use a single canonical induction variable per loop.
  80. //
  81. Pass *createIndVarSimplifyPass();
  82. //===----------------------------------------------------------------------===//
  83. //
  84. // InstructionCombining - Combine instructions to form fewer, simple
  85. // instructions. This pass does not modify the CFG, and has a tendency to make
  86. // instructions dead, so a subsequent DCE pass is useful.
  87. //
  88. // This pass combines things like:
  89. // %Y = add int 1, %X
  90. // %Z = add int 1, %Y
  91. // into:
  92. // %Z = add int 2, %X
  93. //
  94. FunctionPass *createInstructionCombiningPass();
  95. //===----------------------------------------------------------------------===//
  96. //
  97. // LICM - This pass is a loop invariant code motion and memory promotion pass.
  98. //
  99. Pass *createLICMPass();
  100. //===----------------------------------------------------------------------===//
  101. //
  102. // LoopStrengthReduce - This pass is strength reduces GEP instructions that use
  103. // a loop's canonical induction variable as one of their indices.
  104. //
  105. Pass *createLoopStrengthReducePass();
  106. Pass *createGlobalMergePass(const TargetLowering *TLI = 0);
  107. //===----------------------------------------------------------------------===//
  108. //
  109. // LoopUnswitch - This pass is a simple loop unswitching pass.
  110. //
  111. Pass *createLoopUnswitchPass(bool OptimizeForSize = false);
  112. //===----------------------------------------------------------------------===//
  113. //
  114. // LoopInstSimplify - This pass simplifies instructions in a loop's body.
  115. //
  116. Pass *createLoopInstSimplifyPass();
  117. //===----------------------------------------------------------------------===//
  118. //
  119. // LoopUnroll - This pass is a simple loop unrolling pass.
  120. //
  121. Pass *createLoopUnrollPass(int Threshold = -1, int Count = -1, int AllowPartial = -1);
  122. //===----------------------------------------------------------------------===//
  123. //
  124. // LoopRotate - This pass is a simple loop rotating pass.
  125. //
  126. Pass *createLoopRotatePass();
  127. //===----------------------------------------------------------------------===//
  128. //
  129. // LoopIdiom - This pass recognizes and replaces idioms in loops.
  130. //
  131. Pass *createLoopIdiomPass();
  132. //===----------------------------------------------------------------------===//
  133. //
  134. // PromoteMemoryToRegister - This pass is used to promote memory references to
  135. // be register references. A simple example of the transformation performed by
  136. // this pass is:
  137. //
  138. // FROM CODE TO CODE
  139. // %X = alloca i32, i32 1 ret i32 42
  140. // store i32 42, i32 *%X
  141. // %Y = load i32* %X
  142. // ret i32 %Y
  143. //
  144. FunctionPass *createPromoteMemoryToRegisterPass();
  145. //===----------------------------------------------------------------------===//
  146. //
  147. // DemoteRegisterToMemoryPass - This pass is used to demote registers to memory
  148. // references. In basically undoes the PromoteMemoryToRegister pass to make cfg
  149. // hacking easier.
  150. //
  151. FunctionPass *createDemoteRegisterToMemoryPass();
  152. extern char &DemoteRegisterToMemoryID;
  153. //===----------------------------------------------------------------------===//
  154. //
  155. // Reassociate - This pass reassociates commutative expressions in an order that
  156. // is designed to promote better constant propagation, GCSE, LICM, PRE...
  157. //
  158. // For example: 4 + (x + 5) -> x + (4 + 5)
  159. //
  160. FunctionPass *createReassociatePass();
  161. //===----------------------------------------------------------------------===//
  162. //
  163. // JumpThreading - Thread control through mult-pred/multi-succ blocks where some
  164. // preds always go to some succ.
  165. //
  166. FunctionPass *createJumpThreadingPass();
  167. //===----------------------------------------------------------------------===//
  168. //
  169. // CFGSimplification - Merge basic blocks, eliminate unreachable blocks,
  170. // simplify terminator instructions, etc...
  171. //
  172. FunctionPass *createCFGSimplificationPass();
  173. //===----------------------------------------------------------------------===//
  174. //
  175. // BreakCriticalEdges - Break all of the critical edges in the CFG by inserting
  176. // a dummy basic block. This pass may be "required" by passes that cannot deal
  177. // with critical edges. For this usage, a pass must call:
  178. //
  179. // AU.addRequiredID(BreakCriticalEdgesID);
  180. //
  181. // This pass obviously invalidates the CFG, but can update forward dominator
  182. // (set, immediate dominators, tree, and frontier) information.
  183. //
  184. FunctionPass *createBreakCriticalEdgesPass();
  185. extern char &BreakCriticalEdgesID;
  186. //===----------------------------------------------------------------------===//
  187. //
  188. // LoopSimplify - Insert Pre-header blocks into the CFG for every function in
  189. // the module. This pass updates dominator information, loop information, and
  190. // does not add critical edges to the CFG.
  191. //
  192. // AU.addRequiredID(LoopSimplifyID);
  193. //
  194. Pass *createLoopSimplifyPass();
  195. extern char &LoopSimplifyID;
  196. //===----------------------------------------------------------------------===//
  197. //
  198. // TailCallElimination - This pass eliminates call instructions to the current
  199. // function which occur immediately before return instructions.
  200. //
  201. FunctionPass *createTailCallEliminationPass();
  202. //===----------------------------------------------------------------------===//
  203. //
  204. // LowerSwitch - This pass converts SwitchInst instructions into a sequence of
  205. // chained binary branch instructions.
  206. //
  207. FunctionPass *createLowerSwitchPass();
  208. extern char &LowerSwitchID;
  209. //===----------------------------------------------------------------------===//
  210. //
  211. // LowerInvoke - This pass converts invoke and unwind instructions to use sjlj
  212. // exception handling mechanisms. Note that after this pass runs the CFG is not
  213. // entirely accurate (exceptional control flow edges are not correct anymore) so
  214. // only very simple things should be done after the lowerinvoke pass has run
  215. // (like generation of native code). This should *NOT* be used as a general
  216. // purpose "my LLVM-to-LLVM pass doesn't support the invoke instruction yet"
  217. // lowering pass.
  218. //
  219. FunctionPass *createLowerInvokePass(const TargetLowering *TLI = 0);
  220. FunctionPass *createLowerInvokePass(const TargetLowering *TLI,
  221. bool useExpensiveEHSupport);
  222. extern char &LowerInvokePassID;
  223. //===----------------------------------------------------------------------===//
  224. //
  225. // BlockPlacement - This pass reorders basic blocks in order to increase the
  226. // number of fall-through conditional branches.
  227. //
  228. FunctionPass *createBlockPlacementPass();
  229. //===----------------------------------------------------------------------===//
  230. //
  231. // LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
  232. // optimizations.
  233. //
  234. Pass *createLCSSAPass();
  235. extern char &LCSSAID;
  236. //===----------------------------------------------------------------------===//
  237. //
  238. // EarlyCSE - This pass performs a simple and fast CSE pass over the dominator
  239. // tree.
  240. //
  241. FunctionPass *createEarlyCSEPass();
  242. //===----------------------------------------------------------------------===//
  243. //
  244. // GVN - This pass performs global value numbering and redundant load
  245. // elimination cotemporaneously.
  246. //
  247. FunctionPass *createGVNPass(bool NoLoads = false);
  248. //===----------------------------------------------------------------------===//
  249. //
  250. // MemCpyOpt - This pass performs optimizations related to eliminating memcpy
  251. // calls and/or combining multiple stores into memset's.
  252. //
  253. FunctionPass *createMemCpyOptPass();
  254. //===----------------------------------------------------------------------===//
  255. //
  256. // LoopDeletion - This pass performs DCE of non-infinite loops that it
  257. // can prove are dead.
  258. //
  259. Pass *createLoopDeletionPass();
  260. //===----------------------------------------------------------------------===//
  261. //
  262. /// createSimplifyLibCallsPass - This pass optimizes specific calls to
  263. /// specific well-known (library) functions.
  264. FunctionPass *createSimplifyLibCallsPass();
  265. //===----------------------------------------------------------------------===//
  266. //
  267. // CodeGenPrepare - This pass prepares a function for instruction selection.
  268. //
  269. FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0);
  270. //===----------------------------------------------------------------------===//
  271. //
  272. // InstructionNamer - Give any unnamed non-void instructions "tmp" names.
  273. //
  274. FunctionPass *createInstructionNamerPass();
  275. extern char &InstructionNamerID;
  276. //===----------------------------------------------------------------------===//
  277. //
  278. // Sink - Code Sinking
  279. //
  280. FunctionPass *createSinkingPass();
  281. //===----------------------------------------------------------------------===//
  282. //
  283. // LowerAtomic - Lower atomic intrinsics to non-atomic form
  284. //
  285. Pass *createLowerAtomicPass();
  286. //===----------------------------------------------------------------------===//
  287. //
  288. // ValuePropagation - Propagate CFG-derived value information
  289. //
  290. Pass *createCorrelatedValuePropagationPass();
  291. //===----------------------------------------------------------------------===//
  292. //
  293. // InstructionSimplifier - Remove redundant instructions.
  294. //
  295. FunctionPass *createInstructionSimplifierPass();
  296. extern char &InstructionSimplifierID;
  297. //===----------------------------------------------------------------------===//
  298. //
  299. // LowerExpectIntrinsics - Removes llvm.expect intrinsics and creates
  300. // "block_weights" metadata.
  301. FunctionPass *createLowerExpectIntrinsicPass();
  302. } // End llvm namespace
  303. #endif