[llvm-commits] [llvm] r54515 - in /llvm/trunk: include/llvm/PassAnalysisSupport.h include/llvm/PassManagers.h lib/VMCore/Pass.cpp lib/VMCore/PassManager.cpp
Chris Lattner
sabre at nondot.org
Thu Aug 7 22:33:06 PDT 2008
Author: lattner
Date: Fri Aug 8 00:33:04 2008
New Revision: 54515
URL: http://llvm.org/viewvc/llvm-project?rev=54515&view=rev
Log:
Speed up the passmgr by avoiding heap thrashing on vectors.
Modified:
llvm/trunk/include/llvm/PassAnalysisSupport.h
llvm/trunk/include/llvm/PassManagers.h
llvm/trunk/lib/VMCore/Pass.cpp
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/include/llvm/PassAnalysisSupport.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassAnalysisSupport.h?rev=54515&r1=54514&r2=54515&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassAnalysisSupport.h (original)
+++ llvm/trunk/include/llvm/PassAnalysisSupport.h Fri Aug 8 00:33:04 2008
@@ -20,6 +20,7 @@
#define LLVM_PASS_ANALYSIS_SUPPORT_H
#include <vector>
+#include "llvm/ADT/SmallVector.h"
namespace llvm {
@@ -34,9 +35,14 @@
// Pass infrastructure through the getAnalysisUsage virtual function.
//
class AnalysisUsage {
+public:
+ typedef SmallVector<AnalysisID, 32> VectorType;
+
+private:
// Sets of analyses required and preserved by a pass
- std::vector<AnalysisID> Required, RequiredTransitive, Preserved;
+ VectorType Required, RequiredTransitive, Preserved;
bool PreservesAll;
+
public:
AnalysisUsage() : PreservesAll(false) {}
@@ -95,11 +101,11 @@
///
void setPreservesCFG();
- const std::vector<AnalysisID> &getRequiredSet() const { return Required; }
- const std::vector<AnalysisID> &getRequiredTransitiveSet() const {
+ const VectorType &getRequiredSet() const { return Required; }
+ const VectorType &getRequiredTransitiveSet() const {
return RequiredTransitive;
}
- const std::vector<AnalysisID> &getPreservedSet() const { return Preserved; }
+ const VectorType &getPreservedSet() const { return Preserved; }
};
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/include/llvm/PassManagers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=54515&r1=54514&r2=54515&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassManagers.h (original)
+++ llvm/trunk/include/llvm/PassManagers.h Fri Aug 8 00:33:04 2008
@@ -309,7 +309,7 @@
void dumpPassInfo(Pass *P, enum PassDebuggingString S1,
enum PassDebuggingString S2, const char *Msg);
void dumpAnalysisSetInfo(const char *Msg, Pass *P,
- const std::vector<AnalysisID> &Set) const;
+ const AnalysisUsage::VectorType &Set) const;
virtual unsigned getNumContainedPasses() const {
return (unsigned)PassVector.size();
Modified: llvm/trunk/lib/VMCore/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Pass.cpp?rev=54515&r1=54514&r2=54515&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Pass.cpp (original)
+++ llvm/trunk/lib/VMCore/Pass.cpp Fri Aug 8 00:33:04 2008
@@ -294,8 +294,9 @@
namespace {
struct GetCFGOnlyPasses : public PassRegistrationListener {
- std::vector<AnalysisID> &CFGOnlyList;
- GetCFGOnlyPasses(std::vector<AnalysisID> &L) : CFGOnlyList(L) {}
+ typedef AnalysisUsage::VectorType VectorType;
+ VectorType &CFGOnlyList;
+ GetCFGOnlyPasses(VectorType &L) : CFGOnlyList(L) {}
void passEnumerate(const PassInfo *P) {
if (P->isCFGOnlyPass())
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=54515&r1=54514&r2=54515&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Fri Aug 8 00:33:04 2008
@@ -441,8 +441,8 @@
AnalysisUsage AnUsage;
P->getAnalysisUsage(AnUsage);
- const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet();
- for (std::vector<AnalysisID>::const_iterator I = RequiredSet.begin(),
+ const AnalysisUsage::VectorType &RequiredSet = AnUsage.getRequiredSet();
+ for (AnalysisUsage::VectorType::const_iterator I = RequiredSet.begin(),
E = RequiredSet.end(); I != E; ++I) {
Pass *AnalysisPass = findAnalysisPass(*I);
@@ -584,7 +584,7 @@
if (AnUsage.getPreservesAll())
return true;
- const std::vector<AnalysisID> &PreservedSet = AnUsage.getPreservedSet();
+ const AnalysisUsage::VectorType &PreservedSet = AnUsage.getPreservedSet();
for (std::vector<Pass *>::iterator I = HigherLevelAnalysis.begin(),
E = HigherLevelAnalysis.end(); I != E; ++I) {
Pass *P1 = *I;
@@ -606,10 +606,10 @@
#endif
AnalysisUsage AnUsage;
P->getAnalysisUsage(AnUsage);
- const std::vector<AnalysisID> &PreservedSet = AnUsage.getPreservedSet();
+ const AnalysisUsage::VectorType &PreservedSet = AnUsage.getPreservedSet();
// Verify preserved analysis
- for (std::vector<AnalysisID>::const_iterator I = PreservedSet.begin(),
+ for (AnalysisUsage::VectorType::const_iterator I = PreservedSet.begin(),
E = PreservedSet.end(); I != E; ++I) {
AnalysisID AID = *I;
if (Pass *AP = findAnalysisPass(AID, true))
@@ -664,7 +664,7 @@
if (AnUsage.getPreservesAll())
return;
- const std::vector<AnalysisID> &PreservedSet = AnUsage.getPreservedSet();
+ const AnalysisUsage::VectorType &PreservedSet = AnUsage.getPreservedSet();
for (std::map<AnalysisID, Pass*>::iterator I = AvailableAnalysis.begin(),
E = AvailableAnalysis.end(); I != E; ) {
std::map<AnalysisID, Pass*>::iterator Info = I++;
@@ -822,8 +822,8 @@
Pass *P) {
AnalysisUsage AnUsage;
P->getAnalysisUsage(AnUsage);
- const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet();
- for (std::vector<AnalysisID>::const_iterator
+ const AnalysisUsage::VectorType &RequiredSet = AnUsage.getRequiredSet();
+ for (AnalysisUsage::VectorType::const_iterator
I = RequiredSet.begin(), E = RequiredSet.end();
I != E; ++I) {
AnalysisID AID = *I;
@@ -833,8 +833,8 @@
RP_NotAvail.push_back(AID);
}
- const std::vector<AnalysisID> &IDs = AnUsage.getRequiredTransitiveSet();
- for (std::vector<AnalysisID>::const_iterator I = IDs.begin(),
+ const AnalysisUsage::VectorType &IDs = AnUsage.getRequiredTransitiveSet();
+ for (AnalysisUsage::VectorType::const_iterator I = IDs.begin(),
E = IDs.end(); I != E; ++I) {
AnalysisID AID = *I;
if (Pass *AnalysisPass = findAnalysisPass(*I, true))
@@ -853,7 +853,7 @@
AnalysisUsage AnUsage;
P->getAnalysisUsage(AnUsage);
- for (std::vector<const PassInfo *>::const_iterator
+ for (AnalysisUsage::VectorType::const_iterator
I = AnUsage.getRequiredSet().begin(),
E = AnUsage.getRequiredSet().end(); I != E; ++I) {
Pass *Impl = findAnalysisPass(*I, true);
@@ -955,7 +955,7 @@
}
void PMDataManager::dumpAnalysisSetInfo(const char *Msg, Pass *P,
- const std::vector<AnalysisID> &Set)
+ const AnalysisUsage::VectorType &Set)
const {
if (PassDebugging >= Details && !Set.empty()) {
cerr << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:";
More information about the llvm-commits
mailing list