Go to the documentation of this file.
15 #ifndef LLVM_IR_PASSMANAGERIMPL_H
16 #define LLVM_IR_PASSMANAGERIMPL_H
22 template <
typename IRUnitT,
typename... ExtraArgTs>
25 template <
typename IRUnitT,
typename... ExtraArgTs>
27 AnalysisManager &&) =
default;
29 template <
typename IRUnitT,
typename... ExtraArgTs>
30 inline AnalysisManager<IRUnitT, ExtraArgTs...> &
34 template <
typename IRUnitT,
typename... ExtraArgTs>
38 if (
auto *PI = getCachedResult<PassInstrumentationAnalysis>(
IR))
39 PI->runAnalysesCleared(
Name);
41 auto ResultsListI = AnalysisResultLists.find(&
IR);
42 if (ResultsListI == AnalysisResultLists.end())
45 for (
auto &IDAndResult : ResultsListI->second)
46 AnalysisResults.erase({IDAndResult.first, &
IR});
49 AnalysisResultLists.erase(ResultsListI);
52 template <
typename IRUnitT,
typename... ExtraArgTs>
53 inline typename AnalysisManager<IRUnitT, ExtraArgTs...>::ResultConceptT &
56 typename AnalysisResultMapT::iterator RI;
58 std::tie(RI, Inserted) = AnalysisResults.insert(std::make_pair(
59 std::make_pair(
ID, &
IR),
typename AnalysisResultListT::iterator()));
64 auto &
P = this->lookUpPass(
ID);
68 PI = getResult<PassInstrumentationAnalysis>(
IR, ExtraArgs...);
72 AnalysisResultListT &ResultList = AnalysisResultLists[&
IR];
73 ResultList.emplace_back(
ID,
P.run(
IR, *
this, ExtraArgs...));
79 RI = AnalysisResults.find({
ID, &
IR});
80 assert(RI != AnalysisResults.end() &&
"we just inserted it!");
82 RI->second = std::prev(ResultList.end());
85 return *RI->second->second;
88 template <
typename IRUnitT,
typename... ExtraArgTs>
98 Invalidator Inv(IsResultInvalidated, AnalysisResults);
99 AnalysisResultListT &ResultsList = AnalysisResultLists[&
IR];
100 for (
auto &AnalysisResultPair : ResultsList) {
106 auto &Result = *AnalysisResultPair.second;
108 auto IMapI = IsResultInvalidated.
find(
ID);
109 if (IMapI != IsResultInvalidated.
end())
119 IsResultInvalidated.
insert({
ID, Result.invalidate(
IR, PA, Inv)}).second;
121 assert(Inserted &&
"Should never have already inserted this ID, likely "
122 "indicates a cycle!");
126 if (!IsResultInvalidated.
empty()) {
127 for (
auto I = ResultsList.begin(),
E = ResultsList.end();
I !=
E;) {
129 if (!IsResultInvalidated.
lookup(
ID)) {
134 if (
auto *PI = getCachedResult<PassInstrumentationAnalysis>(
IR))
137 I = ResultsList.erase(
I);
138 AnalysisResults.erase({
ID, &
IR});
142 if (ResultsList.empty())
143 AnalysisResultLists.erase(&
IR);
147 #endif // LLVM_IR_PASSMANAGERIMPL_H
A set of analyses that are preserved following a run of a transformation pass.
This is an optimization pass for GlobalISel generic memory operations.
static AnalysisKey * ID()
Returns an opaque, unique ID for this analysis type.
llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, 4, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::lookup ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
void invalidate(IRUnitT &IR, const PreservedAnalyses &PA)
Invalidate cached analyses for an IR unit.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
void runBeforeAnalysis(const PassT &Analysis, const IRUnitT &IR) const
BeforeAnalysis instrumentation point - takes Analysis instance to be executed and constant reference ...
This templated class represents "all analyses that operate over <a particular IR unit>" (e....
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Statically lint checks LLVM IR
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
void runAnalysisInvalidated(const PassT &Analysis, const IRUnitT &IR) const
AnalysisInvalidated instrumentation point - takes Analysis instance that has just been invalidated an...
A special type used by analysis passes to provide an address that identifies that particular analysis...
llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, 4, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::find iterator find(const_arg_type_t< KeyT > Val)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class provides instrumentation entry points for the Pass Manager, doing calls to callbacks regis...
bool allAnalysesInSetPreserved() const
Directly test whether a set of analyses is preserved.
void runAfterAnalysis(const PassT &Analysis, const IRUnitT &IR) const
AfterAnalysis instrumentation point - takes Analysis instance that has just been executed and constan...
StringRef - Represent a constant reference to a string, i.e.
AnalysisManager()
Construct an empty analysis manager.
llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, 4, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::insert std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, 4, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::empty LLVM_NODISCARD bool empty() const
void clear()
Clear all analysis results cached by this AnalysisManager.
llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, 4, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::end iterator end()
AnalysisManager & operator=(AnalysisManager &&)
A container for analyses that lazily runs them and caches their results.