LLVM 22.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//
48
49//===----------------------------------------------------------------------===//
50//
51// LICM - This pass is a loop invariant code motion and memory promotion pass.
52//
54
55//===----------------------------------------------------------------------===//
56//
57// LoopStrengthReduce - This pass is strength reduces GEP instructions that use
58// a loop's canonical induction variable as one of their indices.
59//
61
62//===----------------------------------------------------------------------===//
63//
64// LoopTermFold - This pass attempts to eliminate the last use of an IV in
65// a loop terminator instruction by rewriting it in terms of another IV.
66// Expected to be run immediately after LSR.
67//
69
70//===----------------------------------------------------------------------===//
71//
72// LoopUnroll - This pass is a simple loop unrolling pass.
73//
74LLVM_ABI Pass *createLoopUnrollPass(int OptLevel = 2,
75 bool OnlyWhenForced = false,
76 bool ForgetAllSCEV = false,
77 int Threshold = -1, int Count = -1,
78 int AllowPartial = -1, int Runtime = -1,
79 int UpperBound = -1, int AllowPeeling = -1);
80
81//===----------------------------------------------------------------------===//
82//
83// Reassociate - This pass reassociates commutative expressions in an order that
84// is designed to promote better constant propagation, GCSE, LICM, PRE...
85//
86// For example: 4 + (x + 5) -> x + (4 + 5)
87//
89
90//===----------------------------------------------------------------------===//
91//
92// CFGSimplification - Merge basic blocks, eliminate unreachable blocks,
93// simplify terminator instructions, convert switches to lookup tables, etc.
94//
97 std::function<bool(const Function &)> Ftor = nullptr);
98
99//===----------------------------------------------------------------------===//
100//
101// FlattenCFG - flatten CFG, reduce number of conditional branches by using
102// parallel-and and parallel-or mode, etc...
103//
105
106//===----------------------------------------------------------------------===//
107//
108// CFG Structurization - Remove irreducible control flow
109//
110///
111/// When \p SkipUniformRegions is true the structizer will not structurize
112/// regions that only contain uniform branches.
113LLVM_ABI Pass *createStructurizeCFGPass(bool SkipUniformRegions = false);
114
115//===----------------------------------------------------------------------===//
116//
117// TailCallElimination - This pass eliminates call instructions to the current
118// function which occur immediately before return instructions.
119//
121
122//===----------------------------------------------------------------------===//
123//
124// EarlyCSE - This pass performs a simple and fast CSE pass over the dominator
125// tree.
126//
127LLVM_ABI FunctionPass *createEarlyCSEPass(bool UseMemorySSA = false);
128
129//===----------------------------------------------------------------------===//
130//
131// ConstantHoisting - This pass prepares a function for expensive constants.
132//
134
135//===----------------------------------------------------------------------===//
136//
137// Sink - Code Sinking
138//
140
141//===----------------------------------------------------------------------===//
142//
143// LowerAtomic - Lower atomic intrinsics to non-atomic form
144//
146
147//===----------------------------------------------------------------------===//
148//
149// MergeICmps - Merge integer comparison chains into a memcmp
150//
152
153//===----------------------------------------------------------------------===//
154//
155// InferAddressSpaces - Modify users of addrspacecast instructions with values
156// in the source address space if using the destination address space is slower
157// on the target. If AddressSpace is left to its default value, it will be
158// obtained from the TargetTransformInfo.
159//
162LLVM_ABI extern char &InferAddressSpacesID;
163
164//===----------------------------------------------------------------------===//
165//
166// PartiallyInlineLibCalls - Tries to inline the fast path of library
167// calls such as sqrt.
168//
170
171//===----------------------------------------------------------------------===//
172//
173// SeparateConstOffsetFromGEP - Split GEPs for better CSE
174//
176createSeparateConstOffsetFromGEPPass(bool LowerGEP = false);
177
178//===----------------------------------------------------------------------===//
179//
180// SpeculativeExecution - Aggressively hoist instructions to enable
181// speculative execution on targets where branches are expensive.
182//
184
185// Same as createSpeculativeExecutionPass, but does nothing unless
186// TargetTransformInfo::hasBranchDivergence() is true.
188
189//===----------------------------------------------------------------------===//
190//
191// StraightLineStrengthReduce - This pass strength-reduces some certain
192// instruction patterns in straight-line code.
193//
195
196//===----------------------------------------------------------------------===//
197//
198// NaryReassociate - Simplify n-ary operations by reassociation.
199//
201
202//===----------------------------------------------------------------------===//
203//
204// LoopDataPrefetch - Perform data prefetching in loops.
205//
207
208//===----------------------------------------------------------------------===//
209//
210// This pass does instruction simplification on each
211// instruction in a function.
212//
214
215//===----------------------------------------------------------------------===//
216//
217// createScalarizeMaskedMemIntrinPass - Replace masked load, store, gather
218// and scatter intrinsics with scalar code when target doesn't support them.
219//
221} // End llvm namespace
222
223#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 * createDeadStoreEliminationPass()
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:384
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 Pass * createMergeICmpsLegacyPass()
LLVM_ABI FunctionPass * createReassociatePass()
LLVM_ABI Pass * createLoopStrengthReducePass()
LLVM_ABI FunctionPass * createInferAddressSpacesPass(unsigned AddressSpace=~0u)
LLVM_ABI FunctionPass * createPartiallyInlineLibCallsPass()
LLVM_ABI FunctionPass * createStraightLineStrengthReducePass()
LLVM_ABI FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
LLVM_ABI FunctionPass * createSROAPass(bool PreserveCFG=true)
Definition SROA.cpp:5805
LLVM_ABI FunctionPass * createInstSimplifyLegacyPass()