mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[PM] Change the static object whose address is used to uniquely identify
analyses to have a common type which is enforced rather than using a char object and a `void *` type when used as an identifier. This has a number of advantages. First, it at least helps some of the confusion raised in Justin Lebar's code review of why `void *` was being used everywhere by having a stronger type that connects to documentation about this. However, perhaps more importantly, it addresses a serious issue where the alignment of these pointer-like identifiers was unknown. This made it hard to use them in pointer-like data structures. We were already dodging this in dangerous ways to create the "all analyses" entry. In a subsequent patch I attempted to use these with TinyPtrVector and things fell apart in a very bad way. And it isn't just a compile time or type system issue. Worse than that, the actual alignment of these pointer-like opaque identifiers wasn't guaranteed to be a useful alignment as they were just characters. This change introduces a type to use as the "key" object whose address forms the opaque identifier. This both forces the objects to have proper alignment, and provides type checking that we get it right everywhere. It also makes the types somewhat less mysterious than `void *`. We could go one step further and introduce a truly opaque pointer-like type to return from the `ID()` static function rather than returning `AnalysisKey *`, but that didn't seem to be a clear win so this is just the initial change to get to a reliably typed and aligned object serving is a key for all the analyses. Thanks to Richard Smith and Justin Lebar for helping pick plausible names and avoid making this refactoring many times. =] And thanks to Sean for the super fast review! While here, I've tried to move away from the "PassID" nomenclature entirely as it wasn't really helping and is overloaded with old pass manager constructs. Now we have IDs for analyses, and key objects whose address can be used as IDs. Where possible and clear I've shortened this to just "ID". In a few places I kept "AnalysisID" to make it clear what was being identified. Differential Revision: https://reviews.llvm.org/D27031 llvm-svn: 287783
This commit is contained in:
parent
40a0781572
commit
dad102bcc9
@ -911,7 +911,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend AnalysisInfoMixin<AAManager>;
|
friend AnalysisInfoMixin<AAManager>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
SmallVector<void (*)(Function &F, FunctionAnalysisManager &AM,
|
SmallVector<void (*)(Function &F, FunctionAnalysisManager &AM,
|
||||||
AAResults &AAResults),
|
AAResults &AAResults),
|
||||||
|
@ -95,7 +95,7 @@ public:
|
|||||||
/// assumption caches for a given function.
|
/// assumption caches for a given function.
|
||||||
class AssumptionAnalysis : public AnalysisInfoMixin<AssumptionAnalysis> {
|
class AssumptionAnalysis : public AnalysisInfoMixin<AssumptionAnalysis> {
|
||||||
friend AnalysisInfoMixin<AssumptionAnalysis>;
|
friend AnalysisInfoMixin<AssumptionAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef AssumptionCache Result;
|
typedef AssumptionCache Result;
|
||||||
|
@ -196,7 +196,7 @@ private:
|
|||||||
/// Analysis pass providing a never-invalidated alias analysis result.
|
/// Analysis pass providing a never-invalidated alias analysis result.
|
||||||
class BasicAA : public AnalysisInfoMixin<BasicAA> {
|
class BasicAA : public AnalysisInfoMixin<BasicAA> {
|
||||||
friend AnalysisInfoMixin<BasicAA>;
|
friend AnalysisInfoMixin<BasicAA>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef BasicAAResult Result;
|
typedef BasicAAResult Result;
|
||||||
|
@ -90,7 +90,7 @@ public:
|
|||||||
class BlockFrequencyAnalysis
|
class BlockFrequencyAnalysis
|
||||||
: public AnalysisInfoMixin<BlockFrequencyAnalysis> {
|
: public AnalysisInfoMixin<BlockFrequencyAnalysis> {
|
||||||
friend AnalysisInfoMixin<BlockFrequencyAnalysis>;
|
friend AnalysisInfoMixin<BlockFrequencyAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Provide the result typedef for this analysis pass.
|
/// \brief Provide the result typedef for this analysis pass.
|
||||||
|
@ -178,7 +178,7 @@ private:
|
|||||||
class BranchProbabilityAnalysis
|
class BranchProbabilityAnalysis
|
||||||
: public AnalysisInfoMixin<BranchProbabilityAnalysis> {
|
: public AnalysisInfoMixin<BranchProbabilityAnalysis> {
|
||||||
friend AnalysisInfoMixin<BranchProbabilityAnalysis>;
|
friend AnalysisInfoMixin<BranchProbabilityAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Provide the result typedef for this analysis pass.
|
/// \brief Provide the result typedef for this analysis pass.
|
||||||
|
@ -103,7 +103,7 @@ private:
|
|||||||
/// in particular to leverage invalidation to trigger re-computation.
|
/// in particular to leverage invalidation to trigger re-computation.
|
||||||
class CFLAndersAA : public AnalysisInfoMixin<CFLAndersAA> {
|
class CFLAndersAA : public AnalysisInfoMixin<CFLAndersAA> {
|
||||||
friend AnalysisInfoMixin<CFLAndersAA>;
|
friend AnalysisInfoMixin<CFLAndersAA>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef CFLAndersAAResult Result;
|
typedef CFLAndersAAResult Result;
|
||||||
|
@ -122,7 +122,7 @@ private:
|
|||||||
/// in particular to leverage invalidation to trigger re-computation of sets.
|
/// in particular to leverage invalidation to trigger re-computation of sets.
|
||||||
class CFLSteensAA : public AnalysisInfoMixin<CFLSteensAA> {
|
class CFLSteensAA : public AnalysisInfoMixin<CFLSteensAA> {
|
||||||
friend AnalysisInfoMixin<CFLSteensAA>;
|
friend AnalysisInfoMixin<CFLSteensAA>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef CFLSteensAAResult Result;
|
typedef CFLSteensAAResult Result;
|
||||||
|
@ -297,7 +297,7 @@ private:
|
|||||||
/// resulting data.
|
/// resulting data.
|
||||||
class CallGraphAnalysis : public AnalysisInfoMixin<CallGraphAnalysis> {
|
class CallGraphAnalysis : public AnalysisInfoMixin<CallGraphAnalysis> {
|
||||||
friend AnalysisInfoMixin<CallGraphAnalysis>;
|
friend AnalysisInfoMixin<CallGraphAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief A formulaic typedef to inform clients of the result type.
|
/// \brief A formulaic typedef to inform clients of the result type.
|
||||||
|
@ -89,7 +89,7 @@ public:
|
|||||||
/// An analysis that produces \c DemandedBits for a function.
|
/// An analysis that produces \c DemandedBits for a function.
|
||||||
class DemandedBitsAnalysis : public AnalysisInfoMixin<DemandedBitsAnalysis> {
|
class DemandedBitsAnalysis : public AnalysisInfoMixin<DemandedBitsAnalysis> {
|
||||||
friend AnalysisInfoMixin<DemandedBitsAnalysis>;
|
friend AnalysisInfoMixin<DemandedBitsAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Provide the result typedef for this analysis pass.
|
/// \brief Provide the result typedef for this analysis pass.
|
||||||
|
@ -921,7 +921,7 @@ template <typename T> class ArrayRef;
|
|||||||
Result run(Function &F, FunctionAnalysisManager &FAM);
|
Result run(Function &F, FunctionAnalysisManager &FAM);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
friend struct AnalysisInfoMixin<DependenceAnalysis>;
|
friend struct AnalysisInfoMixin<DependenceAnalysis>;
|
||||||
}; // class DependenceAnalysis
|
}; // class DependenceAnalysis
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ extern template class ForwardDominanceFrontierBase<BasicBlock>;
|
|||||||
class DominanceFrontierAnalysis
|
class DominanceFrontierAnalysis
|
||||||
: public AnalysisInfoMixin<DominanceFrontierAnalysis> {
|
: public AnalysisInfoMixin<DominanceFrontierAnalysis> {
|
||||||
friend AnalysisInfoMixin<DominanceFrontierAnalysis>;
|
friend AnalysisInfoMixin<DominanceFrontierAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Provide the result typedef for this analysis pass.
|
/// \brief Provide the result typedef for this analysis pass.
|
||||||
|
@ -120,7 +120,7 @@ private:
|
|||||||
/// Analysis pass providing a never-invalidated alias analysis result.
|
/// Analysis pass providing a never-invalidated alias analysis result.
|
||||||
class GlobalsAA : public AnalysisInfoMixin<GlobalsAA> {
|
class GlobalsAA : public AnalysisInfoMixin<GlobalsAA> {
|
||||||
friend AnalysisInfoMixin<GlobalsAA>;
|
friend AnalysisInfoMixin<GlobalsAA>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef GlobalsAAResult Result;
|
typedef GlobalsAAResult Result;
|
||||||
|
@ -188,7 +188,7 @@ public:
|
|||||||
/// Analysis pass that exposes the \c IVUsers for a loop.
|
/// Analysis pass that exposes the \c IVUsers for a loop.
|
||||||
class IVUsersAnalysis : public AnalysisInfoMixin<IVUsersAnalysis> {
|
class IVUsersAnalysis : public AnalysisInfoMixin<IVUsersAnalysis> {
|
||||||
friend AnalysisInfoMixin<IVUsersAnalysis>;
|
friend AnalysisInfoMixin<IVUsersAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef IVUsers Result;
|
typedef IVUsers Result;
|
||||||
|
@ -1145,7 +1145,7 @@ template <> struct GraphTraits<LazyCallGraph *> {
|
|||||||
/// An analysis pass which computes the call graph for a module.
|
/// An analysis pass which computes the call graph for a module.
|
||||||
class LazyCallGraphAnalysis : public AnalysisInfoMixin<LazyCallGraphAnalysis> {
|
class LazyCallGraphAnalysis : public AnalysisInfoMixin<LazyCallGraphAnalysis> {
|
||||||
friend AnalysisInfoMixin<LazyCallGraphAnalysis>;
|
friend AnalysisInfoMixin<LazyCallGraphAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Inform generic clients of the result type.
|
/// Inform generic clients of the result type.
|
||||||
|
@ -109,7 +109,7 @@ public:
|
|||||||
Result run(Function &F, FunctionAnalysisManager &FAM);
|
Result run(Function &F, FunctionAnalysisManager &FAM);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
friend struct AnalysisInfoMixin<LazyValueAnalysis>;
|
friend struct AnalysisInfoMixin<LazyValueAnalysis>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -749,7 +749,7 @@ private:
|
|||||||
class LoopAccessAnalysis
|
class LoopAccessAnalysis
|
||||||
: public AnalysisInfoMixin<LoopAccessAnalysis> {
|
: public AnalysisInfoMixin<LoopAccessAnalysis> {
|
||||||
friend AnalysisInfoMixin<LoopAccessAnalysis>;
|
friend AnalysisInfoMixin<LoopAccessAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef LoopAccessInfo Result;
|
typedef LoopAccessInfo Result;
|
||||||
|
@ -805,7 +805,7 @@ template <> struct GraphTraits<Loop*> {
|
|||||||
/// \brief Analysis pass that exposes the \c LoopInfo for a function.
|
/// \brief Analysis pass that exposes the \c LoopInfo for a function.
|
||||||
class LoopAnalysis : public AnalysisInfoMixin<LoopAnalysis> {
|
class LoopAnalysis : public AnalysisInfoMixin<LoopAnalysis> {
|
||||||
friend AnalysisInfoMixin<LoopAnalysis>;
|
friend AnalysisInfoMixin<LoopAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef LoopInfo Result;
|
typedef LoopInfo Result;
|
||||||
|
@ -485,7 +485,7 @@ private:
|
|||||||
class MemoryDependenceAnalysis
|
class MemoryDependenceAnalysis
|
||||||
: public AnalysisInfoMixin<MemoryDependenceAnalysis> {
|
: public AnalysisInfoMixin<MemoryDependenceAnalysis> {
|
||||||
friend AnalysisInfoMixin<MemoryDependenceAnalysis>;
|
friend AnalysisInfoMixin<MemoryDependenceAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef MemoryDependenceResults Result;
|
typedef MemoryDependenceResults Result;
|
||||||
|
@ -38,7 +38,7 @@ ModuleSummaryIndex buildModuleSummaryIndex(
|
|||||||
class ModuleSummaryIndexAnalysis
|
class ModuleSummaryIndexAnalysis
|
||||||
: public AnalysisInfoMixin<ModuleSummaryIndexAnalysis> {
|
: public AnalysisInfoMixin<ModuleSummaryIndexAnalysis> {
|
||||||
friend AnalysisInfoMixin<ModuleSummaryIndexAnalysis>;
|
friend AnalysisInfoMixin<ModuleSummaryIndexAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef ModuleSummaryIndex Result;
|
typedef ModuleSummaryIndex Result;
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
/// Analysis pass providing a never-invalidated alias analysis result.
|
/// Analysis pass providing a never-invalidated alias analysis result.
|
||||||
class ObjCARCAA : public AnalysisInfoMixin<ObjCARCAA> {
|
class ObjCARCAA : public AnalysisInfoMixin<ObjCARCAA> {
|
||||||
friend AnalysisInfoMixin<ObjCARCAA>;
|
friend AnalysisInfoMixin<ObjCARCAA>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef ObjCARCAAResult Result;
|
typedef ObjCARCAAResult Result;
|
||||||
|
@ -251,7 +251,7 @@ public:
|
|||||||
class OptimizationRemarkEmitterAnalysis
|
class OptimizationRemarkEmitterAnalysis
|
||||||
: public AnalysisInfoMixin<OptimizationRemarkEmitterAnalysis> {
|
: public AnalysisInfoMixin<OptimizationRemarkEmitterAnalysis> {
|
||||||
friend AnalysisInfoMixin<OptimizationRemarkEmitterAnalysis>;
|
friend AnalysisInfoMixin<OptimizationRemarkEmitterAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Provide the result typedef for this analysis pass.
|
/// \brief Provide the result typedef for this analysis pass.
|
||||||
|
@ -32,7 +32,7 @@ struct PostDominatorTree : public DominatorTreeBase<BasicBlock> {
|
|||||||
class PostDominatorTreeAnalysis
|
class PostDominatorTreeAnalysis
|
||||||
: public AnalysisInfoMixin<PostDominatorTreeAnalysis> {
|
: public AnalysisInfoMixin<PostDominatorTreeAnalysis> {
|
||||||
friend AnalysisInfoMixin<PostDominatorTreeAnalysis>;
|
friend AnalysisInfoMixin<PostDominatorTreeAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Provide the result typedef for this analysis pass.
|
/// \brief Provide the result typedef for this analysis pass.
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend AnalysisInfoMixin<ProfileSummaryAnalysis>;
|
friend AnalysisInfoMixin<ProfileSummaryAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Printer pass that uses \c ProfileSummaryAnalysis.
|
/// \brief Printer pass that uses \c ProfileSummaryAnalysis.
|
||||||
|
@ -933,7 +933,7 @@ public:
|
|||||||
/// \brief Analysis pass that exposes the \c RegionInfo for a function.
|
/// \brief Analysis pass that exposes the \c RegionInfo for a function.
|
||||||
class RegionInfoAnalysis : public AnalysisInfoMixin<RegionInfoAnalysis> {
|
class RegionInfoAnalysis : public AnalysisInfoMixin<RegionInfoAnalysis> {
|
||||||
friend AnalysisInfoMixin<RegionInfoAnalysis>;
|
friend AnalysisInfoMixin<RegionInfoAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef RegionInfo Result;
|
typedef RegionInfo Result;
|
||||||
|
@ -1626,7 +1626,7 @@ private:
|
|||||||
class ScalarEvolutionAnalysis
|
class ScalarEvolutionAnalysis
|
||||||
: public AnalysisInfoMixin<ScalarEvolutionAnalysis> {
|
: public AnalysisInfoMixin<ScalarEvolutionAnalysis> {
|
||||||
friend AnalysisInfoMixin<ScalarEvolutionAnalysis>;
|
friend AnalysisInfoMixin<ScalarEvolutionAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef ScalarEvolution Result;
|
typedef ScalarEvolution Result;
|
||||||
|
@ -40,7 +40,7 @@ private:
|
|||||||
/// Analysis pass providing a never-invalidated alias analysis result.
|
/// Analysis pass providing a never-invalidated alias analysis result.
|
||||||
class SCEVAA : public AnalysisInfoMixin<SCEVAA> {
|
class SCEVAA : public AnalysisInfoMixin<SCEVAA> {
|
||||||
friend AnalysisInfoMixin<SCEVAA>;
|
friend AnalysisInfoMixin<SCEVAA>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef SCEVAAResult Result;
|
typedef SCEVAAResult Result;
|
||||||
|
@ -43,7 +43,7 @@ private:
|
|||||||
/// Analysis pass providing a never-invalidated alias analysis result.
|
/// Analysis pass providing a never-invalidated alias analysis result.
|
||||||
class ScopedNoAliasAA : public AnalysisInfoMixin<ScopedNoAliasAA> {
|
class ScopedNoAliasAA : public AnalysisInfoMixin<ScopedNoAliasAA> {
|
||||||
friend AnalysisInfoMixin<ScopedNoAliasAA>;
|
friend AnalysisInfoMixin<ScopedNoAliasAA>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef ScopedNoAliasAAResult Result;
|
typedef ScopedNoAliasAAResult Result;
|
||||||
|
@ -343,7 +343,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend AnalysisInfoMixin<TargetLibraryAnalysis>;
|
friend AnalysisInfoMixin<TargetLibraryAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
Optional<TargetLibraryInfoImpl> PresetInfoImpl;
|
Optional<TargetLibraryInfoImpl> PresetInfoImpl;
|
||||||
|
|
||||||
|
@ -1128,7 +1128,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend AnalysisInfoMixin<TargetIRAnalysis>;
|
friend AnalysisInfoMixin<TargetIRAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
/// \brief The callback used to produce a result.
|
/// \brief The callback used to produce a result.
|
||||||
///
|
///
|
||||||
|
@ -47,7 +47,7 @@ private:
|
|||||||
/// Analysis pass providing a never-invalidated alias analysis result.
|
/// Analysis pass providing a never-invalidated alias analysis result.
|
||||||
class TypeBasedAA : public AnalysisInfoMixin<TypeBasedAA> {
|
class TypeBasedAA : public AnalysisInfoMixin<TypeBasedAA> {
|
||||||
friend AnalysisInfoMixin<TypeBasedAA>;
|
friend AnalysisInfoMixin<TypeBasedAA>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef TypeBasedAAResult Result;
|
typedef TypeBasedAAResult Result;
|
||||||
|
@ -188,7 +188,7 @@ template <> struct GraphTraits<DominatorTree*>
|
|||||||
/// \brief Analysis pass which computes a \c DominatorTree.
|
/// \brief Analysis pass which computes a \c DominatorTree.
|
||||||
class DominatorTreeAnalysis : public AnalysisInfoMixin<DominatorTreeAnalysis> {
|
class DominatorTreeAnalysis : public AnalysisInfoMixin<DominatorTreeAnalysis> {
|
||||||
friend AnalysisInfoMixin<DominatorTreeAnalysis>;
|
friend AnalysisInfoMixin<DominatorTreeAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Provide the result typedef for this analysis pass.
|
/// \brief Provide the result typedef for this analysis pass.
|
||||||
|
@ -54,6 +54,14 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
|
/// A special type used by analysis passes to provide an address that
|
||||||
|
/// identifies that particular analysis pass type.
|
||||||
|
///
|
||||||
|
/// Analysis passes should have a static data member of this type and derive
|
||||||
|
/// from the \c AnalysisInfoMixin to get a static ID method used to identify
|
||||||
|
/// the analysis in the pass management infrastructure.
|
||||||
|
struct alignas(8) AnalysisKey {};
|
||||||
|
|
||||||
/// \brief An abstract set of preserved analyses following a transformation pass
|
/// \brief An abstract set of preserved analyses following a transformation pass
|
||||||
/// run.
|
/// run.
|
||||||
///
|
///
|
||||||
@ -71,17 +79,17 @@ public:
|
|||||||
/// \brief Construct a special preserved set that preserves all passes.
|
/// \brief Construct a special preserved set that preserves all passes.
|
||||||
static PreservedAnalyses all() {
|
static PreservedAnalyses all() {
|
||||||
PreservedAnalyses PA;
|
PreservedAnalyses PA;
|
||||||
PA.PreservedPassIDs.insert((void *)AllPassesID);
|
PA.PreservedAnalysisIDs.insert(&AllAnalysesKey);
|
||||||
return PA;
|
return PA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Mark a particular pass as preserved, adding it to the set.
|
/// \brief Mark a particular pass as preserved, adding it to the set.
|
||||||
template <typename PassT> void preserve() { preserve(PassT::ID()); }
|
template <typename PassT> void preserve() { preserve(PassT::ID()); }
|
||||||
|
|
||||||
/// \brief Mark an abstract PassID as preserved, adding it to the set.
|
/// \brief Mark an abstract ID as preserved, adding it to the set.
|
||||||
void preserve(void *PassID) {
|
void preserve(AnalysisKey *ID) {
|
||||||
if (!areAllPreserved())
|
if (!areAllPreserved())
|
||||||
PreservedPassIDs.insert(PassID);
|
PreservedAnalysisIDs.insert(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Intersect this set with another in place.
|
/// \brief Intersect this set with another in place.
|
||||||
@ -92,12 +100,12 @@ public:
|
|||||||
if (Arg.areAllPreserved())
|
if (Arg.areAllPreserved())
|
||||||
return;
|
return;
|
||||||
if (areAllPreserved()) {
|
if (areAllPreserved()) {
|
||||||
PreservedPassIDs = Arg.PreservedPassIDs;
|
PreservedAnalysisIDs = Arg.PreservedAnalysisIDs;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (void *P : PreservedPassIDs)
|
for (auto ID : PreservedAnalysisIDs)
|
||||||
if (!Arg.PreservedPassIDs.count(P))
|
if (!Arg.PreservedAnalysisIDs.count(ID))
|
||||||
PreservedPassIDs.erase(P);
|
PreservedAnalysisIDs.erase(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Intersect this set with a temporary other set in place.
|
/// \brief Intersect this set with a temporary other set in place.
|
||||||
@ -108,12 +116,12 @@ public:
|
|||||||
if (Arg.areAllPreserved())
|
if (Arg.areAllPreserved())
|
||||||
return;
|
return;
|
||||||
if (areAllPreserved()) {
|
if (areAllPreserved()) {
|
||||||
PreservedPassIDs = std::move(Arg.PreservedPassIDs);
|
PreservedAnalysisIDs = std::move(Arg.PreservedAnalysisIDs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (void *P : PreservedPassIDs)
|
for (auto ID : PreservedAnalysisIDs)
|
||||||
if (!Arg.PreservedPassIDs.count(P))
|
if (!Arg.PreservedAnalysisIDs.count(ID))
|
||||||
PreservedPassIDs.erase(P);
|
PreservedAnalysisIDs.erase(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Query whether a pass is marked as preserved by this set.
|
/// \brief Query whether a pass is marked as preserved by this set.
|
||||||
@ -123,17 +131,17 @@ public:
|
|||||||
|
|
||||||
/// \brief Query whether an abstract pass ID is marked as preserved by this
|
/// \brief Query whether an abstract pass ID is marked as preserved by this
|
||||||
/// set.
|
/// set.
|
||||||
bool preserved(void *PassID) const {
|
bool preserved(AnalysisKey *ID) const {
|
||||||
return PreservedPassIDs.count((void *)AllPassesID) ||
|
return PreservedAnalysisIDs.count(&AllAnalysesKey) ||
|
||||||
PreservedPassIDs.count(PassID);
|
PreservedAnalysisIDs.count(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Query whether all of the analyses in the set are preserved.
|
/// \brief Query whether all of the analyses in the set are preserved.
|
||||||
bool preserved(PreservedAnalyses Arg) {
|
bool preserved(PreservedAnalyses Arg) {
|
||||||
if (Arg.areAllPreserved())
|
if (Arg.areAllPreserved())
|
||||||
return areAllPreserved();
|
return areAllPreserved();
|
||||||
for (void *P : Arg.PreservedPassIDs)
|
for (auto ID : Arg.PreservedAnalysisIDs)
|
||||||
if (!preserved(P))
|
if (!preserved(ID))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -143,15 +151,14 @@ public:
|
|||||||
/// This is used primarily to optimize for the case of no changes which will
|
/// This is used primarily to optimize for the case of no changes which will
|
||||||
/// common in many scenarios.
|
/// common in many scenarios.
|
||||||
bool areAllPreserved() const {
|
bool areAllPreserved() const {
|
||||||
return PreservedPassIDs.count((void *)AllPassesID);
|
return PreservedAnalysisIDs.count(&AllAnalysesKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Note that this must not be -1 or -2 as those are already used by the
|
// A special key used to indicate all analyses.
|
||||||
// SmallPtrSet.
|
static AnalysisKey AllAnalysesKey;
|
||||||
static const uintptr_t AllPassesID = (intptr_t)(-3);
|
|
||||||
|
|
||||||
SmallPtrSet<void *, 2> PreservedPassIDs;
|
SmallPtrSet<AnalysisKey *, 2> PreservedAnalysisIDs;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Forward declare the analysis manager template.
|
// Forward declare the analysis manager template.
|
||||||
@ -179,10 +186,14 @@ template <typename DerivedT> struct PassInfoMixin {
|
|||||||
/// specifically used for analyses.
|
/// specifically used for analyses.
|
||||||
template <typename DerivedT>
|
template <typename DerivedT>
|
||||||
struct AnalysisInfoMixin : PassInfoMixin<DerivedT> {
|
struct AnalysisInfoMixin : PassInfoMixin<DerivedT> {
|
||||||
/// Returns an opaque, unique ID for this pass type.
|
/// Returns an opaque, unique ID for this analysis type.
|
||||||
///
|
///
|
||||||
/// Note that this requires the derived type provide a static member whose
|
/// This ID is a pointer type that is guaranteed to be 8-byte aligned and
|
||||||
/// address can be converted to a void pointer.
|
/// thus suitable for use in sets, maps, and other data structures optimized
|
||||||
|
/// for pointer-like types using the alignment-provided low bits.
|
||||||
|
///
|
||||||
|
/// Note that this requires the derived type provide a static \c AnalysisKey
|
||||||
|
/// member called \c Key.
|
||||||
///
|
///
|
||||||
/// FIXME: The only reason the derived type needs to provide this rather than
|
/// FIXME: The only reason the derived type needs to provide this rather than
|
||||||
/// this mixin providing it is due to broken implementations which cannot
|
/// this mixin providing it is due to broken implementations which cannot
|
||||||
@ -191,8 +202,8 @@ struct AnalysisInfoMixin : PassInfoMixin<DerivedT> {
|
|||||||
/// instantiation. The only currently known platform with this limitation are
|
/// instantiation. The only currently known platform with this limitation are
|
||||||
/// Windows DLL builds, specifically building each part of LLVM as a DLL. If
|
/// Windows DLL builds, specifically building each part of LLVM as a DLL. If
|
||||||
/// we ever remove that build configuration, this mixin can provide the
|
/// we ever remove that build configuration, this mixin can provide the
|
||||||
/// static PassID as well.
|
/// static key as well.
|
||||||
static void *ID() { return (void *)&DerivedT::PassID; }
|
static AnalysisKey *ID() { return &DerivedT::Key; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A class template to provide analysis sets for IR units.
|
/// A class template to provide analysis sets for IR units.
|
||||||
@ -205,17 +216,17 @@ struct AnalysisInfoMixin : PassInfoMixin<DerivedT> {
|
|||||||
///
|
///
|
||||||
/// Note that you must provide an explicit instantiation declaration and
|
/// Note that you must provide an explicit instantiation declaration and
|
||||||
/// definition for this template in order to get the correct behavior on
|
/// definition for this template in order to get the correct behavior on
|
||||||
/// Windows. Otherwise, the address of SetID will not be stable.
|
/// Windows. Otherwise, the address of SetKey will not be stable.
|
||||||
template <typename IRUnitT>
|
template <typename IRUnitT>
|
||||||
class AllAnalysesOn {
|
class AllAnalysesOn {
|
||||||
public:
|
public:
|
||||||
static void *ID() { return (void *)&SetID; }
|
static AnalysisKey *ID() { return &SetKey; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static char SetID;
|
static AnalysisKey SetKey;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename IRUnitT> char AllAnalysesOn<IRUnitT>::SetID;
|
template <typename IRUnitT> AnalysisKey AllAnalysesOn<IRUnitT>::SetKey;
|
||||||
|
|
||||||
extern template class AllAnalysesOn<Module>;
|
extern template class AllAnalysesOn<Module>;
|
||||||
extern template class AllAnalysesOn<Function>;
|
extern template class AllAnalysesOn<Function>;
|
||||||
@ -363,13 +374,13 @@ public:
|
|||||||
|
|
||||||
// Clear all the invalidated results associated specifically with this
|
// Clear all the invalidated results associated specifically with this
|
||||||
// function.
|
// function.
|
||||||
SmallVector<void *, 8> InvalidatedPassIDs;
|
SmallVector<AnalysisKey *, 8> InvalidatedIDs;
|
||||||
auto ResultsListI = AnalysisResultLists.find(&IR);
|
auto ResultsListI = AnalysisResultLists.find(&IR);
|
||||||
if (ResultsListI == AnalysisResultLists.end())
|
if (ResultsListI == AnalysisResultLists.end())
|
||||||
return;
|
return;
|
||||||
// Clear the map pointing into the results list.
|
// Clear the map pointing into the results list.
|
||||||
for (auto &PassIDAndResult : ResultsListI->second)
|
for (auto &IDAndResult : ResultsListI->second)
|
||||||
AnalysisResults.erase(std::make_pair(PassIDAndResult.first, &IR));
|
AnalysisResults.erase(std::make_pair(IDAndResult.first, &IR));
|
||||||
|
|
||||||
// And actually destroy and erase the results associated with this IR.
|
// And actually destroy and erase the results associated with this IR.
|
||||||
AnalysisResultLists.erase(ResultsListI);
|
AnalysisResultLists.erase(ResultsListI);
|
||||||
@ -479,22 +490,22 @@ public:
|
|||||||
|
|
||||||
// Clear all the invalidated results associated specifically with this
|
// Clear all the invalidated results associated specifically with this
|
||||||
// function.
|
// function.
|
||||||
SmallVector<void *, 8> InvalidatedPassIDs;
|
SmallVector<AnalysisKey *, 8> InvalidatedIDs;
|
||||||
AnalysisResultListT &ResultsList = AnalysisResultLists[&IR];
|
AnalysisResultListT &ResultsList = AnalysisResultLists[&IR];
|
||||||
for (typename AnalysisResultListT::iterator I = ResultsList.begin(),
|
for (typename AnalysisResultListT::iterator I = ResultsList.begin(),
|
||||||
E = ResultsList.end();
|
E = ResultsList.end();
|
||||||
I != E;) {
|
I != E;) {
|
||||||
void *PassID = I->first;
|
AnalysisKey *ID = I->first;
|
||||||
|
|
||||||
// Pass the invalidation down to the pass itself to see if it thinks it is
|
// Pass the invalidation down to the pass itself to see if it thinks it is
|
||||||
// necessary. The analysis pass can return false if no action on the part
|
// necessary. The analysis pass can return false if no action on the part
|
||||||
// of the analysis manager is required for this invalidation event.
|
// of the analysis manager is required for this invalidation event.
|
||||||
if (I->second->invalidate(IR, PA)) {
|
if (I->second->invalidate(IR, PA)) {
|
||||||
if (DebugLogging)
|
if (DebugLogging)
|
||||||
dbgs() << "Invalidating analysis: " << this->lookupPass(PassID).name()
|
dbgs() << "Invalidating analysis: " << this->lookupPass(ID).name()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
InvalidatedPassIDs.push_back(I->first);
|
InvalidatedIDs.push_back(I->first);
|
||||||
I = ResultsList.erase(I);
|
I = ResultsList.erase(I);
|
||||||
} else {
|
} else {
|
||||||
++I;
|
++I;
|
||||||
@ -503,11 +514,10 @@ public:
|
|||||||
// After handling each pass, we mark it as preserved. Once we've
|
// After handling each pass, we mark it as preserved. Once we've
|
||||||
// invalidated any stale results, the rest of the system is allowed to
|
// invalidated any stale results, the rest of the system is allowed to
|
||||||
// start preserving this analysis again.
|
// start preserving this analysis again.
|
||||||
PA.preserve(PassID);
|
PA.preserve(ID);
|
||||||
}
|
}
|
||||||
while (!InvalidatedPassIDs.empty())
|
while (!InvalidatedIDs.empty())
|
||||||
AnalysisResults.erase(
|
AnalysisResults.erase(std::make_pair(InvalidatedIDs.pop_back_val(), &IR));
|
||||||
std::make_pair(InvalidatedPassIDs.pop_back_val(), &IR));
|
|
||||||
if (ResultsList.empty())
|
if (ResultsList.empty())
|
||||||
AnalysisResultLists.erase(&IR);
|
AnalysisResultLists.erase(&IR);
|
||||||
|
|
||||||
@ -516,41 +526,41 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/// \brief Lookup a registered analysis pass.
|
/// \brief Lookup a registered analysis pass.
|
||||||
PassConceptT &lookupPass(void *PassID) {
|
PassConceptT &lookupPass(AnalysisKey *ID) {
|
||||||
typename AnalysisPassMapT::iterator PI = AnalysisPasses.find(PassID);
|
typename AnalysisPassMapT::iterator PI = AnalysisPasses.find(ID);
|
||||||
assert(PI != AnalysisPasses.end() &&
|
assert(PI != AnalysisPasses.end() &&
|
||||||
"Analysis passes must be registered prior to being queried!");
|
"Analysis passes must be registered prior to being queried!");
|
||||||
return *PI->second;
|
return *PI->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Lookup a registered analysis pass.
|
/// \brief Lookup a registered analysis pass.
|
||||||
const PassConceptT &lookupPass(void *PassID) const {
|
const PassConceptT &lookupPass(AnalysisKey *ID) const {
|
||||||
typename AnalysisPassMapT::const_iterator PI = AnalysisPasses.find(PassID);
|
typename AnalysisPassMapT::const_iterator PI = AnalysisPasses.find(ID);
|
||||||
assert(PI != AnalysisPasses.end() &&
|
assert(PI != AnalysisPasses.end() &&
|
||||||
"Analysis passes must be registered prior to being queried!");
|
"Analysis passes must be registered prior to being queried!");
|
||||||
return *PI->second;
|
return *PI->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Get an analysis result, running the pass if necessary.
|
/// \brief Get an analysis result, running the pass if necessary.
|
||||||
ResultConceptT &getResultImpl(void *PassID, IRUnitT &IR,
|
ResultConceptT &getResultImpl(AnalysisKey *ID, IRUnitT &IR,
|
||||||
ExtraArgTs... ExtraArgs) {
|
ExtraArgTs... ExtraArgs) {
|
||||||
typename AnalysisResultMapT::iterator RI;
|
typename AnalysisResultMapT::iterator RI;
|
||||||
bool Inserted;
|
bool Inserted;
|
||||||
std::tie(RI, Inserted) = AnalysisResults.insert(std::make_pair(
|
std::tie(RI, Inserted) = AnalysisResults.insert(std::make_pair(
|
||||||
std::make_pair(PassID, &IR), typename AnalysisResultListT::iterator()));
|
std::make_pair(ID, &IR), typename AnalysisResultListT::iterator()));
|
||||||
|
|
||||||
// If we don't have a cached result for this function, look up the pass and
|
// If we don't have a cached result for this function, look up the pass and
|
||||||
// run it to produce a result, which we then add to the cache.
|
// run it to produce a result, which we then add to the cache.
|
||||||
if (Inserted) {
|
if (Inserted) {
|
||||||
auto &P = this->lookupPass(PassID);
|
auto &P = this->lookupPass(ID);
|
||||||
if (DebugLogging)
|
if (DebugLogging)
|
||||||
dbgs() << "Running analysis: " << P.name() << "\n";
|
dbgs() << "Running analysis: " << P.name() << "\n";
|
||||||
AnalysisResultListT &ResultList = AnalysisResultLists[&IR];
|
AnalysisResultListT &ResultList = AnalysisResultLists[&IR];
|
||||||
ResultList.emplace_back(PassID, P.run(IR, *this, ExtraArgs...));
|
ResultList.emplace_back(ID, P.run(IR, *this, ExtraArgs...));
|
||||||
|
|
||||||
// P.run may have inserted elements into AnalysisResults and invalidated
|
// P.run may have inserted elements into AnalysisResults and invalidated
|
||||||
// RI.
|
// RI.
|
||||||
RI = AnalysisResults.find(std::make_pair(PassID, &IR));
|
RI = AnalysisResults.find(std::make_pair(ID, &IR));
|
||||||
assert(RI != AnalysisResults.end() && "we just inserted it!");
|
assert(RI != AnalysisResults.end() && "we just inserted it!");
|
||||||
|
|
||||||
RI->second = std::prev(ResultList.end());
|
RI->second = std::prev(ResultList.end());
|
||||||
@ -560,28 +570,28 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Get a cached analysis result or return null.
|
/// \brief Get a cached analysis result or return null.
|
||||||
ResultConceptT *getCachedResultImpl(void *PassID, IRUnitT &IR) const {
|
ResultConceptT *getCachedResultImpl(AnalysisKey *ID, IRUnitT &IR) const {
|
||||||
typename AnalysisResultMapT::const_iterator RI =
|
typename AnalysisResultMapT::const_iterator RI =
|
||||||
AnalysisResults.find(std::make_pair(PassID, &IR));
|
AnalysisResults.find(std::make_pair(ID, &IR));
|
||||||
return RI == AnalysisResults.end() ? nullptr : &*RI->second->second;
|
return RI == AnalysisResults.end() ? nullptr : &*RI->second->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Invalidate a function pass result.
|
/// \brief Invalidate a function pass result.
|
||||||
void invalidateImpl(void *PassID, IRUnitT &IR) {
|
void invalidateImpl(AnalysisKey *ID, IRUnitT &IR) {
|
||||||
typename AnalysisResultMapT::iterator RI =
|
typename AnalysisResultMapT::iterator RI =
|
||||||
AnalysisResults.find(std::make_pair(PassID, &IR));
|
AnalysisResults.find(std::make_pair(ID, &IR));
|
||||||
if (RI == AnalysisResults.end())
|
if (RI == AnalysisResults.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (DebugLogging)
|
if (DebugLogging)
|
||||||
dbgs() << "Invalidating analysis: " << this->lookupPass(PassID).name()
|
dbgs() << "Invalidating analysis: " << this->lookupPass(ID).name()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
AnalysisResultLists[&IR].erase(RI->second);
|
AnalysisResultLists[&IR].erase(RI->second);
|
||||||
AnalysisResults.erase(RI);
|
AnalysisResults.erase(RI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Map type from module analysis pass ID to pass concept pointer.
|
/// \brief Map type from module analysis pass ID to pass concept pointer.
|
||||||
typedef DenseMap<void *, std::unique_ptr<PassConceptT>> AnalysisPassMapT;
|
typedef DenseMap<AnalysisKey *, std::unique_ptr<PassConceptT>> AnalysisPassMapT;
|
||||||
|
|
||||||
/// \brief Collection of module analysis passes, indexed by ID.
|
/// \brief Collection of module analysis passes, indexed by ID.
|
||||||
AnalysisPassMapT AnalysisPasses;
|
AnalysisPassMapT AnalysisPasses;
|
||||||
@ -592,7 +602,7 @@ private:
|
|||||||
/// erases. Provides both the pass ID and concept pointer such that it is
|
/// erases. Provides both the pass ID and concept pointer such that it is
|
||||||
/// half of a bijection and provides storage for the actual result concept.
|
/// half of a bijection and provides storage for the actual result concept.
|
||||||
typedef std::list<std::pair<
|
typedef std::list<std::pair<
|
||||||
void *, std::unique_ptr<detail::AnalysisResultConcept<IRUnitT>>>>
|
AnalysisKey *, std::unique_ptr<detail::AnalysisResultConcept<IRUnitT>>>>
|
||||||
AnalysisResultListT;
|
AnalysisResultListT;
|
||||||
|
|
||||||
/// \brief Map type from function pointer to our custom list type.
|
/// \brief Map type from function pointer to our custom list type.
|
||||||
@ -606,7 +616,7 @@ private:
|
|||||||
|
|
||||||
/// \brief Map type from a pair of analysis ID and function pointer to an
|
/// \brief Map type from a pair of analysis ID and function pointer to an
|
||||||
/// iterator into a particular result list.
|
/// iterator into a particular result list.
|
||||||
typedef DenseMap<std::pair<void *, IRUnitT *>,
|
typedef DenseMap<std::pair<AnalysisKey *, IRUnitT *>,
|
||||||
typename AnalysisResultListT::iterator>
|
typename AnalysisResultListT::iterator>
|
||||||
AnalysisResultMapT;
|
AnalysisResultMapT;
|
||||||
|
|
||||||
@ -718,14 +728,14 @@ public:
|
|||||||
private:
|
private:
|
||||||
friend AnalysisInfoMixin<
|
friend AnalysisInfoMixin<
|
||||||
InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT>>;
|
InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT>>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
AnalysisManagerT *AM;
|
AnalysisManagerT *AM;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
|
template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
|
||||||
char
|
AnalysisKey
|
||||||
InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT, ExtraArgTs...>::PassID;
|
InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT, ExtraArgTs...>::Key;
|
||||||
|
|
||||||
extern template class InnerAnalysisManagerProxy<FunctionAnalysisManager,
|
extern template class InnerAnalysisManagerProxy<FunctionAnalysisManager,
|
||||||
Module>;
|
Module>;
|
||||||
@ -777,14 +787,14 @@ public:
|
|||||||
private:
|
private:
|
||||||
friend AnalysisInfoMixin<
|
friend AnalysisInfoMixin<
|
||||||
OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT>>;
|
OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT>>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
const AnalysisManagerT *AM;
|
const AnalysisManagerT *AM;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
|
template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
|
||||||
char
|
AnalysisKey
|
||||||
OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT, ExtraArgTs...>::PassID;
|
OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT, ExtraArgTs...>::Key;
|
||||||
|
|
||||||
extern template class OuterAnalysisManagerProxy<ModuleAnalysisManager,
|
extern template class OuterAnalysisManagerProxy<ModuleAnalysisManager,
|
||||||
Function>;
|
Function>;
|
||||||
|
@ -58,13 +58,12 @@ FunctionPass *createVerifierPass(bool FatalErrors = true);
|
|||||||
/// and debug info errors.
|
/// and debug info errors.
|
||||||
class VerifierAnalysis : public AnalysisInfoMixin<VerifierAnalysis> {
|
class VerifierAnalysis : public AnalysisInfoMixin<VerifierAnalysis> {
|
||||||
friend AnalysisInfoMixin<VerifierAnalysis>;
|
friend AnalysisInfoMixin<VerifierAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Result {
|
struct Result {
|
||||||
bool IRBroken, DebugInfoBroken;
|
bool IRBroken, DebugInfoBroken;
|
||||||
};
|
};
|
||||||
static void *ID() { return (void *)&PassID; }
|
|
||||||
Result run(Module &M, ModuleAnalysisManager &);
|
Result run(Module &M, ModuleAnalysisManager &);
|
||||||
Result run(Function &F, FunctionAnalysisManager &);
|
Result run(Function &F, FunctionAnalysisManager &);
|
||||||
};
|
};
|
||||||
|
@ -672,7 +672,7 @@ public:
|
|||||||
///
|
///
|
||||||
class MemorySSAAnalysis : public AnalysisInfoMixin<MemorySSAAnalysis> {
|
class MemorySSAAnalysis : public AnalysisInfoMixin<MemorySSAAnalysis> {
|
||||||
friend AnalysisInfoMixin<MemorySSAAnalysis>;
|
friend AnalysisInfoMixin<MemorySSAAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Wrap MemorySSA result to ensure address stability of internal MemorySSA
|
// Wrap MemorySSA result to ensure address stability of internal MemorySSA
|
||||||
|
@ -513,7 +513,7 @@ bool AAResults::canInstructionRangeModRef(const Instruction &I1,
|
|||||||
AAResults::Concept::~Concept() {}
|
AAResults::Concept::~Concept() {}
|
||||||
|
|
||||||
// Provide a definition for the static object used to identify passes.
|
// Provide a definition for the static object used to identify passes.
|
||||||
char AAManager::PassID;
|
AnalysisKey AAManager::Key;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
/// A wrapper pass for external alias analyses. This just squirrels away the
|
/// A wrapper pass for external alias analyses. This just squirrels away the
|
||||||
|
@ -74,7 +74,7 @@ void AssumptionCache::registerAssumption(CallInst *CI) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char AssumptionAnalysis::PassID;
|
AnalysisKey AssumptionAnalysis::Key;
|
||||||
|
|
||||||
PreservedAnalyses AssumptionPrinterPass::run(Function &F,
|
PreservedAnalyses AssumptionPrinterPass::run(Function &F,
|
||||||
FunctionAnalysisManager &AM) {
|
FunctionAnalysisManager &AM) {
|
||||||
|
@ -1715,7 +1715,7 @@ bool BasicAAResult::constantOffsetHeuristic(
|
|||||||
// BasicAliasAnalysis Pass
|
// BasicAliasAnalysis Pass
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
char BasicAA::PassID;
|
AnalysisKey BasicAA::Key;
|
||||||
|
|
||||||
BasicAAResult BasicAA::run(Function &F, FunctionAnalysisManager &AM) {
|
BasicAAResult BasicAA::run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
return BasicAAResult(F.getParent()->getDataLayout(),
|
return BasicAAResult(F.getParent()->getDataLayout(),
|
||||||
|
@ -252,7 +252,7 @@ bool BlockFrequencyInfoWrapperPass::runOnFunction(Function &F) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char BlockFrequencyAnalysis::PassID;
|
AnalysisKey BlockFrequencyAnalysis::Key;
|
||||||
BlockFrequencyInfo BlockFrequencyAnalysis::run(Function &F,
|
BlockFrequencyInfo BlockFrequencyAnalysis::run(Function &F,
|
||||||
FunctionAnalysisManager &AM) {
|
FunctionAnalysisManager &AM) {
|
||||||
BlockFrequencyInfo BFI;
|
BlockFrequencyInfo BFI;
|
||||||
|
@ -711,7 +711,7 @@ void BranchProbabilityInfoWrapperPass::print(raw_ostream &OS,
|
|||||||
BPI.print(OS);
|
BPI.print(OS);
|
||||||
}
|
}
|
||||||
|
|
||||||
char BranchProbabilityAnalysis::PassID;
|
AnalysisKey BranchProbabilityAnalysis::Key;
|
||||||
BranchProbabilityInfo
|
BranchProbabilityInfo
|
||||||
BranchProbabilityAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
|
BranchProbabilityAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
BranchProbabilityInfo BPI;
|
BranchProbabilityInfo BPI;
|
||||||
|
@ -865,7 +865,7 @@ AliasResult CFLAndersAAResult::alias(const MemoryLocation &LocA,
|
|||||||
return QueryResult;
|
return QueryResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
char CFLAndersAA::PassID;
|
AnalysisKey CFLAndersAA::Key;
|
||||||
|
|
||||||
CFLAndersAAResult CFLAndersAA::run(Function &F, FunctionAnalysisManager &AM) {
|
CFLAndersAAResult CFLAndersAA::run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
return CFLAndersAAResult(AM.getResult<TargetLibraryAnalysis>(F));
|
return CFLAndersAAResult(AM.getResult<TargetLibraryAnalysis>(F));
|
||||||
|
@ -341,7 +341,7 @@ AliasResult CFLSteensAAResult::query(const MemoryLocation &LocA,
|
|||||||
return NoAlias;
|
return NoAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
char CFLSteensAA::PassID;
|
AnalysisKey CFLSteensAA::Key;
|
||||||
|
|
||||||
CFLSteensAAResult CFLSteensAA::run(Function &F, FunctionAnalysisManager &AM) {
|
CFLSteensAAResult CFLSteensAA::run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
return CFLSteensAAResult(AM.getResult<TargetLibraryAnalysis>(F));
|
return CFLSteensAAResult(AM.getResult<TargetLibraryAnalysis>(F));
|
||||||
|
@ -258,7 +258,7 @@ void CallGraphNode::replaceCallEdge(CallSite CS,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Provide an explicit template instantiation for the static ID.
|
// Provide an explicit template instantiation for the static ID.
|
||||||
char CallGraphAnalysis::PassID;
|
AnalysisKey CallGraphAnalysis::Key;
|
||||||
|
|
||||||
PreservedAnalyses CallGraphPrinterPass::run(Module &M,
|
PreservedAnalyses CallGraphPrinterPass::run(Module &M,
|
||||||
ModuleAnalysisManager &AM) {
|
ModuleAnalysisManager &AM) {
|
||||||
|
@ -386,7 +386,7 @@ FunctionPass *llvm::createDemandedBitsWrapperPass() {
|
|||||||
return new DemandedBitsWrapperPass();
|
return new DemandedBitsWrapperPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
char DemandedBitsAnalysis::PassID;
|
AnalysisKey DemandedBitsAnalysis::Key;
|
||||||
|
|
||||||
DemandedBits DemandedBitsAnalysis::run(Function &F,
|
DemandedBits DemandedBitsAnalysis::run(Function &F,
|
||||||
FunctionAnalysisManager &AM) {
|
FunctionAnalysisManager &AM) {
|
||||||
|
@ -122,7 +122,7 @@ DependenceAnalysis::run(Function &F, FunctionAnalysisManager &FAM) {
|
|||||||
return DependenceInfo(&F, &AA, &SE, &LI);
|
return DependenceInfo(&F, &AA, &SE, &LI);
|
||||||
}
|
}
|
||||||
|
|
||||||
char DependenceAnalysis::PassID;
|
AnalysisKey DependenceAnalysis::Key;
|
||||||
|
|
||||||
INITIALIZE_PASS_BEGIN(DependenceAnalysisWrapperPass, "da",
|
INITIALIZE_PASS_BEGIN(DependenceAnalysisWrapperPass, "da",
|
||||||
"Dependence Analysis", true, true)
|
"Dependence Analysis", true, true)
|
||||||
|
@ -56,7 +56,7 @@ LLVM_DUMP_METHOD void DominanceFrontierWrapperPass::dump() const {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char DominanceFrontierAnalysis::PassID;
|
AnalysisKey DominanceFrontierAnalysis::Key;
|
||||||
|
|
||||||
DominanceFrontier DominanceFrontierAnalysis::run(Function &F,
|
DominanceFrontier DominanceFrontierAnalysis::run(Function &F,
|
||||||
FunctionAnalysisManager &AM) {
|
FunctionAnalysisManager &AM) {
|
||||||
|
@ -941,7 +941,7 @@ GlobalsAAResult::analyzeModule(Module &M, const TargetLibraryInfo &TLI,
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
char GlobalsAA::PassID;
|
AnalysisKey GlobalsAA::Key;
|
||||||
|
|
||||||
GlobalsAAResult GlobalsAA::run(Module &M, ModuleAnalysisManager &AM) {
|
GlobalsAAResult GlobalsAA::run(Module &M, ModuleAnalysisManager &AM) {
|
||||||
return GlobalsAAResult::analyzeModule(M,
|
return GlobalsAAResult::analyzeModule(M,
|
||||||
|
@ -34,7 +34,7 @@ using namespace llvm;
|
|||||||
|
|
||||||
#define DEBUG_TYPE "iv-users"
|
#define DEBUG_TYPE "iv-users"
|
||||||
|
|
||||||
char IVUsersAnalysis::PassID;
|
AnalysisKey IVUsersAnalysis::Key;
|
||||||
|
|
||||||
IVUsers IVUsersAnalysis::run(Loop &L, LoopAnalysisManager &AM) {
|
IVUsers IVUsersAnalysis::run(Loop &L, LoopAnalysisManager &AM) {
|
||||||
const auto &FAM =
|
const auto &FAM =
|
||||||
|
@ -1833,7 +1833,7 @@ bool LazyCallGraph::buildNextRefSCCInPostOrder() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char LazyCallGraphAnalysis::PassID;
|
AnalysisKey LazyCallGraphAnalysis::Key;
|
||||||
|
|
||||||
LazyCallGraphPrinterPass::LazyCallGraphPrinterPass(raw_ostream &OS) : OS(OS) {}
|
LazyCallGraphPrinterPass::LazyCallGraphPrinterPass(raw_ostream &OS) : OS(OS) {}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace llvm {
|
|||||||
FunctionPass *createLazyValueInfoPass() { return new LazyValueInfoWrapperPass(); }
|
FunctionPass *createLazyValueInfoPass() { return new LazyValueInfoWrapperPass(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
char LazyValueAnalysis::PassID;
|
AnalysisKey LazyValueAnalysis::Key;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// LVILatticeVal
|
// LVILatticeVal
|
||||||
|
@ -2067,7 +2067,7 @@ INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
|||||||
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
|
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
|
||||||
INITIALIZE_PASS_END(LoopAccessLegacyAnalysis, LAA_NAME, laa_name, false, true)
|
INITIALIZE_PASS_END(LoopAccessLegacyAnalysis, LAA_NAME, laa_name, false, true)
|
||||||
|
|
||||||
char LoopAccessAnalysis::PassID;
|
AnalysisKey LoopAccessAnalysis::Key;
|
||||||
|
|
||||||
LoopAccessInfo LoopAccessAnalysis::run(Loop &L, LoopAnalysisManager &AM) {
|
LoopAccessInfo LoopAccessAnalysis::run(Loop &L, LoopAnalysisManager &AM) {
|
||||||
const FunctionAnalysisManager &FAM =
|
const FunctionAnalysisManager &FAM =
|
||||||
|
@ -669,7 +669,7 @@ void LoopInfo::markAsRemoved(Loop *Unloop) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char LoopAnalysis::PassID;
|
AnalysisKey LoopAnalysis::Key;
|
||||||
|
|
||||||
LoopInfo LoopAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
|
LoopInfo LoopAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
// FIXME: Currently we create a LoopInfo from scratch for every function.
|
// FIXME: Currently we create a LoopInfo from scratch for every function.
|
||||||
|
@ -1643,7 +1643,7 @@ void MemoryDependenceResults::verifyRemoved(Instruction *D) const {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char MemoryDependenceAnalysis::PassID;
|
AnalysisKey MemoryDependenceAnalysis::Key;
|
||||||
|
|
||||||
MemoryDependenceResults
|
MemoryDependenceResults
|
||||||
MemoryDependenceAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
|
MemoryDependenceAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
|
@ -305,7 +305,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
|
|||||||
return Index;
|
return Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
char ModuleSummaryIndexAnalysis::PassID;
|
AnalysisKey ModuleSummaryIndexAnalysis::Key;
|
||||||
|
|
||||||
ModuleSummaryIndex
|
ModuleSummaryIndex
|
||||||
ModuleSummaryIndexAnalysis::run(Module &M, ModuleAnalysisManager &AM) {
|
ModuleSummaryIndexAnalysis::run(Module &M, ModuleAnalysisManager &AM) {
|
||||||
|
@ -237,7 +237,7 @@ void OptimizationRemarkEmitterWrapperPass::getAnalysisUsage(
|
|||||||
AU.setPreservesAll();
|
AU.setPreservesAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
char OptimizationRemarkEmitterAnalysis::PassID;
|
AnalysisKey OptimizationRemarkEmitterAnalysis::Key;
|
||||||
|
|
||||||
OptimizationRemarkEmitter
|
OptimizationRemarkEmitter
|
||||||
OptimizationRemarkEmitterAnalysis::run(Function &F,
|
OptimizationRemarkEmitterAnalysis::run(Function &F,
|
||||||
|
@ -44,7 +44,7 @@ FunctionPass* llvm::createPostDomTree() {
|
|||||||
return new PostDominatorTreeWrapperPass();
|
return new PostDominatorTreeWrapperPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
char PostDominatorTreeAnalysis::PassID;
|
AnalysisKey PostDominatorTreeAnalysis::Key;
|
||||||
|
|
||||||
PostDominatorTree PostDominatorTreeAnalysis::run(Function &F,
|
PostDominatorTree PostDominatorTreeAnalysis::run(Function &F,
|
||||||
FunctionAnalysisManager &) {
|
FunctionAnalysisManager &) {
|
||||||
|
@ -159,7 +159,7 @@ bool ProfileSummaryInfoWrapperPass::doFinalization(Module &M) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char ProfileSummaryAnalysis::PassID;
|
AnalysisKey ProfileSummaryAnalysis::Key;
|
||||||
ProfileSummaryInfo ProfileSummaryAnalysis::run(Module &M,
|
ProfileSummaryInfo ProfileSummaryAnalysis::run(Module &M,
|
||||||
ModuleAnalysisManager &) {
|
ModuleAnalysisManager &) {
|
||||||
return ProfileSummaryInfo(M);
|
return ProfileSummaryInfo(M);
|
||||||
|
@ -181,7 +181,7 @@ namespace llvm {
|
|||||||
// RegionInfoAnalysis implementation
|
// RegionInfoAnalysis implementation
|
||||||
//
|
//
|
||||||
|
|
||||||
char RegionInfoAnalysis::PassID;
|
AnalysisKey RegionInfoAnalysis::Key;
|
||||||
|
|
||||||
RegionInfo RegionInfoAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
|
RegionInfo RegionInfoAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
RegionInfo RI;
|
RegionInfo RI;
|
||||||
|
@ -10013,7 +10013,7 @@ void ScalarEvolution::verify() const {
|
|||||||
// TODO: Verify more things.
|
// TODO: Verify more things.
|
||||||
}
|
}
|
||||||
|
|
||||||
char ScalarEvolutionAnalysis::PassID;
|
AnalysisKey ScalarEvolutionAnalysis::Key;
|
||||||
|
|
||||||
ScalarEvolution ScalarEvolutionAnalysis::run(Function &F,
|
ScalarEvolution ScalarEvolutionAnalysis::run(Function &F,
|
||||||
FunctionAnalysisManager &AM) {
|
FunctionAnalysisManager &AM) {
|
||||||
|
@ -110,7 +110,7 @@ Value *SCEVAAResult::GetBaseValue(const SCEV *S) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
char SCEVAA::PassID;
|
AnalysisKey SCEVAA::Key;
|
||||||
|
|
||||||
SCEVAAResult SCEVAA::run(Function &F, FunctionAnalysisManager &AM) {
|
SCEVAAResult SCEVAA::run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
return SCEVAAResult(AM.getResult<ScalarEvolutionAnalysis>(F));
|
return SCEVAAResult(AM.getResult<ScalarEvolutionAnalysis>(F));
|
||||||
|
@ -173,7 +173,7 @@ bool ScopedNoAliasAAResult::mayAliasInScopes(const MDNode *Scopes,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char ScopedNoAliasAA::PassID;
|
AnalysisKey ScopedNoAliasAA::Key;
|
||||||
|
|
||||||
ScopedNoAliasAAResult ScopedNoAliasAA::run(Function &F,
|
ScopedNoAliasAAResult ScopedNoAliasAA::run(Function &F,
|
||||||
FunctionAnalysisManager &AM) {
|
FunctionAnalysisManager &AM) {
|
||||||
|
@ -1265,7 +1265,7 @@ TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass(
|
|||||||
initializeTargetLibraryInfoWrapperPassPass(*PassRegistry::getPassRegistry());
|
initializeTargetLibraryInfoWrapperPassPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
|
|
||||||
char TargetLibraryAnalysis::PassID;
|
AnalysisKey TargetLibraryAnalysis::Key;
|
||||||
|
|
||||||
// Register the basic pass.
|
// Register the basic pass.
|
||||||
INITIALIZE_PASS(TargetLibraryInfoWrapperPass, "targetlibinfo",
|
INITIALIZE_PASS(TargetLibraryInfoWrapperPass, "targetlibinfo",
|
||||||
|
@ -473,7 +473,7 @@ TargetIRAnalysis::Result TargetIRAnalysis::run(const Function &F,
|
|||||||
return TTICallback(F);
|
return TTICallback(F);
|
||||||
}
|
}
|
||||||
|
|
||||||
char TargetIRAnalysis::PassID;
|
AnalysisKey TargetIRAnalysis::Key;
|
||||||
|
|
||||||
TargetIRAnalysis::Result TargetIRAnalysis::getDefaultTTI(const Function &F) {
|
TargetIRAnalysis::Result TargetIRAnalysis::getDefaultTTI(const Function &F) {
|
||||||
return Result(F.getParent()->getDataLayout());
|
return Result(F.getParent()->getDataLayout());
|
||||||
|
@ -550,7 +550,7 @@ bool TypeBasedAAResult::Aliases(const MDNode *A, const MDNode *B) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char TypeBasedAA::PassID;
|
AnalysisKey TypeBasedAA::Key;
|
||||||
|
|
||||||
TypeBasedAAResult TypeBasedAA::run(Function &F, FunctionAnalysisManager &AM) {
|
TypeBasedAAResult TypeBasedAA::run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
return TypeBasedAAResult();
|
return TypeBasedAAResult();
|
||||||
|
@ -311,7 +311,7 @@ DominatorTree DominatorTreeAnalysis::run(Function &F,
|
|||||||
return DT;
|
return DT;
|
||||||
}
|
}
|
||||||
|
|
||||||
char DominatorTreeAnalysis::PassID;
|
AnalysisKey DominatorTreeAnalysis::Key;
|
||||||
|
|
||||||
DominatorTreePrinterPass::DominatorTreePrinterPass(raw_ostream &OS) : OS(OS) {}
|
DominatorTreePrinterPass::DominatorTreePrinterPass(raw_ostream &OS) : OS(OS) {}
|
||||||
|
|
||||||
|
@ -24,3 +24,5 @@ template class AnalysisManager<Function>;
|
|||||||
template class InnerAnalysisManagerProxy<FunctionAnalysisManager, Module>;
|
template class InnerAnalysisManagerProxy<FunctionAnalysisManager, Module>;
|
||||||
template class OuterAnalysisManagerProxy<ModuleAnalysisManager, Function>;
|
template class OuterAnalysisManagerProxy<ModuleAnalysisManager, Function>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AnalysisKey PreservedAnalyses::AllAnalysesKey;
|
||||||
|
@ -4473,7 +4473,7 @@ FunctionPass *llvm::createVerifierPass(bool FatalErrors) {
|
|||||||
return new VerifierLegacyPass(FatalErrors);
|
return new VerifierLegacyPass(FatalErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
char VerifierAnalysis::PassID;
|
AnalysisKey VerifierAnalysis::Key;
|
||||||
VerifierAnalysis::Result VerifierAnalysis::run(Module &M,
|
VerifierAnalysis::Result VerifierAnalysis::run(Module &M,
|
||||||
ModuleAnalysisManager &) {
|
ModuleAnalysisManager &) {
|
||||||
Result Res;
|
Result Res;
|
||||||
|
@ -152,7 +152,7 @@ struct NoOpModulePass {
|
|||||||
/// \brief No-op module analysis.
|
/// \brief No-op module analysis.
|
||||||
class NoOpModuleAnalysis : public AnalysisInfoMixin<NoOpModuleAnalysis> {
|
class NoOpModuleAnalysis : public AnalysisInfoMixin<NoOpModuleAnalysis> {
|
||||||
friend AnalysisInfoMixin<NoOpModuleAnalysis>;
|
friend AnalysisInfoMixin<NoOpModuleAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Result {};
|
struct Result {};
|
||||||
@ -172,7 +172,7 @@ struct NoOpCGSCCPass {
|
|||||||
/// \brief No-op CGSCC analysis.
|
/// \brief No-op CGSCC analysis.
|
||||||
class NoOpCGSCCAnalysis : public AnalysisInfoMixin<NoOpCGSCCAnalysis> {
|
class NoOpCGSCCAnalysis : public AnalysisInfoMixin<NoOpCGSCCAnalysis> {
|
||||||
friend AnalysisInfoMixin<NoOpCGSCCAnalysis>;
|
friend AnalysisInfoMixin<NoOpCGSCCAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Result {};
|
struct Result {};
|
||||||
@ -193,7 +193,7 @@ struct NoOpFunctionPass {
|
|||||||
/// \brief No-op function analysis.
|
/// \brief No-op function analysis.
|
||||||
class NoOpFunctionAnalysis : public AnalysisInfoMixin<NoOpFunctionAnalysis> {
|
class NoOpFunctionAnalysis : public AnalysisInfoMixin<NoOpFunctionAnalysis> {
|
||||||
friend AnalysisInfoMixin<NoOpFunctionAnalysis>;
|
friend AnalysisInfoMixin<NoOpFunctionAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Result {};
|
struct Result {};
|
||||||
@ -212,7 +212,7 @@ struct NoOpLoopPass {
|
|||||||
/// \brief No-op loop analysis.
|
/// \brief No-op loop analysis.
|
||||||
class NoOpLoopAnalysis : public AnalysisInfoMixin<NoOpLoopAnalysis> {
|
class NoOpLoopAnalysis : public AnalysisInfoMixin<NoOpLoopAnalysis> {
|
||||||
friend AnalysisInfoMixin<NoOpLoopAnalysis>;
|
friend AnalysisInfoMixin<NoOpLoopAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Result {};
|
struct Result {};
|
||||||
@ -220,10 +220,10 @@ public:
|
|||||||
static StringRef name() { return "NoOpLoopAnalysis"; }
|
static StringRef name() { return "NoOpLoopAnalysis"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
char NoOpModuleAnalysis::PassID;
|
AnalysisKey NoOpModuleAnalysis::Key;
|
||||||
char NoOpCGSCCAnalysis::PassID;
|
AnalysisKey NoOpCGSCCAnalysis::Key;
|
||||||
char NoOpFunctionAnalysis::PassID;
|
AnalysisKey NoOpFunctionAnalysis::Key;
|
||||||
char NoOpLoopAnalysis::PassID;
|
AnalysisKey NoOpLoopAnalysis::Key;
|
||||||
|
|
||||||
} // End anonymous namespace.
|
} // End anonymous namespace.
|
||||||
|
|
||||||
|
@ -2067,7 +2067,7 @@ bool MemorySSAPrinterLegacyPass::runOnFunction(Function &F) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char MemorySSAAnalysis::PassID;
|
AnalysisKey MemorySSAAnalysis::Key;
|
||||||
|
|
||||||
MemorySSAAnalysis::Result MemorySSAAnalysis::run(Function &F,
|
MemorySSAAnalysis::Result MemorySSAAnalysis::run(Function &F,
|
||||||
FunctionAnalysisManager &AM) {
|
FunctionAnalysisManager &AM) {
|
||||||
|
@ -22,16 +22,13 @@ using namespace llvm;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class TestModuleAnalysis {
|
class TestModuleAnalysis : public AnalysisInfoMixin<TestModuleAnalysis> {
|
||||||
public:
|
public:
|
||||||
struct Result {
|
struct Result {
|
||||||
Result(int Count) : FunctionCount(Count) {}
|
Result(int Count) : FunctionCount(Count) {}
|
||||||
int FunctionCount;
|
int FunctionCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *ID() { return (void *)&PassID; }
|
|
||||||
static StringRef name() { return "TestModuleAnalysis"; }
|
|
||||||
|
|
||||||
TestModuleAnalysis(int &Runs) : Runs(Runs) {}
|
TestModuleAnalysis(int &Runs) : Runs(Runs) {}
|
||||||
|
|
||||||
Result run(Module &M, ModuleAnalysisManager &AM) {
|
Result run(Module &M, ModuleAnalysisManager &AM) {
|
||||||
@ -40,23 +37,21 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static char PassID;
|
friend AnalysisInfoMixin<TestModuleAnalysis>;
|
||||||
|
static AnalysisKey Key;
|
||||||
|
|
||||||
int &Runs;
|
int &Runs;
|
||||||
};
|
};
|
||||||
|
|
||||||
char TestModuleAnalysis::PassID;
|
AnalysisKey TestModuleAnalysis::Key;
|
||||||
|
|
||||||
class TestSCCAnalysis {
|
class TestSCCAnalysis : public AnalysisInfoMixin<TestSCCAnalysis> {
|
||||||
public:
|
public:
|
||||||
struct Result {
|
struct Result {
|
||||||
Result(int Count) : FunctionCount(Count) {}
|
Result(int Count) : FunctionCount(Count) {}
|
||||||
int FunctionCount;
|
int FunctionCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *ID() { return (void *)&PassID; }
|
|
||||||
static StringRef name() { return "TestSCCAnalysis"; }
|
|
||||||
|
|
||||||
TestSCCAnalysis(int &Runs) : Runs(Runs) {}
|
TestSCCAnalysis(int &Runs) : Runs(Runs) {}
|
||||||
|
|
||||||
Result run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &) {
|
Result run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &) {
|
||||||
@ -65,23 +60,21 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static char PassID;
|
friend AnalysisInfoMixin<TestSCCAnalysis>;
|
||||||
|
static AnalysisKey Key;
|
||||||
|
|
||||||
int &Runs;
|
int &Runs;
|
||||||
};
|
};
|
||||||
|
|
||||||
char TestSCCAnalysis::PassID;
|
AnalysisKey TestSCCAnalysis::Key;
|
||||||
|
|
||||||
class TestFunctionAnalysis {
|
class TestFunctionAnalysis : public AnalysisInfoMixin<TestFunctionAnalysis> {
|
||||||
public:
|
public:
|
||||||
struct Result {
|
struct Result {
|
||||||
Result(int Count) : InstructionCount(Count) {}
|
Result(int Count) : InstructionCount(Count) {}
|
||||||
int InstructionCount;
|
int InstructionCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *ID() { return (void *)&PassID; }
|
|
||||||
static StringRef name() { return "TestFunctionAnalysis"; }
|
|
||||||
|
|
||||||
TestFunctionAnalysis(int &Runs) : Runs(Runs) {}
|
TestFunctionAnalysis(int &Runs) : Runs(Runs) {}
|
||||||
|
|
||||||
Result run(Function &F, FunctionAnalysisManager &AM) {
|
Result run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
@ -95,22 +88,21 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static char PassID;
|
friend AnalysisInfoMixin<TestFunctionAnalysis>;
|
||||||
|
static AnalysisKey Key;
|
||||||
|
|
||||||
int &Runs;
|
int &Runs;
|
||||||
};
|
};
|
||||||
|
|
||||||
char TestFunctionAnalysis::PassID;
|
AnalysisKey TestFunctionAnalysis::Key;
|
||||||
|
|
||||||
class TestImmutableFunctionAnalysis {
|
class TestImmutableFunctionAnalysis
|
||||||
|
: public AnalysisInfoMixin<TestImmutableFunctionAnalysis> {
|
||||||
public:
|
public:
|
||||||
struct Result {
|
struct Result {
|
||||||
bool invalidate(Function &, const PreservedAnalyses &) { return false; }
|
bool invalidate(Function &, const PreservedAnalyses &) { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *ID() { return (void *)&PassID; }
|
|
||||||
static StringRef name() { return "TestImmutableFunctionAnalysis"; }
|
|
||||||
|
|
||||||
TestImmutableFunctionAnalysis(int &Runs) : Runs(Runs) {}
|
TestImmutableFunctionAnalysis(int &Runs) : Runs(Runs) {}
|
||||||
|
|
||||||
Result run(Function &F, FunctionAnalysisManager &AM) {
|
Result run(Function &F, FunctionAnalysisManager &AM) {
|
||||||
@ -119,12 +111,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static char PassID;
|
friend AnalysisInfoMixin<TestImmutableFunctionAnalysis>;
|
||||||
|
static AnalysisKey Key;
|
||||||
|
|
||||||
int &Runs;
|
int &Runs;
|
||||||
};
|
};
|
||||||
|
|
||||||
char TestImmutableFunctionAnalysis::PassID;
|
AnalysisKey TestImmutableFunctionAnalysis::Key;
|
||||||
|
|
||||||
struct LambdaSCCPass : public PassInfoMixin<LambdaSCCPass> {
|
struct LambdaSCCPass : public PassInfoMixin<LambdaSCCPass> {
|
||||||
template <typename T> LambdaSCCPass(T &&Arg) : Func(std::forward<T>(Arg)) {}
|
template <typename T> LambdaSCCPass(T &&Arg) : Func(std::forward<T>(Arg)) {}
|
||||||
|
@ -21,9 +21,9 @@ using namespace llvm;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class TestLoopAnalysis {
|
class TestLoopAnalysis : public AnalysisInfoMixin<TestLoopAnalysis> {
|
||||||
/// \brief Private static data to provide unique ID.
|
friend AnalysisInfoMixin<TestLoopAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
int &Runs;
|
int &Runs;
|
||||||
|
|
||||||
@ -33,12 +33,6 @@ public:
|
|||||||
int BlockCount;
|
int BlockCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Returns an opaque, unique ID for this pass type.
|
|
||||||
static void *ID() { return (void *)&PassID; }
|
|
||||||
|
|
||||||
/// \brief Returns the name of the analysis.
|
|
||||||
static StringRef name() { return "TestLoopAnalysis"; }
|
|
||||||
|
|
||||||
TestLoopAnalysis(int &Runs) : Runs(Runs) {}
|
TestLoopAnalysis(int &Runs) : Runs(Runs) {}
|
||||||
|
|
||||||
/// \brief Run the analysis pass over the loop and return a result.
|
/// \brief Run the analysis pass over the loop and return a result.
|
||||||
@ -52,7 +46,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
char TestLoopAnalysis::PassID;
|
AnalysisKey TestLoopAnalysis::Key;
|
||||||
|
|
||||||
class TestLoopPass {
|
class TestLoopPass {
|
||||||
std::vector<StringRef> &VisitedLoops;
|
std::vector<StringRef> &VisitedLoops;
|
||||||
|
@ -41,12 +41,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend AnalysisInfoMixin<TestFunctionAnalysis>;
|
friend AnalysisInfoMixin<TestFunctionAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
int &Runs;
|
int &Runs;
|
||||||
};
|
};
|
||||||
|
|
||||||
char TestFunctionAnalysis::PassID;
|
AnalysisKey TestFunctionAnalysis::Key;
|
||||||
|
|
||||||
class TestModuleAnalysis : public AnalysisInfoMixin<TestModuleAnalysis> {
|
class TestModuleAnalysis : public AnalysisInfoMixin<TestModuleAnalysis> {
|
||||||
public:
|
public:
|
||||||
@ -67,12 +67,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend AnalysisInfoMixin<TestModuleAnalysis>;
|
friend AnalysisInfoMixin<TestModuleAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
|
|
||||||
int &Runs;
|
int &Runs;
|
||||||
};
|
};
|
||||||
|
|
||||||
char TestModuleAnalysis::PassID;
|
AnalysisKey TestModuleAnalysis::Key;
|
||||||
|
|
||||||
struct TestModulePass : PassInfoMixin<TestModulePass> {
|
struct TestModulePass : PassInfoMixin<TestModulePass> {
|
||||||
TestModulePass(int &RunCount) : RunCount(RunCount) {}
|
TestModulePass(int &RunCount) : RunCount(RunCount) {}
|
||||||
@ -351,10 +351,10 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend AnalysisInfoMixin<CustomizedAnalysis>;
|
friend AnalysisInfoMixin<CustomizedAnalysis>;
|
||||||
static char PassID;
|
static AnalysisKey Key;
|
||||||
};
|
};
|
||||||
|
|
||||||
char CustomizedAnalysis::PassID;
|
AnalysisKey CustomizedAnalysis::Key;
|
||||||
|
|
||||||
struct CustomizedPass : PassInfoMixin<CustomizedPass> {
|
struct CustomizedPass : PassInfoMixin<CustomizedPass> {
|
||||||
std::function<void(CustomizedAnalysis::Result &, int &)> Callback;
|
std::function<void(CustomizedAnalysis::Result &, int &)> Callback;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user