12#ifndef LLVM_IR_ANALYSIS_H
13#define LLVM_IR_ANALYSIS_H
57template <
typename IRUnitT> AnalysisSetKey AllAnalysesOn<IRUnitT>::SetKey;
59extern template class AllAnalysesOn<Module>;
60extern template class AllAnalysesOn<Function>;
119 PA.PreservedIDs.
insert(&AllAnalysesKey);
137 NotPreservedAnalysisIDs.erase(
ID);
141 if (!areAllPreserved())
142 PreservedIDs.insert(
ID);
147 preserveSet(AnalysisSetT::ID());
153 if (!areAllPreserved())
154 PreservedIDs.insert(
ID);
174 PreservedIDs.erase(
ID);
175 NotPreservedAnalysisIDs.insert(
ID);
185 if (areAllPreserved()) {
191 for (
auto *
ID : Arg.NotPreservedAnalysisIDs) {
192 PreservedIDs.erase(
ID);
193 NotPreservedAnalysisIDs.insert(
ID);
195 PreservedIDs.remove_if(
196 [&](
void *
ID) {
return !Arg.PreservedIDs.
contains(
ID); });
204 if (Arg.areAllPreserved())
206 if (areAllPreserved()) {
207 *
this = std::move(Arg);
212 for (
auto *
ID : Arg.NotPreservedAnalysisIDs) {
213 PreservedIDs.erase(
ID);
214 NotPreservedAnalysisIDs.insert(
ID);
216 PreservedIDs.remove_if(
217 [&](
void *
ID) {
return !Arg.PreservedIDs.contains(
ID); });
227 const bool IsAbandoned;
233 : PA(PA),
ID(
ID), IsAbandoned(PA.NotPreservedAnalysisIDs.
count(
ID)) {}
240 return !IsAbandoned && (PA.PreservedIDs.
count(&AllAnalysesKey) ||
254 return !IsAbandoned && (PA.PreservedIDs.
count(&AllAnalysesKey) ||
255 PA.PreservedIDs.
count(SetID));
282 return NotPreservedAnalysisIDs.empty() &&
283 PreservedIDs.count(&AllAnalysesKey);
290 return allAnalysesInSetPreserved(AnalysisSetT::ID());
297 return NotPreservedAnalysisIDs.empty() &&
298 (PreservedIDs.count(&AllAnalysesKey) || PreservedIDs.count(SetID));
Machine Check Debug Module
This file defines the SmallPtrSet class.
This templated class represents "all analyses that operate over <a particular IR unit>" (e....
static AnalysisSetKey * ID()
Represents analyses that only rely on functions' control flow.
static AnalysisSetKey * ID()
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.
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.
void preserveSet(AnalysisSetKey *ID)
Mark an analysis set as preserved using its ID.
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.
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.
void intersect(const PreservedAnalyses &Arg)
Intersect this set with another in place.
void intersect(PreservedAnalyses &&Arg)
Intersect this set with a temporary other set in place.
void abandon(AnalysisKey *ID)
Mark an analysis as abandoned using its ID.
bool allAnalysesInSetPreserved(AnalysisSetKey *SetID) const
Directly test whether a set of analyses is preserved.
void preserveSet()
Mark an analysis set as preserved.
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
void preserve(AnalysisKey *ID)
Given an analysis's ID, mark the analysis as preserved, adding it to the set.
void abandon()
Mark an analysis as abandoned.
void preserve()
Mark an analysis as preserved.
static PreservedAnalyses allInSet()
Construct a preserved analyses object with a single preserved set.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
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.
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.