LLVM API Documentation
00001 //===-- Scalar.h - Scalar Transformations -----------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This header file defines prototypes for accessor functions that expose passes 00011 // in the Scalar transformations library. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_TRANSFORMS_SCALAR_H 00016 #define LLVM_TRANSFORMS_SCALAR_H 00017 00018 namespace llvm { 00019 00020 class FunctionPass; 00021 class Pass; 00022 class GetElementPtrInst; 00023 class PassInfo; 00024 class TerminatorInst; 00025 class TargetLowering; 00026 00027 //===----------------------------------------------------------------------===// 00028 // 00029 // ConstantPropagation - A worklist driven constant propagation pass 00030 // 00031 FunctionPass *createConstantPropagationPass(); 00032 00033 //===----------------------------------------------------------------------===// 00034 // 00035 // SCCP - Sparse conditional constant propagation. 00036 // 00037 FunctionPass *createSCCPPass(); 00038 00039 //===----------------------------------------------------------------------===// 00040 // 00041 // DeadInstElimination - This pass quickly removes trivially dead instructions 00042 // without modifying the CFG of the function. It is a BasicBlockPass, so it 00043 // runs efficiently when queued next to other BasicBlockPass's. 00044 // 00045 Pass *createDeadInstEliminationPass(); 00046 00047 //===----------------------------------------------------------------------===// 00048 // 00049 // DeadCodeElimination - This pass is more powerful than DeadInstElimination, 00050 // because it is worklist driven that can potentially revisit instructions when 00051 // their other instructions become dead, to eliminate chains of dead 00052 // computations. 00053 // 00054 FunctionPass *createDeadCodeEliminationPass(); 00055 00056 //===----------------------------------------------------------------------===// 00057 // 00058 // DeadStoreElimination - This pass deletes stores that are post-dominated by 00059 // must-aliased stores and are not loaded used between the stores. 00060 // 00061 FunctionPass *createDeadStoreEliminationPass(); 00062 00063 //===----------------------------------------------------------------------===// 00064 // 00065 // AggressiveDCE - This pass uses the SSA based Aggressive DCE algorithm. This 00066 // algorithm assumes instructions are dead until proven otherwise, which makes 00067 // it more successful are removing non-obviously dead instructions. 00068 // 00069 FunctionPass *createAggressiveDCEPass(); 00070 00071 //===----------------------------------------------------------------------===// 00072 // 00073 // ScalarReplAggregates - Break up alloca's of aggregates into multiple allocas 00074 // if possible. 00075 // 00076 FunctionPass *createScalarReplAggregatesPass(signed Threshold = -1); 00077 00078 //===----------------------------------------------------------------------===// 00079 // 00080 // InductionVariableSimplify - Transform induction variables in a program to all 00081 // use a single canonical induction variable per loop. 00082 // 00083 Pass *createIndVarSimplifyPass(); 00084 00085 //===----------------------------------------------------------------------===// 00086 // 00087 // InstructionCombining - Combine instructions to form fewer, simple 00088 // instructions. This pass does not modify the CFG, and has a tendency to make 00089 // instructions dead, so a subsequent DCE pass is useful. 00090 // 00091 // This pass combines things like: 00092 // %Y = add int 1, %X 00093 // %Z = add int 1, %Y 00094 // into: 00095 // %Z = add int 2, %X 00096 // 00097 FunctionPass *createInstructionCombiningPass(); 00098 00099 //===----------------------------------------------------------------------===// 00100 // 00101 // LICM - This pass is a loop invariant code motion and memory promotion pass. 00102 // 00103 Pass *createLICMPass(); 00104 00105 //===----------------------------------------------------------------------===// 00106 // 00107 // LoopStrengthReduce - This pass is strength reduces GEP instructions that use 00108 // a loop's canonical induction variable as one of their indices. It takes an 00109 // optional parameter used to consult the target machine whether certain 00110 // transformations are profitable. 00111 // 00112 Pass *createLoopStrengthReducePass(const TargetLowering *TLI = 0); 00113 00114 //===----------------------------------------------------------------------===// 00115 // 00116 // LoopUnswitch - This pass is a simple loop unswitching pass. 00117 // 00118 Pass *createLoopUnswitchPass(bool OptimizeForSize = false); 00119 00120 //===----------------------------------------------------------------------===// 00121 // 00122 // LoopUnroll - This pass is a simple loop unrolling pass. 00123 // 00124 Pass *createLoopUnrollPass(); 00125 00126 //===----------------------------------------------------------------------===// 00127 // 00128 // LoopRotate - This pass is a simple loop rotating pass. 00129 // 00130 Pass *createLoopRotatePass(); 00131 00132 //===----------------------------------------------------------------------===// 00133 // 00134 // LoopIndexSplit - This pass divides loop's iteration range by spliting loop 00135 // such that each individual loop is executed efficiently. 00136 // 00137 Pass *createLoopIndexSplitPass(); 00138 00139 //===----------------------------------------------------------------------===// 00140 // 00141 // PromoteMemoryToRegister - This pass is used to promote memory references to 00142 // be register references. A simple example of the transformation performed by 00143 // this pass is: 00144 // 00145 // FROM CODE TO CODE 00146 // %X = alloca int, uint 1 ret int 42 00147 // store int 42, int *%X 00148 // %Y = load int* %X 00149 // ret int %Y 00150 // 00151 FunctionPass *createPromoteMemoryToRegisterPass(); 00152 extern const PassInfo *const PromoteMemoryToRegisterID; 00153 00154 //===----------------------------------------------------------------------===// 00155 // 00156 // DemoteRegisterToMemoryPass - This pass is used to demote registers to memory 00157 // references. In basically undoes the PromoteMemoryToRegister pass to make cfg 00158 // hacking easier. 00159 // 00160 FunctionPass *createDemoteRegisterToMemoryPass(); 00161 extern const PassInfo *const DemoteRegisterToMemoryID; 00162 00163 //===----------------------------------------------------------------------===// 00164 // 00165 // Reassociate - This pass reassociates commutative expressions in an order that 00166 // is designed to promote better constant propagation, GCSE, LICM, PRE... 00167 // 00168 // For example: 4 + (x + 5) -> x + (4 + 5) 00169 // 00170 FunctionPass *createReassociatePass(); 00171 00172 //===----------------------------------------------------------------------===// 00173 // 00174 // CondPropagationPass - This pass propagates information about conditional 00175 // expressions through the program, allowing it to eliminate conditional 00176 // branches in some cases. 00177 // 00178 FunctionPass *createCondPropagationPass(); 00179 00180 //===----------------------------------------------------------------------===// 00181 // 00182 // TailDuplication - Eliminate unconditional branches through controlled code 00183 // duplication, creating simpler CFG structures. 00184 // 00185 FunctionPass *createTailDuplicationPass(); 00186 00187 //===----------------------------------------------------------------------===// 00188 // 00189 // JumpThreading - Thread control through mult-pred/multi-succ blocks where some 00190 // preds always go to some succ. 00191 // 00192 FunctionPass *createJumpThreadingPass(); 00193 00194 //===----------------------------------------------------------------------===// 00195 // 00196 // CFGSimplification - Merge basic blocks, eliminate unreachable blocks, 00197 // simplify terminator instructions, etc... 00198 // 00199 FunctionPass *createCFGSimplificationPass(); 00200 00201 //===----------------------------------------------------------------------===// 00202 // 00203 // BreakCriticalEdges - Break all of the critical edges in the CFG by inserting 00204 // a dummy basic block. This pass may be "required" by passes that cannot deal 00205 // with critical edges. For this usage, a pass must call: 00206 // 00207 // AU.addRequiredID(BreakCriticalEdgesID); 00208 // 00209 // This pass obviously invalidates the CFG, but can update forward dominator 00210 // (set, immediate dominators, tree, and frontier) information. 00211 // 00212 FunctionPass *createBreakCriticalEdgesPass(); 00213 extern const PassInfo *const BreakCriticalEdgesID; 00214 00215 //===----------------------------------------------------------------------===// 00216 // 00217 // LoopSimplify - Insert Pre-header blocks into the CFG for every function in 00218 // the module. This pass updates dominator information, loop information, and 00219 // does not add critical edges to the CFG. 00220 // 00221 // AU.addRequiredID(LoopSimplifyID); 00222 // 00223 FunctionPass *createLoopSimplifyPass(); 00224 extern const PassInfo *const LoopSimplifyID; 00225 00226 //===----------------------------------------------------------------------===// 00227 // 00228 // LowerAllocations - Turn malloc and free instructions into %malloc and %free 00229 // calls. 00230 // 00231 // AU.addRequiredID(LowerAllocationsID); 00232 // 00233 Pass *createLowerAllocationsPass(bool LowerMallocArgToInteger = false); 00234 extern const PassInfo *const LowerAllocationsID; 00235 00236 //===----------------------------------------------------------------------===// 00237 // 00238 // TailCallElimination - This pass eliminates call instructions to the current 00239 // function which occur immediately before return instructions. 00240 // 00241 FunctionPass *createTailCallEliminationPass(); 00242 00243 //===----------------------------------------------------------------------===// 00244 // 00245 // LowerSwitch - This pass converts SwitchInst instructions into a sequence of 00246 // chained binary branch instructions. 00247 // 00248 FunctionPass *createLowerSwitchPass(); 00249 extern const PassInfo *const LowerSwitchID; 00250 00251 //===----------------------------------------------------------------------===// 00252 // 00253 // LowerInvoke - This pass converts invoke and unwind instructions to use sjlj 00254 // exception handling mechanisms. Note that after this pass runs the CFG is not 00255 // entirely accurate (exceptional control flow edges are not correct anymore) so 00256 // only very simple things should be done after the lowerinvoke pass has run 00257 // (like generation of native code). This should *NOT* be used as a general 00258 // purpose "my LLVM-to-LLVM pass doesn't support the invoke instruction yet" 00259 // lowering pass. 00260 // 00261 FunctionPass *createLowerInvokePass(const TargetLowering *TLI = 0); 00262 extern const PassInfo *const LowerInvokePassID; 00263 00264 //===----------------------------------------------------------------------===// 00265 // 00266 // BlockPlacement - This pass reorders basic blocks in order to increase the 00267 // number of fall-through conditional branches. 00268 // 00269 FunctionPass *createBlockPlacementPass(); 00270 00271 //===----------------------------------------------------------------------===// 00272 // 00273 // LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop 00274 // optimizations. 00275 // 00276 Pass *createLCSSAPass(); 00277 extern const PassInfo *const LCSSAID; 00278 00279 //===----------------------------------------------------------------------===// 00280 // 00281 // PredicateSimplifier - This pass collapses duplicate variables into one 00282 // canonical form, and tries to simplify expressions along the way. 00283 // 00284 FunctionPass *createPredicateSimplifierPass(); 00285 00286 //===----------------------------------------------------------------------===// 00287 // 00288 // GVN-PRE - This pass performs global value numbering and partial redundancy 00289 // elimination. 00290 // 00291 FunctionPass *createGVNPREPass(); 00292 00293 //===----------------------------------------------------------------------===// 00294 // 00295 // GVN - This pass performs global value numbering and redundant load 00296 // elimination cotemporaneously. 00297 // 00298 FunctionPass *createGVNPass(); 00299 00300 //===----------------------------------------------------------------------===// 00301 // 00302 // MemCpyOpt - This pass performs optimizations related to eliminating memcpy 00303 // calls and/or combining multiple stores into memset's. 00304 // 00305 FunctionPass *createMemCpyOptPass(); 00306 00307 //===----------------------------------------------------------------------===// 00308 // 00309 // LoopDeletion - This pass performs DCE of non-infinite loops that it 00310 // can prove are dead. 00311 // 00312 Pass *createLoopDeletionPass(); 00313 00314 //===----------------------------------------------------------------------===// 00315 // 00316 /// createSimplifyLibCallsPass - This pass optimizes specific calls to 00317 /// specific well-known (library) functions. 00318 FunctionPass *createSimplifyLibCallsPass(); 00319 00320 //===----------------------------------------------------------------------===// 00321 // 00322 /// createSimplifyHalfPowrLibCallsPass - This is an experimental pass that 00323 /// optimizes specific half_pow functions. 00324 FunctionPass *createSimplifyHalfPowrLibCallsPass(); 00325 00326 //===----------------------------------------------------------------------===// 00327 // 00328 // CodeGenPrepare - This pass prepares a function for instruction selection. 00329 // 00330 FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0); 00331 00332 00333 //===----------------------------------------------------------------------===// 00334 // 00335 // InstructionNamer - Give any unnamed non-void instructions "tmp" names. 00336 // 00337 FunctionPass *createInstructionNamerPass(); 00338 extern const PassInfo *const InstructionNamerID; 00339 00340 } // End llvm namespace 00341 00342 #endif
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.