|
|
|||
File indexing completed on 2026-05-10 08:44:45
0001 //===-- Scalar.h - Scalar Transformations -----------------------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This header file defines prototypes for accessor functions that expose passes 0010 // in the Scalar transformations library. 0011 // 0012 //===----------------------------------------------------------------------===// 0013 0014 #ifndef LLVM_TRANSFORMS_SCALAR_H 0015 #define LLVM_TRANSFORMS_SCALAR_H 0016 0017 #include "llvm/Transforms/Utils/SimplifyCFGOptions.h" 0018 #include <functional> 0019 0020 namespace llvm { 0021 0022 class Function; 0023 class FunctionPass; 0024 class Pass; 0025 0026 //===----------------------------------------------------------------------===// 0027 // 0028 // DeadCodeElimination - This pass is more powerful than DeadInstElimination, 0029 // because it is worklist driven that can potentially revisit instructions when 0030 // their other instructions become dead, to eliminate chains of dead 0031 // computations. 0032 // 0033 FunctionPass *createDeadCodeEliminationPass(); 0034 0035 //===----------------------------------------------------------------------===// 0036 // 0037 // SROA - Replace aggregates or pieces of aggregates with scalar SSA values. 0038 // 0039 FunctionPass *createSROAPass(bool PreserveCFG = true); 0040 0041 //===----------------------------------------------------------------------===// 0042 // 0043 // LICM - This pass is a loop invariant code motion and memory promotion pass. 0044 // 0045 Pass *createLICMPass(); 0046 0047 //===----------------------------------------------------------------------===// 0048 // 0049 // LoopStrengthReduce - This pass is strength reduces GEP instructions that use 0050 // a loop's canonical induction variable as one of their indices. 0051 // 0052 Pass *createLoopStrengthReducePass(); 0053 0054 //===----------------------------------------------------------------------===// 0055 // 0056 // LoopTermFold - This pass attempts to eliminate the last use of an IV in 0057 // a loop terminator instruction by rewriting it in terms of another IV. 0058 // Expected to be run immediately after LSR. 0059 // 0060 Pass *createLoopTermFoldPass(); 0061 0062 //===----------------------------------------------------------------------===// 0063 // 0064 // LoopUnroll - This pass is a simple loop unrolling pass. 0065 // 0066 Pass *createLoopUnrollPass(int OptLevel = 2, bool OnlyWhenForced = false, 0067 bool ForgetAllSCEV = false, int Threshold = -1, 0068 int Count = -1, int AllowPartial = -1, 0069 int Runtime = -1, int UpperBound = -1, 0070 int AllowPeeling = -1); 0071 0072 //===----------------------------------------------------------------------===// 0073 // 0074 // Reassociate - This pass reassociates commutative expressions in an order that 0075 // is designed to promote better constant propagation, GCSE, LICM, PRE... 0076 // 0077 // For example: 4 + (x + 5) -> x + (4 + 5) 0078 // 0079 FunctionPass *createReassociatePass(); 0080 0081 //===----------------------------------------------------------------------===// 0082 // 0083 // CFGSimplification - Merge basic blocks, eliminate unreachable blocks, 0084 // simplify terminator instructions, convert switches to lookup tables, etc. 0085 // 0086 FunctionPass *createCFGSimplificationPass( 0087 SimplifyCFGOptions Options = SimplifyCFGOptions(), 0088 std::function<bool(const Function &)> Ftor = nullptr); 0089 0090 //===----------------------------------------------------------------------===// 0091 // 0092 // FlattenCFG - flatten CFG, reduce number of conditional branches by using 0093 // parallel-and and parallel-or mode, etc... 0094 // 0095 FunctionPass *createFlattenCFGPass(); 0096 0097 //===----------------------------------------------------------------------===// 0098 // 0099 // CFG Structurization - Remove irreducible control flow 0100 // 0101 /// 0102 /// When \p SkipUniformRegions is true the structizer will not structurize 0103 /// regions that only contain uniform branches. 0104 Pass *createStructurizeCFGPass(bool SkipUniformRegions = false); 0105 0106 //===----------------------------------------------------------------------===// 0107 // 0108 // TailCallElimination - This pass eliminates call instructions to the current 0109 // function which occur immediately before return instructions. 0110 // 0111 FunctionPass *createTailCallEliminationPass(); 0112 0113 //===----------------------------------------------------------------------===// 0114 // 0115 // EarlyCSE - This pass performs a simple and fast CSE pass over the dominator 0116 // tree. 0117 // 0118 FunctionPass *createEarlyCSEPass(bool UseMemorySSA = false); 0119 0120 //===----------------------------------------------------------------------===// 0121 // 0122 // ConstantHoisting - This pass prepares a function for expensive constants. 0123 // 0124 FunctionPass *createConstantHoistingPass(); 0125 0126 //===----------------------------------------------------------------------===// 0127 // 0128 // Sink - Code Sinking 0129 // 0130 FunctionPass *createSinkingPass(); 0131 0132 //===----------------------------------------------------------------------===// 0133 // 0134 // LowerAtomic - Lower atomic intrinsics to non-atomic form 0135 // 0136 Pass *createLowerAtomicPass(); 0137 0138 //===----------------------------------------------------------------------===// 0139 // 0140 // MergeICmps - Merge integer comparison chains into a memcmp 0141 // 0142 Pass *createMergeICmpsLegacyPass(); 0143 0144 //===----------------------------------------------------------------------===// 0145 // 0146 // InferAddressSpaces - Modify users of addrspacecast instructions with values 0147 // in the source address space if using the destination address space is slower 0148 // on the target. If AddressSpace is left to its default value, it will be 0149 // obtained from the TargetTransformInfo. 0150 // 0151 FunctionPass *createInferAddressSpacesPass(unsigned AddressSpace = ~0u); 0152 extern char &InferAddressSpacesID; 0153 0154 //===----------------------------------------------------------------------===// 0155 // 0156 // PartiallyInlineLibCalls - Tries to inline the fast path of library 0157 // calls such as sqrt. 0158 // 0159 FunctionPass *createPartiallyInlineLibCallsPass(); 0160 0161 //===----------------------------------------------------------------------===// 0162 // 0163 // SeparateConstOffsetFromGEP - Split GEPs for better CSE 0164 // 0165 FunctionPass *createSeparateConstOffsetFromGEPPass(bool LowerGEP = false); 0166 0167 //===----------------------------------------------------------------------===// 0168 // 0169 // SpeculativeExecution - Aggressively hoist instructions to enable 0170 // speculative execution on targets where branches are expensive. 0171 // 0172 FunctionPass *createSpeculativeExecutionPass(); 0173 0174 // Same as createSpeculativeExecutionPass, but does nothing unless 0175 // TargetTransformInfo::hasBranchDivergence() is true. 0176 FunctionPass *createSpeculativeExecutionIfHasBranchDivergencePass(); 0177 0178 //===----------------------------------------------------------------------===// 0179 // 0180 // StraightLineStrengthReduce - This pass strength-reduces some certain 0181 // instruction patterns in straight-line code. 0182 // 0183 FunctionPass *createStraightLineStrengthReducePass(); 0184 0185 //===----------------------------------------------------------------------===// 0186 // 0187 // NaryReassociate - Simplify n-ary operations by reassociation. 0188 // 0189 FunctionPass *createNaryReassociatePass(); 0190 0191 //===----------------------------------------------------------------------===// 0192 // 0193 // LoopDataPrefetch - Perform data prefetching in loops. 0194 // 0195 FunctionPass *createLoopDataPrefetchPass(); 0196 0197 //===----------------------------------------------------------------------===// 0198 // 0199 // This pass does instruction simplification on each 0200 // instruction in a function. 0201 // 0202 FunctionPass *createInstSimplifyLegacyPass(); 0203 0204 0205 //===----------------------------------------------------------------------===// 0206 // 0207 // createScalarizeMaskedMemIntrinPass - Replace masked load, store, gather 0208 // and scatter intrinsics with scalar code when target doesn't support them. 0209 // 0210 FunctionPass *createScalarizeMaskedMemIntrinLegacyPass(); 0211 } // End llvm namespace 0212 0213 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|