mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
SCC: Change clients to use const, NFC
It's fishy to be changing the `std::vector<>` owned by the iterator, and no one actual does it, so I'm going to remove the ability in a subsequent commit. First, update the users. <rdar://problem/14292693> llvm-svn: 207252
This commit is contained in:
parent
a904a21581
commit
ea68e6a3d5
@ -435,8 +435,8 @@ bool CGPassManager::runOnModule(Module &M) {
|
|||||||
while (!CGI.isAtEnd()) {
|
while (!CGI.isAtEnd()) {
|
||||||
// Copy the current SCC and increment past it so that the pass can hack
|
// Copy the current SCC and increment past it so that the pass can hack
|
||||||
// on the SCC if it wants to without invalidating our iterator.
|
// on the SCC if it wants to without invalidating our iterator.
|
||||||
std::vector<CallGraphNode*> &NodeVec = *CGI;
|
const std::vector<CallGraphNode *> &NodeVec = *CGI;
|
||||||
CurSCC.initialize(&NodeVec[0], &NodeVec[0]+NodeVec.size());
|
CurSCC.initialize(NodeVec.data(), NodeVec.data() + NodeVec.size());
|
||||||
++CGI;
|
++CGI;
|
||||||
|
|
||||||
// At the top level, we run all the passes in this pass manager on the
|
// At the top level, we run all the passes in this pass manager on the
|
||||||
|
@ -359,7 +359,7 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {
|
|||||||
// We do a bottom-up SCC traversal of the call graph. In other words, we
|
// We do a bottom-up SCC traversal of the call graph. In other words, we
|
||||||
// visit all callees before callers (leaf-first).
|
// visit all callees before callers (leaf-first).
|
||||||
for (scc_iterator<CallGraph*> I = scc_begin(&CG); !I.isAtEnd(); ++I) {
|
for (scc_iterator<CallGraph*> I = scc_begin(&CG); !I.isAtEnd(); ++I) {
|
||||||
std::vector<CallGraphNode *> &SCC = *I;
|
const std::vector<CallGraphNode *> &SCC = *I;
|
||||||
assert(!SCC.empty() && "SCC with no functions?");
|
assert(!SCC.empty() && "SCC with no functions?");
|
||||||
|
|
||||||
if (!SCC[0]->getFunction()) {
|
if (!SCC[0]->getFunction()) {
|
||||||
|
@ -933,7 +933,7 @@ void AMDGPUCFGStructurizer::orderBlocks(MachineFunction *MF) {
|
|||||||
MachineBasicBlock *MBB;
|
MachineBasicBlock *MBB;
|
||||||
for (scc_iterator<MachineFunction *> It = scc_begin(MF); !It.isAtEnd();
|
for (scc_iterator<MachineFunction *> It = scc_begin(MF); !It.isAtEnd();
|
||||||
++It, ++SccNum) {
|
++It, ++SccNum) {
|
||||||
std::vector<MachineBasicBlock *> &SccNext = *It;
|
const std::vector<MachineBasicBlock *> &SccNext = *It;
|
||||||
for (std::vector<MachineBasicBlock *>::const_iterator
|
for (std::vector<MachineBasicBlock *>::const_iterator
|
||||||
blockIter = SccNext.begin(), blockEnd = SccNext.end();
|
blockIter = SccNext.begin(), blockEnd = SccNext.end();
|
||||||
blockIter != blockEnd; ++blockIter) {
|
blockIter != blockEnd; ++blockIter) {
|
||||||
|
@ -601,7 +601,7 @@ bool FunctionAttrs::AddArgumentAttrs(const CallGraphSCC &SCC) {
|
|||||||
// captures.
|
// captures.
|
||||||
|
|
||||||
for (scc_iterator<ArgumentGraph*> I = scc_begin(&AG); !I.isAtEnd(); ++I) {
|
for (scc_iterator<ArgumentGraph*> I = scc_begin(&AG); !I.isAtEnd(); ++I) {
|
||||||
std::vector<ArgumentGraphNode*> &ArgumentSCC = *I;
|
const std::vector<ArgumentGraphNode *> &ArgumentSCC = *I;
|
||||||
if (ArgumentSCC.size() == 1) {
|
if (ArgumentSCC.size() == 1) {
|
||||||
if (!ArgumentSCC[0]->Definition) continue; // synthetic root node
|
if (!ArgumentSCC[0]->Definition) continue; // synthetic root node
|
||||||
|
|
||||||
@ -617,8 +617,8 @@ bool FunctionAttrs::AddArgumentAttrs(const CallGraphSCC &SCC) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SCCCaptured = false;
|
bool SCCCaptured = false;
|
||||||
for (std::vector<ArgumentGraphNode*>::iterator I = ArgumentSCC.begin(),
|
for (auto I = ArgumentSCC.begin(), E = ArgumentSCC.end();
|
||||||
E = ArgumentSCC.end(); I != E && !SCCCaptured; ++I) {
|
I != E && !SCCCaptured; ++I) {
|
||||||
ArgumentGraphNode *Node = *I;
|
ArgumentGraphNode *Node = *I;
|
||||||
if (Node->Uses.empty()) {
|
if (Node->Uses.empty()) {
|
||||||
if (!Node->Definition->hasNoCaptureAttr())
|
if (!Node->Definition->hasNoCaptureAttr())
|
||||||
@ -630,13 +630,12 @@ bool FunctionAttrs::AddArgumentAttrs(const CallGraphSCC &SCC) {
|
|||||||
SmallPtrSet<Argument*, 8> ArgumentSCCNodes;
|
SmallPtrSet<Argument*, 8> ArgumentSCCNodes;
|
||||||
// Fill ArgumentSCCNodes with the elements of the ArgumentSCC. Used for
|
// Fill ArgumentSCCNodes with the elements of the ArgumentSCC. Used for
|
||||||
// quickly looking up whether a given Argument is in this ArgumentSCC.
|
// quickly looking up whether a given Argument is in this ArgumentSCC.
|
||||||
for (std::vector<ArgumentGraphNode*>::iterator I = ArgumentSCC.begin(),
|
for (auto I = ArgumentSCC.begin(), E = ArgumentSCC.end(); I != E; ++I) {
|
||||||
E = ArgumentSCC.end(); I != E; ++I) {
|
|
||||||
ArgumentSCCNodes.insert((*I)->Definition);
|
ArgumentSCCNodes.insert((*I)->Definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<ArgumentGraphNode*>::iterator I = ArgumentSCC.begin(),
|
for (auto I = ArgumentSCC.begin(), E = ArgumentSCC.end();
|
||||||
E = ArgumentSCC.end(); I != E && !SCCCaptured; ++I) {
|
I != E && !SCCCaptured; ++I) {
|
||||||
ArgumentGraphNode *N = *I;
|
ArgumentGraphNode *N = *I;
|
||||||
for (SmallVectorImpl<ArgumentGraphNode*>::iterator UI = N->Uses.begin(),
|
for (SmallVectorImpl<ArgumentGraphNode*>::iterator UI = N->Uses.begin(),
|
||||||
UE = N->Uses.end(); UI != UE; ++UI) {
|
UE = N->Uses.end(); UI != UE; ++UI) {
|
||||||
|
@ -280,7 +280,7 @@ bool StructurizeCFG::doInitialization(Region *R, RGPassManager &RGM) {
|
|||||||
void StructurizeCFG::orderNodes() {
|
void StructurizeCFG::orderNodes() {
|
||||||
scc_iterator<Region *> I = scc_begin(ParentRegion);
|
scc_iterator<Region *> I = scc_begin(ParentRegion);
|
||||||
for (Order.clear(); !I.isAtEnd(); ++I) {
|
for (Order.clear(); !I.isAtEnd(); ++I) {
|
||||||
std::vector<RegionNode *> &Nodes = *I;
|
const std::vector<RegionNode *> &Nodes = *I;
|
||||||
Order.append(Nodes.begin(), Nodes.end());
|
Order.append(Nodes.begin(), Nodes.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ bool CFGSCC::runOnFunction(Function &F) {
|
|||||||
unsigned sccNum = 0;
|
unsigned sccNum = 0;
|
||||||
errs() << "SCCs for Function " << F.getName() << " in PostOrder:";
|
errs() << "SCCs for Function " << F.getName() << " in PostOrder:";
|
||||||
for (scc_iterator<Function*> SCCI = scc_begin(&F); !SCCI.isAtEnd(); ++SCCI) {
|
for (scc_iterator<Function*> SCCI = scc_begin(&F); !SCCI.isAtEnd(); ++SCCI) {
|
||||||
std::vector<BasicBlock*> &nextSCC = *SCCI;
|
const std::vector<BasicBlock *> &nextSCC = *SCCI;
|
||||||
errs() << "\nSCC #" << ++sccNum << " : ";
|
errs() << "\nSCC #" << ++sccNum << " : ";
|
||||||
for (std::vector<BasicBlock*>::const_iterator I = nextSCC.begin(),
|
for (std::vector<BasicBlock*>::const_iterator I = nextSCC.begin(),
|
||||||
E = nextSCC.end(); I != E; ++I)
|
E = nextSCC.end(); I != E; ++I)
|
||||||
|
@ -277,7 +277,7 @@ TEST(SCCIteratorTest, AllSmallGraphs) {
|
|||||||
GT::NodeSubset NodesInSomeSCC;
|
GT::NodeSubset NodesInSomeSCC;
|
||||||
|
|
||||||
for (scc_iterator<GT> I = scc_begin(G), E = scc_end(G); I != E; ++I) {
|
for (scc_iterator<GT> I = scc_begin(G), E = scc_end(G); I != E; ++I) {
|
||||||
std::vector<GT::NodeType*> &SCC = *I;
|
const std::vector<GT::NodeType *> &SCC = *I;
|
||||||
|
|
||||||
// Get the nodes in this SCC as a NodeSubset rather than a vector.
|
// Get the nodes in this SCC as a NodeSubset rather than a vector.
|
||||||
GT::NodeSubset NodesInThisSCC;
|
GT::NodeSubset NodesInThisSCC;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user