LLVM 20.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
18#include <functional>
19
20namespace llvm {
21
22class Function;
23class FunctionPass;
24class Pass;
25
26//===----------------------------------------------------------------------===//
27//
28// DeadCodeElimination - This pass is more powerful than DeadInstElimination,
29// because it is worklist driven that can potentially revisit instructions when
30// their other instructions become dead, to eliminate chains of dead
31// computations.
32//
33FunctionPass *createDeadCodeEliminationPass();
34
35//===----------------------------------------------------------------------===//
36//
37// SROA - Replace aggregates or pieces of aggregates with scalar SSA values.
38//
39FunctionPass *createSROAPass(bool PreserveCFG = true);
40
41//===----------------------------------------------------------------------===//
42//
43// LICM - This pass is a loop invariant code motion and memory promotion pass.
44//
46
47//===----------------------------------------------------------------------===//
48//
49// LoopStrengthReduce - This pass is strength reduces GEP instructions that use
50// a loop's canonical induction variable as one of their indices.
51//
53
54//===----------------------------------------------------------------------===//
55//
56// LoopTermFold - This pass attempts to eliminate the last use of an IV in
57// a loop terminator instruction by rewriting it in terms of another IV.
58// Expected to be run immediately after LSR.
59//
61
62//===----------------------------------------------------------------------===//
63//
64// LoopUnroll - This pass is a simple loop unrolling pass.
65//
66Pass *createLoopUnrollPass(int OptLevel = 2, bool OnlyWhenForced = false,
67 bool ForgetAllSCEV = false, int Threshold = -1,
68 int Count = -1, int AllowPartial = -1,
69 int Runtime = -1, int UpperBound = -1,
70 int AllowPeeling = -1);
71
72//===----------------------------------------------------------------------===//
73//
74// Reassociate - This pass reassociates commutative expressions in an order that
75// is designed to promote better constant propagation, GCSE, LICM, PRE...
76//
77// For example: 4 + (x + 5) -> x + (4 + 5)
78//
80
81//===----------------------------------------------------------------------===//
82//
83// CFGSimplification - Merge basic blocks, eliminate unreachable blocks,
84// simplify terminator instructions, convert switches to lookup tables, etc.
85//
88 std::function<bool(const Function &)> Ftor = nullptr);
89
90//===----------------------------------------------------------------------===//
91//
92// FlattenCFG - flatten CFG, reduce number of conditional branches by using
93// parallel-and and parallel-or mode, etc...
94//
96
97//===----------------------------------------------------------------------===//
98//
99// CFG Structurization - Remove irreducible control flow
100//
101///
102/// When \p SkipUniformRegions is true the structizer will not structurize
103/// regions that only contain uniform branches.
104Pass *createStructurizeCFGPass(bool SkipUniformRegions = false);
105
106//===----------------------------------------------------------------------===//
107//
108// TailCallElimination - This pass eliminates call instructions to the current
109// function which occur immediately before return instructions.
110//
112
113//===----------------------------------------------------------------------===//
114//
115// EarlyCSE - This pass performs a simple and fast CSE pass over the dominator
116// tree.
117//
118FunctionPass *createEarlyCSEPass(bool UseMemorySSA = false);
119
120//===----------------------------------------------------------------------===//
121//
122// ConstantHoisting - This pass prepares a function for expensive constants.
123//
125
126//===----------------------------------------------------------------------===//
127//
128// Sink - Code Sinking
129//
131
132//===----------------------------------------------------------------------===//
133//
134// LowerAtomic - Lower atomic intrinsics to non-atomic form
135//
137
138//===----------------------------------------------------------------------===//
139//
140// MergeICmps - Merge integer comparison chains into a memcmp
141//
143
144//===----------------------------------------------------------------------===//
145//
146// InferAddressSpaces - Modify users of addrspacecast instructions with values
147// in the source address space if using the destination address space is slower
148// on the target. If AddressSpace is left to its default value, it will be
149// obtained from the TargetTransformInfo.
150//
152extern char &InferAddressSpacesID;
153
154//===----------------------------------------------------------------------===//
155//
156// PartiallyInlineLibCalls - Tries to inline the fast path of library
157// calls such as sqrt.
158//
160
161//===----------------------------------------------------------------------===//
162//
163// SeparateConstOffsetFromGEP - Split GEPs for better CSE
164//
166
167//===----------------------------------------------------------------------===//
168//
169// SpeculativeExecution - Aggressively hoist instructions to enable
170// speculative execution on targets where branches are expensive.
171//
173
174// Same as createSpeculativeExecutionPass, but does nothing unless
175// TargetTransformInfo::hasBranchDivergence() is true.
177
178//===----------------------------------------------------------------------===//
179//
180// StraightLineStrengthReduce - This pass strength-reduces some certain
181// instruction patterns in straight-line code.
182//
184
185//===----------------------------------------------------------------------===//
186//
187// NaryReassociate - Simplify n-ary operations by reassociation.
188//
190
191//===----------------------------------------------------------------------===//
192//
193// LoopDataPrefetch - Perform data prefetching in loops.
194//
196
197//===----------------------------------------------------------------------===//
198//
199// This pass does instruction simplification on each
200// instruction in a function.
201//
203
204
205//===----------------------------------------------------------------------===//
206//
207// createScalarizeMaskedMemIntrinPass - Replace masked load, store, gather
208// and scatter intrinsics with scalar code when target doesn't support them.
209//
211} // End llvm namespace
212
213#endif
aarch64 AArch64 CCMP Pass
static LVOptions Options
Definition: LVOptions.cpp:25
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:310
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:94
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
FunctionPass * createFlattenCFGPass()
FunctionPass * createCFGSimplificationPass(SimplifyCFGOptions Options=SimplifyCFGOptions(), std::function< bool(const Function &)> Ftor=nullptr)
FunctionPass * createTailCallEliminationPass()
FunctionPass * createConstantHoistingPass()
@ Runtime
Detect stack use after return if not disabled runtime with (ASAN_OPTIONS=detect_stack_use_after_retur...
FunctionPass * createDeadCodeEliminationPass()
Definition: DCE.cpp:145
FunctionPass * createSpeculativeExecutionIfHasBranchDivergencePass()
FunctionPass * createNaryReassociatePass()
FunctionPass * createScalarizeMaskedMemIntrinLegacyPass()
Pass * createLoopTermFoldPass()
Pass * createStructurizeCFGPass(bool SkipUniformRegions=false)
When SkipUniformRegions is true the structizer will not structurize regions that only contain uniform...
Pass * createLICMPass()
Definition: LICM.cpp:381
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)
FunctionPass * createReassociatePass()
char & InferAddressSpacesID
FunctionPass * createSinkingPass()
Definition: Sink.cpp:277
FunctionPass * createLoopDataPrefetchPass()
FunctionPass * createSpeculativeExecutionPass()
Pass * createLowerAtomicPass()
FunctionPass * createSeparateConstOffsetFromGEPPass(bool LowerGEP=false)
Pass * createMergeICmpsLegacyPass()
Definition: MergeICmps.cpp:913
Pass * createLoopStrengthReducePass()
FunctionPass * createInferAddressSpacesPass(unsigned AddressSpace=~0u)
FunctionPass * createPartiallyInlineLibCallsPass()
FunctionPass * createStraightLineStrengthReducePass()
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
Definition: EarlyCSE.cpp:1944
FunctionPass * createSROAPass(bool PreserveCFG=true)
Definition: SROA.cpp:5838
FunctionPass * createInstSimplifyLegacyPass()