12#ifndef LLVM_IR_ANALYSIS_H
13#define LLVM_IR_ANALYSIS_H
120 PA.PreservedIDs.
insert(&AllAnalysesKey);
121 PA.PreservesAll =
true;
142 NotPreservedAnalysisIDs.erase(ID);
147 PreservedIDs.insert(ID);
161 PreservedIDs.insert(ID);
185 PreservedIDs.erase(ID);
186 NotPreservedAnalysisIDs.insert(ID);
203 for (
auto *ID : Arg.NotPreservedAnalysisIDs) {
204 PreservedIDs.erase(ID);
205 NotPreservedAnalysisIDs.insert(ID);
207 PreservedIDs.remove_if(
208 [&](
void *ID) {
return !Arg.PreservedIDs.
contains(ID); });
209 PreservesAll &= Arg.PreservesAll;
217 if (Arg.areAllPreserved())
220 *
this = std::move(Arg);
225 for (
auto *ID : Arg.NotPreservedAnalysisIDs) {
226 PreservedIDs.erase(ID);
227 NotPreservedAnalysisIDs.insert(ID);
229 PreservedIDs.remove_if(
230 [&](
void *ID) {
return !Arg.PreservedIDs.contains(ID); });
231 PreservesAll &= Arg.PreservesAll;
236 class PreservedAnalysisChecker {
241 const bool IsAbandoned;
247 : PA(PA), ID(ID), IsAbandoned(PA.NotPreservedAnalysisIDs.
count(ID)) {}
254 return !IsAbandoned && (PA.PreservesAll || PA.PreservedIDs.count(ID));
267 return !IsAbandoned && (PA.PreservesAll || PA.PreservedIDs.count(SetID));
294 return NotPreservedAnalysisIDs.empty() && PreservesAll;
308 return NotPreservedAnalysisIDs.empty() &&
309 (PreservesAll || PreservedIDs.count(SetID));
329 bool PreservesAll =
false;
#define LLVM_TEMPLATE_ABI
This file defines the SmallPtrSet class.
This templated class represents "all analyses that operate over <aparticular IR unit>" (e....
static AnalysisSetKey * ID()
Represents analyses that only rely on functions' control flow.
static AnalysisSetKey * ID()
A Module instance is used to store all the information related to an LLVM module.
A checker object that makes it easy to query for whether an analysis or some set covering it is prese...
bool preserved()
Returns true if the checker's analysis was not abandoned and either.
bool preservedWhenStateless()
Return true if the checker's analysis was not abandoned, i.e.
friend class PreservedAnalyses
bool preservedSet()
Returns true if the checker's analysis was not abandoned and either.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
bool areAllPreserved() const
Test whether all analyses are preserved (and none are abandoned).
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserve(AnalysisKey *ID)
Given an analysis's ID, mark the analysis as preserved, adding it to the set.
PreservedAnalyses & abandon()
Mark an analysis as abandoned.
bool allAnalysesInSetPreserved() const
Directly test whether a set of analyses is preserved.
PreservedAnalysisChecker getChecker(AnalysisKey *ID) const
Build a checker for this PreservedAnalyses and the specified analysis ID.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
void intersect(const PreservedAnalyses &Arg)
Intersect this set with another in place.
PreservedAnalyses & preserve()
Mark an analysis as preserved.
PreservedAnalyses & abandon(AnalysisKey *ID)
Mark an analysis as abandoned using its ID.
void intersect(PreservedAnalyses &&Arg)
Intersect this set with a temporary other set in place.
bool allAnalysesInSetPreserved(AnalysisSetKey *SetID) const
Directly test whether a set of analyses is preserved.
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
PreservedAnalyses & preserveSet(AnalysisSetKey *ID)
Mark an analysis set as preserved using its ID.
static PreservedAnalyses allInSet()
Construct a preserved analyses object with a single preserved set.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
bool contains(ConstPtrType Ptr) const
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is an optimization pass for GlobalISel generic memory operations.
AnalysisSetKey AllAnalysesOn< IRUnitT >::SetKey
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
A special type used by analysis passes to provide an address that identifies that particular analysis...
A special type used to provide an address that identifies a set of related analyses.