X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FTransforms%2FScalar.h;h=51aeba4a361743b334f7d0bbf92435fbb0553063;hb=3748de6e2d7620794ff93b896d85aff6cc0ea9d2;hp=0fbc72f0a3424870217fe53960a85d9599d69951;hpb=d94b6a16fec7d5021e3922b0e34f9ddb268d54b1;p=oota-llvm.git diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h index 0fbc72f0a34..51aeba4a361 100644 --- a/include/llvm/Transforms/Scalar.h +++ b/include/llvm/Transforms/Scalar.h @@ -15,17 +15,15 @@ #ifndef LLVM_TRANSFORMS_SCALAR_H #define LLVM_TRANSFORMS_SCALAR_H -#include - namespace llvm { class FunctionPass; -class LoopPass; class Pass; class GetElementPtrInst; class PassInfo; class TerminatorInst; class TargetLowering; +class TargetMachine; //===----------------------------------------------------------------------===// // @@ -73,26 +71,27 @@ FunctionPass *createAggressiveDCEPass(); //===----------------------------------------------------------------------===// // -// ScalarReplAggregates - Break up alloca's of aggregates into multiple allocas -// if possible. +// SROA - Replace aggregates or pieces of aggregates with scalar SSA values. // -FunctionPass *createScalarReplAggregatesPass(signed Threshold = -1); +FunctionPass *createSROAPass(bool RequiresDomTree = true); //===----------------------------------------------------------------------===// // -// GCSE - This pass is designed to be a very quick global transformation that -// eliminates global common subexpressions from a function. It does this by -// examining the SSA value graph of the function, instead of doing slow -// bit-vector computations. +// ScalarReplAggregates - Break up alloca's of aggregates into multiple allocas +// if possible. // -FunctionPass *createGCSEPass(); +FunctionPass *createScalarReplAggregatesPass(signed Threshold = -1, + bool UseDomTree = true, + signed StructMemberThreshold = -1, + signed ArrayElementThreshold = -1, + signed ScalarLoadThreshold = -1); //===----------------------------------------------------------------------===// // // InductionVariableSimplify - Transform induction variables in a program to all // use a single canonical induction variable per loop. // -LoopPass *createIndVarSimplifyPass(); +Pass *createIndVarSimplifyPass(); //===----------------------------------------------------------------------===// // @@ -112,43 +111,47 @@ FunctionPass *createInstructionCombiningPass(); // // LICM - This pass is a loop invariant code motion and memory promotion pass. // -LoopPass *createLICMPass(); +Pass *createLICMPass(); //===----------------------------------------------------------------------===// // // LoopStrengthReduce - This pass is strength reduces GEP instructions that use -// a loop's canonical induction variable as one of their indices. It takes an -// optional parameter used to consult the target machine whether certain -// transformations are profitable. +// a loop's canonical induction variable as one of their indices. // -LoopPass *createLoopStrengthReducePass(const TargetLowering *TLI = 0); +Pass *createLoopStrengthReducePass(); + +Pass *createGlobalMergePass(const TargetMachine *TM = 0); //===----------------------------------------------------------------------===// // // LoopUnswitch - This pass is a simple loop unswitching pass. // -LoopPass *createLoopUnswitchPass(bool OptimizeForSize = false); +Pass *createLoopUnswitchPass(bool OptimizeForSize = false); + +//===----------------------------------------------------------------------===// +// +// LoopInstSimplify - This pass simplifies instructions in a loop's body. +// +Pass *createLoopInstSimplifyPass(); //===----------------------------------------------------------------------===// // // LoopUnroll - This pass is a simple loop unrolling pass. // -LoopPass *createLoopUnrollPass(); +Pass *createLoopUnrollPass(int Threshold = -1, int Count = -1, int AllowPartial = -1); //===----------------------------------------------------------------------===// // // LoopRotate - This pass is a simple loop rotating pass. // -LoopPass *createLoopRotatePass(); +Pass *createLoopRotatePass(); //===----------------------------------------------------------------------===// // -// LoopIndexSplit - This pass divides loop's iteration range by spliting loop -// such that each individual loop is executed efficiently. +// LoopIdiom - This pass recognizes and replaces idioms in loops. // -LoopPass *createLoopIndexSplitPass(); - - +Pass *createLoopIdiomPass(); + //===----------------------------------------------------------------------===// // // PromoteMemoryToRegister - This pass is used to promote memory references to @@ -156,13 +159,12 @@ LoopPass *createLoopIndexSplitPass(); // this pass is: // // FROM CODE TO CODE -// %X = alloca int, uint 1 ret int 42 -// store int 42, int *%X -// %Y = load int* %X -// ret int %Y +// %X = alloca i32, i32 1 ret i32 42 +// store i32 42, i32 *%X +// %Y = load i32* %X +// ret i32 %Y // FunctionPass *createPromoteMemoryToRegisterPass(); -extern const PassInfo *PromoteMemoryToRegisterID; //===----------------------------------------------------------------------===// // @@ -171,7 +173,7 @@ extern const PassInfo *PromoteMemoryToRegisterID; // hacking easier. // FunctionPass *createDemoteRegisterToMemoryPass(); -extern const PassInfo *DemoteRegisterToMemoryID; +extern char &DemoteRegisterToMemoryID; //===----------------------------------------------------------------------===// // @@ -184,36 +186,30 @@ FunctionPass *createReassociatePass(); //===----------------------------------------------------------------------===// // -// CorrelatedExpressionElimination - This pass eliminates correlated -// conditions, such as these: -// if (X == 0) -// if (X > 2) ; // Known false -// else -// Y = X * Z; // = 0 +// JumpThreading - Thread control through mult-pred/multi-succ blocks where some +// preds always go to some succ. // -FunctionPass *createCorrelatedExpressionEliminationPass(); - +FunctionPass *createJumpThreadingPass(); + //===----------------------------------------------------------------------===// // -// CondPropagationPass - This pass propagates information about conditional -// expressions through the program, allowing it to eliminate conditional -// branches in some cases. +// CFGSimplification - Merge basic blocks, eliminate unreachable blocks, +// simplify terminator instructions, etc... // -FunctionPass *createCondPropagationPass(); +FunctionPass *createCFGSimplificationPass(); //===----------------------------------------------------------------------===// // -// TailDuplication - Eliminate unconditional branches through controlled code -// duplication, creating simpler CFG structures. +// FlattenCFG - flatten CFG, reduce number of conditional branches by using +// parallel-and and parallel-or mode, etc... // -FunctionPass *createTailDuplicationPass(); +FunctionPass *createFlattenCFGPass(); //===----------------------------------------------------------------------===// // -// CFGSimplification - Merge basic blocks, eliminate unreachable blocks, -// simplify terminator instructions, etc... +// CFG Structurization - Remove irreducible control flow // -FunctionPass *createCFGSimplificationPass(); +Pass *createStructurizeCFGPass(); //===----------------------------------------------------------------------===// // @@ -227,7 +223,7 @@ FunctionPass *createCFGSimplificationPass(); // (set, immediate dominators, tree, and frontier) information. // FunctionPass *createBreakCriticalEdgesPass(); -extern const PassInfo *BreakCriticalEdgesID; +extern char &BreakCriticalEdgesID; //===----------------------------------------------------------------------===// // @@ -237,27 +233,8 @@ extern const PassInfo *BreakCriticalEdgesID; // // AU.addRequiredID(LoopSimplifyID); // -FunctionPass *createLoopSimplifyPass(); -extern const PassInfo *LoopSimplifyID; - -//===----------------------------------------------------------------------===// -// -// LowerSelect - This pass converts SelectInst instructions into conditional -// branch and PHI instructions. If the OnlyFP flag is set to true, then only -// floating point select instructions are lowered. -// -FunctionPass *createLowerSelectPass(bool OnlyFP = false); -extern const PassInfo *LowerSelectID; - -//===----------------------------------------------------------------------===// -// -// LowerAllocations - Turn malloc and free instructions into %malloc and %free -// calls. -// -// AU.addRequiredID(LowerAllocationsID); -// -Pass *createLowerAllocationsPass(bool LowerMallocArgToInteger = false); -extern const PassInfo *LowerAllocationsID; +Pass *createLoopSimplifyPass(); +extern char &LoopSimplifyID; //===----------------------------------------------------------------------===// // @@ -272,14 +249,7 @@ FunctionPass *createTailCallEliminationPass(); // chained binary branch instructions. // FunctionPass *createLowerSwitchPass(); -extern const PassInfo *LowerSwitchID; - -//===----------------------------------------------------------------------===// -// -// LowerPacked - This pass converts VectorType operations into low-level scalar -// operations. -// -FunctionPass *createLowerPackedPass(); +extern char &LowerSwitchID; //===----------------------------------------------------------------------===// // @@ -291,63 +261,98 @@ FunctionPass *createLowerPackedPass(); // purpose "my LLVM-to-LLVM pass doesn't support the invoke instruction yet" // lowering pass. // -FunctionPass *createLowerInvokePass(const TargetLowering *TLI = NULL); -extern const PassInfo *LowerInvokePassID; +FunctionPass *createLowerInvokePass(const TargetMachine *TM = 0, + bool useExpensiveEHSupport = false); +extern char &LowerInvokePassID; //===----------------------------------------------------------------------===// // -// LowerGCPass - This function returns an instance of the "lowergc" pass, which -// lowers garbage collection intrinsics to normal LLVM code. +// LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop +// optimizations. // -FunctionPass *createLowerGCPass(); +Pass *createLCSSAPass(); +extern char &LCSSAID; //===----------------------------------------------------------------------===// // -// BlockPlacement - This pass reorders basic blocks in order to increase the -// number of fall-through conditional branches. +// EarlyCSE - This pass performs a simple and fast CSE pass over the dominator +// tree. // -FunctionPass *createBlockPlacementPass(); +FunctionPass *createEarlyCSEPass(); + +//===----------------------------------------------------------------------===// +// +// GVN - This pass performs global value numbering and redundant load +// elimination cotemporaneously. +// +FunctionPass *createGVNPass(bool NoLoads = false); //===----------------------------------------------------------------------===// // -// LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop -// optimizations. +// MemCpyOpt - This pass performs optimizations related to eliminating memcpy +// calls and/or combining multiple stores into memset's. +// +FunctionPass *createMemCpyOptPass(); + +//===----------------------------------------------------------------------===// +// +// LoopDeletion - This pass performs DCE of non-infinite loops that it +// can prove are dead. // -LoopPass *createLCSSAPass(); -extern const PassInfo *LCSSAID; +Pass *createLoopDeletionPass(); + +//===----------------------------------------------------------------------===// +// +// CodeGenPrepare - This pass prepares a function for instruction selection. +// +FunctionPass *createCodeGenPreparePass(const TargetMachine *TM = 0); //===----------------------------------------------------------------------===// // -// PredicateSimplifier - This pass collapses duplicate variables into one -// canonical form, and tries to simplify expressions along the way. +// InstructionNamer - Give any unnamed non-void instructions "tmp" names. // -FunctionPass *createPredicateSimplifierPass(); +FunctionPass *createInstructionNamerPass(); +extern char &InstructionNamerID; + +//===----------------------------------------------------------------------===// +// +// Sink - Code Sinking +// +FunctionPass *createSinkingPass(); //===----------------------------------------------------------------------===// // -// GVN-PRE - This pass performs global value numbering and partial redundancy -// elimination. +// LowerAtomic - Lower atomic intrinsics to non-atomic form // -FunctionPass *createGVNPREPass(); +Pass *createLowerAtomicPass(); //===----------------------------------------------------------------------===// // -// AutoVectorize - This pass performs vectorization of straight-line code +// ValuePropagation - Propagate CFG-derived value information // -FunctionPass *createAutoVectorizePass(); +Pass *createCorrelatedValuePropagationPass(); //===----------------------------------------------------------------------===// // -// GVN - This pass performs global value numbering and redundant load -// elimination cotemporaneously. +// InstructionSimplifier - Remove redundant instructions. // -FunctionPass *createGVNPass(); +FunctionPass *createInstructionSimplifierPass(); +extern char &InstructionSimplifierID; + //===----------------------------------------------------------------------===// // -// CodeGenPrepare - This pass prepares a function for instruction selection. +// LowerExpectIntrinsics - Removes llvm.expect intrinsics and creates +// "block_weights" metadata. +FunctionPass *createLowerExpectIntrinsicPass(); + + +//===----------------------------------------------------------------------===// +// +// PartiallyInlineLibCalls - Tries to inline the fast path of library +// calls such as sqrt. // -FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0); +FunctionPass *createPartiallyInlineLibCallsPass(); } // End llvm namespace