X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FTransforms%2FScalar.h;h=672325f3f88e66717dfd596cbb60c65cdf6ffa4f;hb=f61cd8b3681734a86d4cb81acb08d433924be352;hp=4d1d8636f612065bf83d237ab169c51e7e4563ba;hpb=3bababf880bfeaf1bcda7e4f808007621b6bfac8;p=oota-llvm.git diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h index 4d1d8636f61..672325f3f88 100644 --- a/include/llvm/Transforms/Scalar.h +++ b/include/llvm/Transforms/Scalar.h @@ -15,14 +15,19 @@ #ifndef LLVM_TRANSFORMS_SCALAR_H #define LLVM_TRANSFORMS_SCALAR_H +#include "llvm/ADT/StringRef.h" + namespace llvm { +class BasicBlockPass; class FunctionPass; +class ModulePass; class Pass; class GetElementPtrInst; class PassInfo; class TerminatorInst; class TargetLowering; +class TargetMachine; //===----------------------------------------------------------------------===// // @@ -30,6 +35,13 @@ class TargetLowering; // FunctionPass *createConstantPropagationPass(); +//===----------------------------------------------------------------------===// +// +// AlignmentFromAssumptions - Use assume intrinsics to set load/store +// alignments. +// +FunctionPass *createAlignmentFromAssumptionsPass(); + //===----------------------------------------------------------------------===// // // SCCP - Sparse conditional constant propagation. @@ -68,12 +80,36 @@ FunctionPass *createDeadStoreEliminationPass(); // FunctionPass *createAggressiveDCEPass(); +//===----------------------------------------------------------------------===// +// +// BitTrackingDCE - This pass uses a bit-tracking DCE algorithm in order to +// remove computations of dead bits. +// +FunctionPass *createBitTrackingDCEPass(); + +//===----------------------------------------------------------------------===// +// +// SROA - Replace aggregates or pieces of aggregates with scalar SSA values. +// +FunctionPass *createSROAPass(bool RequiresDomTree = true); + //===----------------------------------------------------------------------===// // // ScalarReplAggregates - Break up alloca's of aggregates into multiple allocas // if possible. // -FunctionPass *createScalarReplAggregatesPass(signed Threshold = -1); +FunctionPass *createScalarReplAggregatesPass(signed Threshold = -1, + bool UseDomTree = true, + signed StructMemberThreshold = -1, + signed ArrayElementThreshold = -1, + signed ScalarLoadThreshold = -1); + +//===----------------------------------------------------------------------===// +// +// InductiveRangeCheckElimination - Transform loops to elide range checks on +// linear functions of the induction variable. +// +Pass *createInductiveRangeCheckEliminationPass(); //===----------------------------------------------------------------------===// // @@ -102,14 +138,21 @@ FunctionPass *createInstructionCombiningPass(); // Pass *createLICMPass(); +//===----------------------------------------------------------------------===// +// +// LoopInterchange - This pass interchanges loops to provide a more +// cache-friendly memory access patterns. +// +Pass *createLoopInterchangePass(); + //===----------------------------------------------------------------------===// // // 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. // -Pass *createLoopStrengthReducePass(const TargetLowering *TLI = 0); +Pass *createLoopStrengthReducePass(); + +Pass *createGlobalMergePass(const TargetMachine *TM, unsigned MaximalOffset); //===----------------------------------------------------------------------===// // @@ -117,24 +160,38 @@ Pass *createLoopStrengthReducePass(const TargetLowering *TLI = 0); // 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. // -Pass *createLoopUnrollPass(); +Pass *createLoopUnrollPass(int Threshold = -1, int Count = -1, + int AllowPartial = -1, int Runtime = -1); +// Create an unrolling pass for full unrolling only. +Pass *createSimpleLoopUnrollPass(); + +//===----------------------------------------------------------------------===// +// +// LoopReroll - This pass is a simple loop rerolling pass. +// +Pass *createLoopRerollPass(); //===----------------------------------------------------------------------===// // // LoopRotate - This pass is a simple loop rotating pass. // -Pass *createLoopRotatePass(); +Pass *createLoopRotatePass(int MaxHeaderSize = -1); //===----------------------------------------------------------------------===// // -// 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. // -Pass *createLoopIndexSplitPass(); +Pass *createLoopIdiomPass(); //===----------------------------------------------------------------------===// // @@ -149,7 +206,6 @@ Pass *createLoopIndexSplitPass(); // ret i32 %Y // FunctionPass *createPromoteMemoryToRegisterPass(); -extern const PassInfo *const PromoteMemoryToRegisterID; //===----------------------------------------------------------------------===// // @@ -158,7 +214,7 @@ extern const PassInfo *const PromoteMemoryToRegisterID; // hacking easier. // FunctionPass *createDemoteRegisterToMemoryPass(); -extern const PassInfo *const DemoteRegisterToMemoryID; +extern char &DemoteRegisterToMemoryID; //===----------------------------------------------------------------------===// // @@ -171,24 +227,31 @@ FunctionPass *createReassociatePass(); //===----------------------------------------------------------------------===// // -// TailDuplication - Eliminate unconditional branches through controlled code -// duplication, creating simpler CFG structures. +// JumpThreading - Thread control through mult-pred/multi-succ blocks where some +// preds always go to some succ. Thresholds other than minus one override the +// internal BB duplication default threshold. // -FunctionPass *createTailDuplicationPass(); +FunctionPass *createJumpThreadingPass(int Threshold = -1); //===----------------------------------------------------------------------===// // -// JumpThreading - Thread control through mult-pred/multi-succ blocks where some -// preds always go to some succ. +// CFGSimplification - Merge basic blocks, eliminate unreachable blocks, +// simplify terminator instructions, etc... // -FunctionPass *createJumpThreadingPass(); - +FunctionPass *createCFGSimplificationPass(int Threshold = -1); + //===----------------------------------------------------------------------===// // -// CFGSimplification - Merge basic blocks, eliminate unreachable blocks, -// simplify terminator instructions, etc... +// FlattenCFG - flatten CFG, reduce number of conditional branches by using +// parallel-and and parallel-or mode, etc... +// +FunctionPass *createFlattenCFGPass(); + +//===----------------------------------------------------------------------===// +// +// CFG Structurization - Remove irreducible control flow // -FunctionPass *createCFGSimplificationPass(); +Pass *createStructurizeCFGPass(); //===----------------------------------------------------------------------===// // @@ -202,7 +265,7 @@ FunctionPass *createCFGSimplificationPass(); // (set, immediate dominators, tree, and frontier) information. // FunctionPass *createBreakCriticalEdgesPass(); -extern const PassInfo *const BreakCriticalEdgesID; +extern char &BreakCriticalEdgesID; //===----------------------------------------------------------------------===// // @@ -213,7 +276,7 @@ extern const PassInfo *const BreakCriticalEdgesID; // AU.addRequiredID(LoopSimplifyID); // Pass *createLoopSimplifyPass(); -extern const PassInfo *const LoopSimplifyID; +extern char &LoopSimplifyID; //===----------------------------------------------------------------------===// // @@ -228,41 +291,41 @@ FunctionPass *createTailCallEliminationPass(); // chained binary branch instructions. // FunctionPass *createLowerSwitchPass(); -extern const PassInfo *const LowerSwitchID; +extern char &LowerSwitchID; + +//===----------------------------------------------------------------------===// +// +// LowerInvoke - This pass removes invoke instructions, converting them to call +// instructions. +// +FunctionPass *createLowerInvokePass(); +extern char &LowerInvokePassID; //===----------------------------------------------------------------------===// // -// LowerInvoke - This pass converts invoke and unwind instructions to use sjlj -// exception handling mechanisms. Note that after this pass runs the CFG is not -// entirely accurate (exceptional control flow edges are not correct anymore) so -// only very simple things should be done after the lowerinvoke pass has run -// (like generation of native code). This should *NOT* be used as a general -// purpose "my LLVM-to-LLVM pass doesn't support the invoke instruction yet" -// lowering pass. +// LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop +// optimizations. // -FunctionPass *createLowerInvokePass(const TargetLowering *TLI = 0); -FunctionPass *createLowerInvokePass(const TargetLowering *TLI, - bool useExpensiveEHSupport); -extern const PassInfo *const LowerInvokePassID; +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(); //===----------------------------------------------------------------------===// // -// LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop -// optimizations. +// MergedLoadStoreMotion - This pass merges loads and stores in diamonds. Loads +// are hoisted into the header, while stores sink into the footer. // -Pass *createLCSSAPass(); -extern const PassInfo *const LCSSAID; +FunctionPass *createMergedLoadStoreMotionPass(); //===----------------------------------------------------------------------===// // -// GVN - This pass performs global value numbering and redundant load +// GVN - This pass performs global value numbering and redundant load // elimination cotemporaneously. // FunctionPass *createGVNPass(bool NoLoads = false); @@ -280,69 +343,109 @@ FunctionPass *createMemCpyOptPass(); // can prove are dead. // Pass *createLoopDeletionPass(); - + //===----------------------------------------------------------------------===// // -/// createSimplifyLibCallsPass - This pass optimizes specific calls to -/// specific well-known (library) functions. -FunctionPass *createSimplifyLibCallsPass(); +// ConstantHoisting - This pass prepares a function for expensive constants. +// +FunctionPass *createConstantHoistingPass(); //===----------------------------------------------------------------------===// // -/// createSimplifyHalfPowrLibCallsPass - This is an experimental pass that -/// optimizes specific half_pow functions. -FunctionPass *createSimplifyHalfPowrLibCallsPass(); +// InstructionNamer - Give any unnamed non-void instructions "tmp" names. +// +FunctionPass *createInstructionNamerPass(); +extern char &InstructionNamerID; //===----------------------------------------------------------------------===// // -// CodeGenPrepare - This pass prepares a function for instruction selection. +// Sink - Code Sinking // -FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0); +FunctionPass *createSinkingPass(); //===----------------------------------------------------------------------===// // -// InstructionNamer - Give any unnamed non-void instructions "tmp" names. +// LowerAtomic - Lower atomic intrinsics to non-atomic form // -FunctionPass *createInstructionNamerPass(); -extern const PassInfo *const InstructionNamerID; - +Pass *createLowerAtomicPass(); + //===----------------------------------------------------------------------===// // -// SSI - This pass converts instructions to Static Single Information form -// on demand. +// ValuePropagation - Propagate CFG-derived value information // -FunctionPass *createSSIPass(); +Pass *createCorrelatedValuePropagationPass(); //===----------------------------------------------------------------------===// // -// SSI - This pass converts every non-void instuction to Static Single -// Information form. +// InstructionSimplifier - Remove redundant instructions. // -FunctionPass *createSSIEverythingPass(); +FunctionPass *createInstructionSimplifierPass(); +extern char &InstructionSimplifierID; //===----------------------------------------------------------------------===// // -// GEPSplitter - Split complex GEPs into simple ones +// LowerExpectIntrinsics - Removes llvm.expect intrinsics and creates +// "block_weights" metadata. +FunctionPass *createLowerExpectIntrinsicPass(); + +//===----------------------------------------------------------------------===// // -FunctionPass *createGEPSplitterPass(); +// PartiallyInlineLibCalls - Tries to inline the fast path of library +// calls such as sqrt. +// +FunctionPass *createPartiallyInlineLibCallsPass(); + +//===----------------------------------------------------------------------===// +// +// SampleProfilePass - Loads sample profile data from disk and generates +// IR metadata to reflect the profile. +FunctionPass *createSampleProfileLoaderPass(); +FunctionPass *createSampleProfileLoaderPass(StringRef Name); //===----------------------------------------------------------------------===// // -// ABCD - Elimination of Array Bounds Checks on Demand +// ScalarizerPass - Converts vector operations into scalar operations // -FunctionPass *createABCDPass(); +FunctionPass *createScalarizerPass(); //===----------------------------------------------------------------------===// // -// Sink - Code Sinking +// AddDiscriminators - Add DWARF path discriminators to the IR. +FunctionPass *createAddDiscriminatorsPass(); + +//===----------------------------------------------------------------------===// // -FunctionPass *createSinkingPass(); +// SeparateConstOffsetFromGEP - Split GEPs for better CSE +// +FunctionPass * +createSeparateConstOffsetFromGEPPass(const TargetMachine *TM = nullptr, + bool LowerGEP = false); //===----------------------------------------------------------------------===// // -// LowerAtomic - Lower atomic intrinsics to non-atomic form +// LoadCombine - Combine loads into bigger loads. // -Pass *createLowerAtomicPass(); +BasicBlockPass *createLoadCombinePass(); + +FunctionPass *createStraightLineStrengthReducePass(); + + +//===----------------------------------------------------------------------===// +// +// PlaceSafepoints - Rewrite any IR calls to gc.statepoints and insert any +// safepoint polls (method entry, backedge) that might be required. This pass +// does not generate explicit relocation sequences - that's handled by +// RewriteStatepointsForGC which can be run at an arbitrary point in the pass +// order following this pass. +// +ModulePass *createPlaceSafepointsPass(); + +//===----------------------------------------------------------------------===// +// +// RewriteStatepointsForGC - Rewrite any gc.statepoints which do not yet have +// explicit relocations to include explicit relocations. +// +FunctionPass *createRewriteStatepointsForGCPass(); } // End llvm namespace