mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
The PhiNodes 2D vector is only used during PHI node placement. It doesn't
need to be an instance variable! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8860 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9e38fbf57f
commit
036f1e7478
@ -62,10 +62,6 @@ namespace {
|
|||||||
// VersionNumbers - Current version counters for each alloca
|
// VersionNumbers - Current version counters for each alloca
|
||||||
std::vector<unsigned> VersionNumbers;
|
std::vector<unsigned> VersionNumbers;
|
||||||
|
|
||||||
// PhiNodes - Each alloca contains a list of basic blocks which contain PHI
|
|
||||||
// nodes for the alloca.
|
|
||||||
std::vector<std::vector<BasicBlock*> > PhiNodes;
|
|
||||||
|
|
||||||
// NewPhiNodes - The PhiNodes we're adding.
|
// NewPhiNodes - The PhiNodes we're adding.
|
||||||
std::map<BasicBlock*, std::vector<PHINode*> > NewPhiNodes;
|
std::map<BasicBlock*, std::vector<PHINode*> > NewPhiNodes;
|
||||||
|
|
||||||
@ -90,7 +86,6 @@ void PromoteMem2Reg::run() {
|
|||||||
Function &F = *DF.getRoot()->getParent();
|
Function &F = *DF.getRoot()->getParent();
|
||||||
|
|
||||||
VersionNumbers.resize(Allocas.size());
|
VersionNumbers.resize(Allocas.size());
|
||||||
PhiNodes.resize(Allocas.size());
|
|
||||||
|
|
||||||
for (unsigned i = 0; i != Allocas.size(); ++i) {
|
for (unsigned i = 0; i != Allocas.size(); ++i) {
|
||||||
AllocaInst *AI = Allocas[i];
|
AllocaInst *AI = Allocas[i];
|
||||||
@ -110,6 +105,10 @@ void PromoteMem2Reg::run() {
|
|||||||
|
|
||||||
AllocaLookup[Allocas[i]] = i;
|
AllocaLookup[Allocas[i]] = i;
|
||||||
|
|
||||||
|
// PhiNodeBlocks - A list of blocks that phi nodes have been inserted for
|
||||||
|
// this alloca.
|
||||||
|
std::vector<BasicBlock*> PhiNodeBlocks;
|
||||||
|
|
||||||
// Compute the locations where PhiNodes need to be inserted. Look at the
|
// Compute the locations where PhiNodes need to be inserted. Look at the
|
||||||
// dominance frontier of EACH basic-block we have a write in.
|
// dominance frontier of EACH basic-block we have a write in.
|
||||||
//
|
//
|
||||||
@ -120,19 +119,20 @@ void PromoteMem2Reg::run() {
|
|||||||
const DominanceFrontier::DomSetType &S = it->second;
|
const DominanceFrontier::DomSetType &S = it->second;
|
||||||
for (DominanceFrontier::DomSetType::iterator P = S.begin(),PE = S.end();
|
for (DominanceFrontier::DomSetType::iterator P = S.begin(),PE = S.end();
|
||||||
P != PE; ++P)
|
P != PE; ++P)
|
||||||
QueuePhiNode(*P, i);
|
if (QueuePhiNode(*P, i))
|
||||||
|
PhiNodeBlocks.push_back(*P);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform iterative step
|
// Perform iterative step
|
||||||
std::vector<BasicBlock*> &AllocaPhiNodes = PhiNodes[i];
|
for (unsigned k = 0; k != PhiNodeBlocks.size(); k++) {
|
||||||
for (unsigned k = 0; k != AllocaPhiNodes.size(); k++) {
|
DominanceFrontier::const_iterator it = DF.find(PhiNodeBlocks[k]);
|
||||||
DominanceFrontier::const_iterator it = DF.find(AllocaPhiNodes[k]);
|
|
||||||
if (it != DF.end()) {
|
if (it != DF.end()) {
|
||||||
const DominanceFrontier::DomSetType &S = it->second;
|
const DominanceFrontier::DomSetType &S = it->second;
|
||||||
for (DominanceFrontier::DomSetType::iterator
|
for (DominanceFrontier::DomSetType::iterator
|
||||||
P = S.begin(), PE = S.end(); P != PE; ++P)
|
P = S.begin(), PE = S.end(); P != PE; ++P)
|
||||||
QueuePhiNode(*P, i);
|
if (QueuePhiNode(*P, i))
|
||||||
|
PhiNodeBlocks.push_back(*P);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,7 +198,6 @@ bool PromoteMem2Reg::QueuePhiNode(BasicBlock *BB, unsigned AllocaNo) {
|
|||||||
PN->addIncoming(NullVal, Preds[i]);
|
PN->addIncoming(NullVal, Preds[i]);
|
||||||
|
|
||||||
BBPNs[AllocaNo] = PN;
|
BBPNs[AllocaNo] = PN;
|
||||||
PhiNodes[AllocaNo].push_back(BB);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user