12#ifndef LLVM_IR_ANALYSIS_H
13#define LLVM_IR_ANALYSIS_H
58template <
typename IRUnitT> AnalysisSetKey AllAnalysesOn<IRUnitT>::SetKey;
120 PA.PreservedIDs.
insert(&AllAnalysesKey);
133 preserve(AnalysisT::ID());
141 NotPreservedAnalysisIDs.erase(
ID);
145 if (!areAllPreserved())
146 PreservedIDs.insert(
ID);
152 preserveSet(AnalysisSetT::ID());
159 if (!areAllPreserved())
160 PreservedIDs.insert(
ID);
172 abandon(AnalysisT::ID());
184 PreservedIDs.erase(
ID);
185 NotPreservedAnalysisIDs.insert(
ID);
196 if (areAllPreserved()) {
202 for (
auto *
ID : Arg.NotPreservedAnalysisIDs) {
203 PreservedIDs.erase(
ID);
204 NotPreservedAnalysisIDs.insert(
ID);
206 PreservedIDs.remove_if(
207 [&](
void *
ID) {
return !Arg.PreservedIDs.
contains(
ID); });
215 if (Arg.areAllPreserved())
217 if (areAllPreserved()) {
218 *
this = std::move(Arg);
223 for (
auto *
ID : Arg.NotPreservedAnalysisIDs) {
224 PreservedIDs.erase(
ID);
225 NotPreservedAnalysisIDs.insert(
ID);
227 PreservedIDs.remove_if(
228 [&](
void *
ID) {
return !Arg.PreservedIDs.contains(
ID); });
238 const bool IsAbandoned;
244 : PA(PA),
ID(
ID), IsAbandoned(PA.NotPreservedAnalysisIDs.
count(
ID)) {}
251 return !IsAbandoned && (PA.PreservedIDs.
count(&AllAnalysesKey) ||
265 return !IsAbandoned && (PA.PreservedIDs.
count(&AllAnalysesKey) ||
266 PA.PreservedIDs.
count(SetID));
293 return NotPreservedAnalysisIDs.empty() &&
294 PreservedIDs.count(&AllAnalysesKey);
301 return allAnalysesInSetPreserved(AnalysisSetT::ID());
308 return NotPreservedAnalysisIDs.empty() &&
309 (PreservedIDs.count(&AllAnalysesKey) || PreservedIDs.count(SetID));
#define LLVM_TEMPLATE_ABI
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.
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.
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.
template class LLVM_TEMPLATE_ABI AllAnalysesOn< Module >
template class LLVM_TEMPLATE_ABI AllAnalysesOn< Function >
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.