diff options
author | Chris Lattner <sabre@nondot.org> | 2002-05-06 19:31:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-05-06 19:31:52 +0000 |
commit | 27ad137d5ef5bb08f95c388e825b02e9c074b667 (patch) | |
tree | 278a36b1d201020233e75caa38d1504da895377b /lib/VMCore/Pass.cpp | |
parent | 4445519fab769d36f5a97466f5cfe1c618c44921 (diff) |
Make functions that preserve the CFG not invalidate analyses that only depend
on the CFG of a function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2506 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Pass.cpp')
-rw-r--r-- | lib/VMCore/Pass.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index 48e608e90a..b4f837d0d8 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -18,14 +18,37 @@ #include <sys/time.h> #include <stdio.h> +//===----------------------------------------------------------------------===// +// AnalysisID Class Implementation +// + +static std::vector<AnalysisID> CFGOnlyAnalyses; + // Source of unique analysis ID #'s. unsigned AnalysisID::NextID = 0; +AnalysisID::AnalysisID(const AnalysisID &AID, bool DependsOnlyOnCFG) { + ID = AID.ID; // Implement the copy ctor part... + Constructor = AID.Constructor; + + // If this analysis only depends on the CFG of the function, add it to the CFG + // only list... + if (DependsOnlyOnCFG) + CFGOnlyAnalyses.push_back(AID); +} + +//===----------------------------------------------------------------------===// +// AnalysisResolver Class Implementation +// + void AnalysisResolver::setAnalysisResolver(Pass *P, AnalysisResolver *AR) { assert(P->Resolver == 0 && "Pass already in a PassManager!"); P->Resolver = AR; } +//===----------------------------------------------------------------------===// +// AnalysisUsage Class Implementation +// // preservesCFG - This function should be called to by the pass, iff they do // not: @@ -37,7 +60,11 @@ void AnalysisResolver::setAnalysisResolver(Pass *P, AnalysisResolver *AR) { // that only depend on the CFG are preserved by this pass. // void AnalysisUsage::preservesCFG() { - // FIXME: implement preservesCFG + // Since this transformation doesn't modify the CFG, it preserves all analyses + // that only depend on the CFG (like dominators, loop info, etc...) + // + Preserved.insert(Preserved.end(), + CFGOnlyAnalyses.begin(), CFGOnlyAnalyses.end()); } |