From 0c0023b75435bc4473e010f88166404ab238afb3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 31 Aug 2003 19:29:52 +0000 Subject: Minor cleanups Iterate from tarj_begin -> tarj_end, not from tarj_begin -> NULL git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8260 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/MemoryDepAnalysis.cpp | 23 +++++++++-------------- lib/Analysis/IPA/MemoryDepAnalysis.cpp | 23 +++++++++-------------- 2 files changed, 18 insertions(+), 28 deletions(-) (limited to 'lib') diff --git a/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp b/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp index 598bff9e39..a185c89119 100644 --- a/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp +++ b/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp @@ -14,7 +14,6 @@ #include "llvm/Analysis/DataStructure.h" #include "llvm/Analysis/DSGraph.h" #include "llvm/Module.h" -#include "llvm/Function.h" #include "llvm/iMemory.h" #include "llvm/iOther.h" #include "llvm/Support/InstVisitor.h" @@ -24,7 +23,6 @@ #include "Support/STLExtras.h" #include "Support/hash_map" #include "Support/hash_set" -#include ///-------------------------------------------------------------------------- @@ -263,10 +261,8 @@ public: /// } /// /// - void MemoryDepAnalysis::ProcessSCC(SCC& S, - ModRefTable& ModRefAfter) -{ + ModRefTable& ModRefAfter) { ModRefTable ModRefCurrent; ModRefTable::ModRefMap& mapCurrent = ModRefCurrent.modRefMap; ModRefTable::ModRefMap& mapAfter = ModRefAfter.modRefMap; @@ -417,27 +413,26 @@ void MemoryDepAnalysis::print(std::ostream &O) const /// /// Run the pass on a function /// -bool MemoryDepAnalysis::runOnFunction(Function& func) -{ - assert(! func.isExternal()); +bool MemoryDepAnalysis::runOnFunction(Function &F) { + assert(!F.isExternal()); // Get the FunctionModRefInfo holding IPModRef results for this function. // Use the TD graph recorded within the FunctionModRefInfo object, which // may not be the same as the original TD graph computed by DS analysis. // - funcModRef = &getAnalysis().getFunctionModRefInfo(func); + funcModRef = &getAnalysis().getFunctionModRefInfo(F); funcGraph = &funcModRef->getFuncGraph(); // TEMPORARY: ptr to depGraph (later just becomes "this"). - assert(funcMap.find(&func) == funcMap.end() && "Analyzing function twice?"); - funcDepGraph = funcMap[&func] = new DependenceGraph(); + assert(!funcMap.count(&F) && "Analyzing function twice?"); + funcDepGraph = funcMap[&F] = new DependenceGraph(); ModRefTable ModRefAfter; SCC* nextSCC; - for (TarjanSCC_iterator tarjSCCiter = tarj_begin(&func); - (nextSCC = *tarjSCCiter) != NULL; ++tarjSCCiter) - ProcessSCC(*nextSCC, ModRefAfter); + for (TarjanSCC_iterator I = tarj_begin(&F), E = tarj_end(&F); + I != E; ++I) + ProcessSCC(**I, ModRefAfter); return true; } diff --git a/lib/Analysis/IPA/MemoryDepAnalysis.cpp b/lib/Analysis/IPA/MemoryDepAnalysis.cpp index 598bff9e39..a185c89119 100644 --- a/lib/Analysis/IPA/MemoryDepAnalysis.cpp +++ b/lib/Analysis/IPA/MemoryDepAnalysis.cpp @@ -14,7 +14,6 @@ #include "llvm/Analysis/DataStructure.h" #include "llvm/Analysis/DSGraph.h" #include "llvm/Module.h" -#include "llvm/Function.h" #include "llvm/iMemory.h" #include "llvm/iOther.h" #include "llvm/Support/InstVisitor.h" @@ -24,7 +23,6 @@ #include "Support/STLExtras.h" #include "Support/hash_map" #include "Support/hash_set" -#include ///-------------------------------------------------------------------------- @@ -263,10 +261,8 @@ public: /// } /// /// - void MemoryDepAnalysis::ProcessSCC(SCC& S, - ModRefTable& ModRefAfter) -{ + ModRefTable& ModRefAfter) { ModRefTable ModRefCurrent; ModRefTable::ModRefMap& mapCurrent = ModRefCurrent.modRefMap; ModRefTable::ModRefMap& mapAfter = ModRefAfter.modRefMap; @@ -417,27 +413,26 @@ void MemoryDepAnalysis::print(std::ostream &O) const /// /// Run the pass on a function /// -bool MemoryDepAnalysis::runOnFunction(Function& func) -{ - assert(! func.isExternal()); +bool MemoryDepAnalysis::runOnFunction(Function &F) { + assert(!F.isExternal()); // Get the FunctionModRefInfo holding IPModRef results for this function. // Use the TD graph recorded within the FunctionModRefInfo object, which // may not be the same as the original TD graph computed by DS analysis. // - funcModRef = &getAnalysis().getFunctionModRefInfo(func); + funcModRef = &getAnalysis().getFunctionModRefInfo(F); funcGraph = &funcModRef->getFuncGraph(); // TEMPORARY: ptr to depGraph (later just becomes "this"). - assert(funcMap.find(&func) == funcMap.end() && "Analyzing function twice?"); - funcDepGraph = funcMap[&func] = new DependenceGraph(); + assert(!funcMap.count(&F) && "Analyzing function twice?"); + funcDepGraph = funcMap[&F] = new DependenceGraph(); ModRefTable ModRefAfter; SCC* nextSCC; - for (TarjanSCC_iterator tarjSCCiter = tarj_begin(&func); - (nextSCC = *tarjSCCiter) != NULL; ++tarjSCCiter) - ProcessSCC(*nextSCC, ModRefAfter); + for (TarjanSCC_iterator I = tarj_begin(&F), E = tarj_end(&F); + I != E; ++I) + ProcessSCC(**I, ModRefAfter); return true; } -- cgit v1.2.3