12#ifndef LLVM_IR_ANALYSIS_H
13#define LLVM_IR_ANALYSIS_H
55template <
typename IRUnitT> AnalysisSetKey AllAnalysesOn<IRUnitT>::SetKey;
57extern template class AllAnalysesOn<Module>;
58extern template class AllAnalysesOn<Function>;
117 PA.PreservedIDs.
insert(&AllAnalysesKey);
135 NotPreservedAnalysisIDs.erase(
ID);
139 if (!areAllPreserved())
140 PreservedIDs.insert(
ID);
145 preserveSet(AnalysisSetT::ID());
151 if (!areAllPreserved())
152 PreservedIDs.insert(
ID);
172 PreservedIDs.erase(
ID);
173 NotPreservedAnalysisIDs.insert(
ID);
183 if (areAllPreserved()) {
189 for (
auto *
ID : Arg.NotPreservedAnalysisIDs) {
190 PreservedIDs.erase(
ID);
191 NotPreservedAnalysisIDs.insert(
ID);
193 for (
auto *
ID : PreservedIDs)
194 if (!Arg.PreservedIDs.
count(
ID))
195 PreservedIDs.erase(
ID);
203 if (Arg.areAllPreserved())
205 if (areAllPreserved()) {
206 *
this = std::move(Arg);
211 for (
auto *
ID : Arg.NotPreservedAnalysisIDs) {
212 PreservedIDs.erase(
ID);
213 NotPreservedAnalysisIDs.insert(
ID);
215 for (
auto *
ID : PreservedIDs)
216 if (!Arg.PreservedIDs.count(
ID))
217 PreservedIDs.erase(
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));
Module.h This file contains the declarations for the Module class.
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.
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.