LLVM 23.0.0git
Scalar.h
Go to the documentation of this file.
1//===-- Scalar.h - Scalar Transformations -----------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This header file defines prototypes for accessor functions that expose passes
10// in the Scalar transformations library.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TRANSFORMS_SCALAR_H
15#define LLVM_TRANSFORMS_SCALAR_H
16
19#include <functional>
20
21namespace llvm {
22
23class Function;
24class FunctionPass;
25class Pass;
26
27//===----------------------------------------------------------------------===//
28//
29// DeadCodeElimination - This pass is more powerful than DeadInstElimination,
30// because it is worklist driven that can potentially revisit instructions when
31// their other instructions become dead, to eliminate chains of dead
32// computations.
33//
35
36//===----------------------------------------------------------------------===//
37//
38// DeadStoreElimination - This pass deletes stores that are post-dominated by
39// must-aliased stores and are not loaded used between the stores.
40//
42
43//===----------------------------------------------------------------------===//
44//
45// SROA - Replace aggregates or pieces of aggregates with scalar SSA values.
46//
47LLVM_ABI FunctionPass *createSROAPass(bool PreserveCFG = true,
48 bool AggregateToVector = false);
49
50//===----------------------------------------------------------------------===//
51//
52// LICM - This pass is a loop invariant code motion and memory promotion pass.
53//
55
56//===----------------------------------------------------------------------===//
57//
58// LoopStrengthReduce - This pass is strength reduces GEP instructions that use
59// a loop's canonical induction variable as one of their indices.
60//
62
63//===----------------------------------------------------------------------===//
64//
65// LoopTermFold - This pass attempts to eliminate the last use of an IV in
66// a loop terminator instruction by rewriting it in terms of another IV.
67// Expected to be run immediately after LSR.
68//
70
71//===----------------------------------------------------------------------===//
72//
73// LoopUnroll - This pass is a simple loop unrolling pass.
74//
75LLVM_ABI Pass *createLoopUnrollPass(int OptLevel = 2,
76 bool OnlyWhenForced = false,
77 bool ForgetAllSCEV = false,
78 int Threshold = -1, int Count = -1,
79 int AllowPartial = -1, int Runtime = -1,
80 int UpperBound = -1, int AllowPeeling = -1);
81
82//===----------------------------------------------------------------------===//
83//
84// Reassociate - This pass reassociates commutative expressions in an order that
85// is designed to promote better constant propagation, GCSE, LICM, PRE...
86//
87// For example: 4 + (x + 5) -> x + (4 + 5)
88//
90
91//===----------------------------------------------------------------------===//
92//
93// CFGSimplification - Merge basic blocks, eliminate unreachable blocks,
94// simplify terminator instructions, convert switches to lookup tables, etc.
95//
98 std::function<bool(const Function &)> Ftor = nullptr);
99
100//===----------------------------------------------------------------------===//
101//
102// FlattenCFG - flatten CFG, reduce number of conditional branches by using
103// parallel-and and parallel-or mode, etc...
104//
106
107//===----------------------------------------------------------------------===//
108//
109// CFG Structurization - Remove irreducible control flow
110//
111///
112/// When \p SkipUniformRegions is true the structizer will not structurize
113/// regions that only contain uniform branches.
114LLVM_ABI Pass *createStructurizeCFGPass(bool SkipUniformRegions = false);
115
116//===----------------------------------------------------------------------===//
117//
118// TailCallElimination - This pass eliminates call instructions to the current
119// function which occur immediately before return instructions.
120//
122
123//===----------------------------------------------------------------------===//
124//
125// EarlyCSE - This pass performs a simple and fast CSE pass over the dominator
126// tree.
127//
128LLVM_ABI FunctionPass *createEarlyCSEPass(bool UseMemorySSA = false);
129
130//===----------------------------------------------------------------------===//
131//
132// ConstantHoisting - This pass prepares a function for expensive constants.
133//
135
136//===----------------------------------------------------------------------===//
137//
138// Sink - Code Sinking
139//
141
142//===----------------------------------------------------------------------===//
143//
144// LowerAtomic - Lower atomic intrinsics to non-atomic form
145//
147
148//===----------------------------------------------------------------------===//
149//===----------------------------------------------------------------------===//
150//
151// InferAddressSpaces - Modify users of addrspacecast instructions with values
152// in the source address space if using the destination address space is slower
153// on the target. If AddressSpace is left to its default value, it will be
154// obtained from the TargetTransformInfo.
155//
158LLVM_ABI extern char &InferAddressSpacesID;
159
160//===----------------------------------------------------------------------===//
161//
162// PartiallyInlineLibCalls - Tries to inline the fast path of library
163// calls such as sqrt.
164//
166
167//===----------------------------------------------------------------------===//
168//
169// SeparateConstOffsetFromGEP - Split GEPs for better CSE
170//
172createSeparateConstOffsetFromGEPPass(bool LowerGEP = false);
173
174//===----------------------------------------------------------------------===//
175//
176// SpeculativeExecution - Aggressively hoist instructions to enable
177// speculative execution on targets where branches are expensive.
178//
180
181// Same as createSpeculativeExecutionPass, but does nothing unless
182// TargetTransformInfo::hasBranchDivergence() is true.
184
185//===----------------------------------------------------------------------===//
186//
187// StraightLineStrengthReduce - This pass strength-reduces some certain
188// instruction patterns in straight-line code.
189//
191
192//===----------------------------------------------------------------------===//
193//
194// NaryReassociate - Simplify n-ary operations by reassociation.
195//
197
198//===----------------------------------------------------------------------===//
199//
200// LoopDataPrefetch - Perform data prefetching in loops.
201//
203
204//===----------------------------------------------------------------------===//
205//
206// This pass does instruction simplification on each
207// instruction in a function.
208//
210
211//===----------------------------------------------------------------------===//
212//
213// createScalarizeMaskedMemIntrinPass - Replace masked load, store, gather
214// and scatter intrinsics with scalar code when target doesn't support them.
215//
217} // End llvm namespace
218
219#endif
#define LLVM_ABI
Definition Compiler.h:213
static LVOptions Options
Definition LVOptions.cpp:25
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
Pass interface - Implemented by all 'passes'.
Definition Pass.h:99
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI FunctionPass * createFlattenCFGPass()
LLVM_ABI FunctionPass * createCFGSimplificationPass(SimplifyCFGOptions Options=SimplifyCFGOptions(), std::function< bool(const Function &)> Ftor=nullptr)
LLVM_ABI FunctionPass * createTailCallEliminationPass()
LLVM_ABI FunctionPass * createConstantHoistingPass()
@ Runtime
Detect stack use after return if not disabled runtime with (ASAN_OPTIONS=detect_stack_use_after_retur...
LLVM_ABI FunctionPass * createDeadCodeEliminationPass()
Definition DCE.cpp:145
LLVM_ABI FunctionPass * createSpeculativeExecutionIfHasBranchDivergencePass()
LLVM_ABI FunctionPass * createNaryReassociatePass()
LLVM_ABI FunctionPass * createScalarizeMaskedMemIntrinLegacyPass()
LLVM_ABI Pass * createLowerAtomicPass()
LLVM_ABI Pass * createLoopTermFoldPass()
LLVM_ABI Pass * createStructurizeCFGPass(bool SkipUniformRegions=false)
When SkipUniformRegions is true the structizer will not structurize regions that only contain uniform...
LLVM_ABI Pass * createLICMPass()
Definition LICM.cpp:386
LLVM_ABI Pass * createLoopUnrollPass(int OptLevel=2, bool OnlyWhenForced=false, bool ForgetAllSCEV=false, int Threshold=-1, int Count=-1, int AllowPartial=-1, int Runtime=-1, int UpperBound=-1, int AllowPeeling=-1)
LLVM_ABI char & InferAddressSpacesID
LLVM_ABI FunctionPass * createSinkingPass()
Definition Sink.cpp:275
LLVM_ABI FunctionPass * createLoopDataPrefetchPass()
LLVM_ABI FunctionPass * createSpeculativeExecutionPass()
FunctionAddr VTableAddr Count
Definition InstrProf.h:139
LLVM_ABI FunctionPass * createSeparateConstOffsetFromGEPPass(bool LowerGEP=false)
LLVM_ABI FunctionPass * createReassociatePass()
LLVM_ABI Pass * createLoopStrengthReducePass()
LLVM_ABI FunctionPass * createSROAPass(bool PreserveCFG=true, bool AggregateToVector=false)
Definition SROA.cpp:6180
LLVM_ABI FunctionPass * createInferAddressSpacesPass(unsigned AddressSpace=~0u)
LLVM_ABI FunctionPass * createDeadStoreEliminationPass()
LLVM_ABI FunctionPass * createPartiallyInlineLibCallsPass()
LLVM_ABI FunctionPass * createStraightLineStrengthReducePass()
LLVM_ABI FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
LLVM_ABI FunctionPass * createInstSimplifyLegacyPass()