mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
Speed up the passmgr by avoiding heap thrashing on vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54515 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f131fa26e6
commit
fc65d38085
@ -20,6 +20,7 @@
|
||||
#define LLVM_PASS_ANALYSIS_SUPPORT_H
|
||||
|
||||
#include <vector>
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -34,9 +35,14 @@ namespace llvm {
|
||||
// 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 @@ public:
|
||||
///
|
||||
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; }
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -309,7 +309,7 @@ public:
|
||||
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();
|
||||
|
@ -294,8 +294,9 @@ void PassRegistrationListener::enumeratePasses() {
|
||||
|
||||
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())
|
||||
|
@ -441,8 +441,8 @@ void PMTopLevelManager::schedulePass(Pass *P) {
|
||||
|
||||
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 @@ bool PMDataManager::preserveHigherLevelAnalysis(Pass *P) {
|
||||
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 @@ void PMDataManager::verifyPreservedAnalysis(Pass *P) {
|
||||
#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 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) {
|
||||
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 @@ void PMDataManager::collectRequiredAnalysis(SmallVector<Pass *, 8>&RP,
|
||||
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 @@ void PMDataManager::collectRequiredAnalysis(SmallVector<Pass *, 8>&RP,
|
||||
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 @@ void PMDataManager::initializeAnalysisImpl(Pass *P) {
|
||||
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::dumpPassInfo(Pass *P, enum PassDebuggingString S1,
|
||||
}
|
||||
|
||||
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:";
|
||||
|
Loading…
x
Reference in New Issue
Block a user