summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-27 06:56:12 +0000
committerChris Lattner <sabre@nondot.org>2002-04-27 06:56:12 +0000
commitf57b845547302d24ecb6a9e79d7bc386f761a6c9 (patch)
tree369bc5be013a3a6d0373dbf26820d701e01c5297 /lib/Analysis
parentf2361c5e5c2917e6f19a55927b221d8671753a40 (diff)
downloadllvm-f57b845547302d24ecb6a9e79d7bc386f761a6c9.tar.gz
llvm-f57b845547302d24ecb6a9e79d7bc386f761a6c9.tar.bz2
llvm-f57b845547302d24ecb6a9e79d7bc386f761a6c9.tar.xz
* Rename MethodPass class to FunctionPass
- Rename runOnMethod to runOnFunction * Transform getAnalysisUsageInfo into getAnalysisUsage - Method is now const - It now takes one AnalysisUsage object to fill in instead of 3 vectors to fill in - Pass's now specify which other passes they _preserve_ not which ones they modify (be conservative!) - A pass can specify that it preserves all analyses (because it never modifies the underlying program) * s/Method/Function/g in other random places as well git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2333 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/IPA/FindUnsafePointerTypes.cpp8
-rw-r--r--lib/Analysis/IPA/FindUsedTypes.cpp8
-rw-r--r--lib/Analysis/IntervalPartition.cpp10
-rw-r--r--lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp12
-rw-r--r--lib/Analysis/LoopInfo.cpp11
-rw-r--r--lib/Analysis/PostDominators.cpp17
6 files changed, 24 insertions, 42 deletions
diff --git a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
index d689d93cd4..9f908c6c71 100644
--- a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
+++ b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
@@ -95,11 +95,3 @@ void FindUnsafePointerTypes::printResults(const Module *M,
CW << " #" << Counter << ". " << (Value*)*I << "\n";
}
}
-
-// getAnalysisUsageInfo - Of course, we provide ourself...
-//
-void FindUnsafePointerTypes::getAnalysisUsageInfo(Pass::AnalysisSet &Required,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided) {
- Provided.push_back(FindUnsafePointerTypes::ID);
-}
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index 5c961d2beb..86061d8610 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -93,11 +93,3 @@ void FindUsedTypes::printTypes(std::ostream &o, const Module *M = 0) const {
E = UsedTypes.end(); I != E; ++I)
o << " " << *I << "\n";
}
-
-// getAnalysisUsageInfo - Of course, we provide ourself...
-//
-void FindUsedTypes::getAnalysisUsageInfo(Pass::AnalysisSet &Required,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided) {
- Provided.push_back(FindUsedTypes::ID);
-}
diff --git a/lib/Analysis/IntervalPartition.cpp b/lib/Analysis/IntervalPartition.cpp
index 197bed26d7..bb0f582108 100644
--- a/lib/Analysis/IntervalPartition.cpp
+++ b/lib/Analysis/IntervalPartition.cpp
@@ -52,19 +52,19 @@ void IntervalPartition::updatePredecessors(cfg::Interval *Int) {
// IntervalPartition ctor - Build the first level interval partition for the
// specified function...
//
-bool IntervalPartition::runOnMethod(Function *M) {
- assert(M->front() && "Cannot operate on prototypes!");
+bool IntervalPartition::runOnFunction(Function *F) {
+ assert(F->front() && "Cannot operate on prototypes!");
// Pass false to intervals_begin because we take ownership of it's memory
- function_interval_iterator I = intervals_begin(M, false);
- assert(I != intervals_end(M) && "No intervals in function!?!?!");
+ function_interval_iterator I = intervals_begin(F, false);
+ assert(I != intervals_end(F) && "No intervals in function!?!?!");
addIntervalToPartition(RootInterval = *I);
++I; // After the first one...
// Add the rest of the intervals to the partition...
- for_each(I, intervals_end(M),
+ for_each(I, intervals_end(F),
bind_obj(this, &IntervalPartition::addIntervalToPartition));
// Now that we know all of the successor information, propogate this to the
diff --git a/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp b/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
index e9e4245cca..0518aef3b8 100644
--- a/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
+++ b/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
@@ -1,6 +1,6 @@
-//===-- MethodLiveVarInfo.cpp - Live Variable Analysis for a Function -----===//
+//===-- FunctionLiveVarInfo.cpp - Live Variable Analysis for a Function ---===//
//
-// This is the interface to method level live variable information that is
+// This is the interface to function level live variable information that is
// provided by live variable analysis.
//
//===----------------------------------------------------------------------===//
@@ -39,10 +39,10 @@ const ValueSet &MethodLiveVarInfo::getInSetOfBB(const BasicBlock *BB) const {
//-----------------------------------------------------------------------------
-// Performs live var analysis for a method
+// Performs live var analysis for a function
//-----------------------------------------------------------------------------
-bool MethodLiveVarInfo::runOnMethod(Function *Meth) {
+bool MethodLiveVarInfo::runOnFunction(Function *Meth) {
M = Meth;
if (DEBUG_LV) std::cerr << "Analysing live variables ...\n";
@@ -149,12 +149,12 @@ void MethodLiveVarInfo::releaseMemory() {
//-----------------------------------------------------------------------------
// Following functions will give the LiveVar info for any machine instr in
-// a method. It should be called after a call to analyze().
+// a function. It should be called after a call to analyze().
//
// Thsese functions calucluates live var info for all the machine instrs in a
// BB when LVInfo for one inst is requested. Hence, this function is useful
// when live var info is required for many (or all) instructions in a basic
-// block. Also, the arguments to this method does not require specific
+// block. Also, the arguments to this function does not require specific
// iterators.
//-----------------------------------------------------------------------------
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index ef47936bba..c34aef7b9c 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -35,7 +35,7 @@ void cfg::LoopInfo::releaseMemory() {
//===----------------------------------------------------------------------===//
// cfg::LoopInfo implementation
//
-bool cfg::LoopInfo::runOnMethod(Function *F) {
+bool cfg::LoopInfo::runOnFunction(Function *F) {
releaseMemory();
Calculate(getAnalysis<DominatorSet>()); // Update
return false;
@@ -53,11 +53,10 @@ void cfg::LoopInfo::Calculate(const DominatorSet &DS) {
TopLevelLoops[i]->setLoopDepth(1);
}
-void cfg::LoopInfo::getAnalysisUsageInfo(Pass::AnalysisSet &Required,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided) {
- Required.push_back(DominatorSet::ID);
- Provided.push_back(ID);
+void cfg::LoopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ AU.addRequired(DominatorSet::ID);
+ AU.addProvided(ID);
}
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index 71ee3d74cf..387b673f60 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -22,7 +22,7 @@ using std::set;
AnalysisID cfg::DominatorSet::ID(AnalysisID::create<cfg::DominatorSet>());
AnalysisID cfg::DominatorSet::PostDomID(AnalysisID::create<cfg::DominatorSet>());
-bool cfg::DominatorSet::runOnMethod(Function *F) {
+bool cfg::DominatorSet::runOnFunction(Function *F) {
Doms.clear(); // Reset from the last time we were run...
if (isPostDominator())
@@ -129,17 +129,16 @@ void cfg::DominatorSet::calcPostDominatorSet(Function *M) {
} while (Changed);
}
-// getAnalysisUsageInfo - This obviously provides a dominator set, but it also
-// uses the UnifyMethodExitNodes pass if building post-dominators
+// getAnalysisUsage - This obviously provides a dominator set, but it also
+// uses the UnifyFunctionExitNodes pass if building post-dominators
//
-void cfg::DominatorSet::getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided) {
+void cfg::DominatorSet::getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
if (isPostDominator()) {
- Provided.push_back(PostDomID);
- Requires.push_back(UnifyMethodExitNodes::ID);
+ AU.addProvided(PostDomID);
+ AU.addRequired(UnifyMethodExitNodes::ID);
} else {
- Provided.push_back(ID);
+ AU.addProvided(ID);
}
}