LLVM 19.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// LoopUnroll - This pass is a simple loop unrolling pass.
57//
58Pass *createLoopUnrollPass(int OptLevel = 2, bool OnlyWhenForced = false,
59 bool ForgetAllSCEV = false, int Threshold = -1,
60 int Count = -1, int AllowPartial = -1,
61 int Runtime = -1, int UpperBound = -1,
62 int AllowPeeling = -1);
63
64//===----------------------------------------------------------------------===//
65//
66// Reassociate - This pass reassociates commutative expressions in an order that
67// is designed to promote better constant propagation, GCSE, LICM, PRE...
68//
69// For example: 4 + (x + 5) -> x + (4 + 5)
70//
72
73//===----------------------------------------------------------------------===//
74//
75// CFGSimplification - Merge basic blocks, eliminate unreachable blocks,
76// simplify terminator instructions, convert switches to lookup tables, etc.
77//
80 std::function<bool(const Function &)> Ftor = nullptr);
81
82//===----------------------------------------------------------------------===//
83//
84// FlattenCFG - flatten CFG, reduce number of conditional branches by using
85// parallel-and and parallel-or mode, etc...
86//
88
89//===----------------------------------------------------------------------===//
90//
91// CFG Structurization - Remove irreducible control flow
92//
93///
94/// When \p SkipUniformRegions is true the structizer will not structurize
95/// regions that only contain uniform branches.
96Pass *createStructurizeCFGPass(bool SkipUniformRegions = false);
97
98//===----------------------------------------------------------------------===//
99//
100// TailCallElimination - This pass eliminates call instructions to the current
101// function which occur immediately before return instructions.
102//
104
105//===----------------------------------------------------------------------===//
106//
107// EarlyCSE - This pass performs a simple and fast CSE pass over the dominator
108// tree.
109//
110FunctionPass *createEarlyCSEPass(bool UseMemorySSA = false);
111
112//===----------------------------------------------------------------------===//
113//
114// ConstantHoisting - This pass prepares a function for expensive constants.
115//
117
118//===----------------------------------------------------------------------===//
119//
120// Sink - Code Sinking
121//
123
124//===----------------------------------------------------------------------===//
125//
126// LowerAtomic - Lower atomic intrinsics to non-atomic form
127//
129
130//===----------------------------------------------------------------------===//
131//
132// MergeICmps - Merge integer comparison chains into a memcmp
133//
135
136//===----------------------------------------------------------------------===//
137//
138// InferAddressSpaces - Modify users of addrspacecast instructions with values
139// in the source address space if using the destination address space is slower
140// on the target. If AddressSpace is left to its default value, it will be
141// obtained from the TargetTransformInfo.
142//
144extern char &InferAddressSpacesID;
145
146//===----------------------------------------------------------------------===//
147//
148// TLSVariableHoist - This pass reduce duplicated TLS address call.
149//
151
152//===----------------------------------------------------------------------===//
153//
154// LowerConstantIntrinsicss - Expand any remaining llvm.objectsize and
155// llvm.is.constant intrinsic calls, even for the unknown cases.
156//
158
159//===----------------------------------------------------------------------===//
160//
161// PartiallyInlineLibCalls - Tries to inline the fast path of library
162// calls such as sqrt.
163//
165
166//===----------------------------------------------------------------------===//
167//
168// SeparateConstOffsetFromGEP - Split GEPs for better CSE
169//
171
172//===----------------------------------------------------------------------===//
173//
174// SpeculativeExecution - Aggressively hoist instructions to enable
175// speculative execution on targets where branches are expensive.
176//
178
179// Same as createSpeculativeExecutionPass, but does nothing unless
180// TargetTransformInfo::hasBranchDivergence() is true.
182
183//===----------------------------------------------------------------------===//
184//
185// StraightLineStrengthReduce - This pass strength-reduces some certain
186// instruction patterns in straight-line code.
187//
189
190//===----------------------------------------------------------------------===//
191//
192// NaryReassociate - Simplify n-ary operations by reassociation.
193//
195
196//===----------------------------------------------------------------------===//
197//
198// LoopDataPrefetch - Perform data prefetching in loops.
199//
201
202//===----------------------------------------------------------------------===//
203//
204// This pass does instruction simplification on each
205// instruction in a function.
206//
208
209
210//===----------------------------------------------------------------------===//
211//
212// createScalarizeMaskedMemIntrinPass - Replace masked load, store, gather
213// and scatter intrinsics with scalar code when target doesn't support them.
214//
216} // End llvm namespace
217
218#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:311
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 * createTLSVariableHoistPass()
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
AddressSpace
Definition: NVPTXBaseInfo.h:21
FunctionPass * createSpeculativeExecutionIfHasBranchDivergencePass()
FunctionPass * createNaryReassociatePass()
FunctionPass * createScalarizeMaskedMemIntrinLegacyPass()
Pass * createStructurizeCFGPass(bool SkipUniformRegions=false)
When SkipUniformRegions is true the structizer will not structurize regions that only contain uniform...
Pass * createLICMPass()
Definition: LICM.cpp:379
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 * createLowerConstantIntrinsicsPass()
FunctionPass * createPartiallyInlineLibCallsPass()
FunctionPass * createStraightLineStrengthReducePass()
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
Definition: EarlyCSE.cpp:1932
FunctionPass * createSROAPass(bool PreserveCFG=true)
Definition: SROA.cpp:5466
FunctionPass * createInstSimplifyLegacyPass()