mirror of
https://github.com/RPCS3/llvm.git
synced 2025-03-06 09:39:28 +00:00
Move usages of explicit hash_* datastructures to use typedefs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6996 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4f00818cd9
commit
8d32767da4
@ -736,7 +736,7 @@ void DSGraph::dump() const { print(std::cerr); }
|
|||||||
/// remapLinks - Change all of the Links in the current node according to the
|
/// remapLinks - Change all of the Links in the current node according to the
|
||||||
/// specified mapping.
|
/// specified mapping.
|
||||||
///
|
///
|
||||||
void DSNode::remapLinks(hash_map<const DSNode*, DSNodeHandle> &OldNodeMap) {
|
void DSNode::remapLinks(DSGraph::NodeMapTy &OldNodeMap) {
|
||||||
for (unsigned i = 0, e = Links.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Links.size(); i != e; ++i) {
|
||||||
DSNodeHandle &H = OldNodeMap[Links[i].getNode()];
|
DSNodeHandle &H = OldNodeMap[Links[i].getNode()];
|
||||||
Links[i].setNode(H.getNode());
|
Links[i].setNode(H.getNode());
|
||||||
@ -782,7 +782,7 @@ void DSGraph::cloneInto(const DSGraph &G, ScalarMapTy &OldValMap,
|
|||||||
Nodes[i]->remapLinks(OldNodeMap);
|
Nodes[i]->remapLinks(OldNodeMap);
|
||||||
|
|
||||||
// Copy the scalar map... merging all of the global nodes...
|
// Copy the scalar map... merging all of the global nodes...
|
||||||
for (hash_map<Value*, DSNodeHandle>::const_iterator I = G.ScalarMap.begin(),
|
for (ScalarMapTy::const_iterator I = G.ScalarMap.begin(),
|
||||||
E = G.ScalarMap.end(); I != E; ++I) {
|
E = G.ScalarMap.end(); I != E; ++I) {
|
||||||
DSNodeHandle &H = OldValMap[I->first];
|
DSNodeHandle &H = OldValMap[I->first];
|
||||||
DSNodeHandle &MappedNode = OldNodeMap[I->second.getNode()];
|
DSNodeHandle &MappedNode = OldNodeMap[I->second.getNode()];
|
||||||
@ -790,7 +790,7 @@ void DSGraph::cloneInto(const DSGraph &G, ScalarMapTy &OldValMap,
|
|||||||
H.setNode(MappedNode.getNode());
|
H.setNode(MappedNode.getNode());
|
||||||
|
|
||||||
if (isa<GlobalValue>(I->first)) { // Is this a global?
|
if (isa<GlobalValue>(I->first)) { // Is this a global?
|
||||||
hash_map<Value*, DSNodeHandle>::iterator GVI = ScalarMap.find(I->first);
|
ScalarMapTy::iterator GVI = ScalarMap.find(I->first);
|
||||||
if (GVI != ScalarMap.end()) // Is the global value in this fn already?
|
if (GVI != ScalarMap.end()) // Is the global value in this fn already?
|
||||||
GVI->second.mergeWith(H);
|
GVI->second.mergeWith(H);
|
||||||
else
|
else
|
||||||
@ -1176,8 +1176,7 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
|
|||||||
std::vector<std::pair<Value*, DSNode*> > GlobalNodes;
|
std::vector<std::pair<Value*, DSNode*> > GlobalNodes;
|
||||||
|
|
||||||
// Mark all nodes reachable by (non-global) scalar nodes as alive...
|
// Mark all nodes reachable by (non-global) scalar nodes as alive...
|
||||||
for (hash_map<Value*, DSNodeHandle>::iterator I = ScalarMap.begin(),
|
for (ScalarMapTy::iterator I = ScalarMap.begin(), E = ScalarMap.end(); I !=E;)
|
||||||
E = ScalarMap.end(); I != E; )
|
|
||||||
if (isa<GlobalValue>(I->first)) { // Keep track of global nodes
|
if (isa<GlobalValue>(I->first)) { // Keep track of global nodes
|
||||||
assert(I->second.getNode() && "Null global node?");
|
assert(I->second.getNode() && "Null global node?");
|
||||||
GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode()));
|
GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode()));
|
||||||
@ -1292,7 +1291,7 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
|
|||||||
//
|
//
|
||||||
for (unsigned i = 0, e = GlobalNodes.size(); i != e; ++i) {
|
for (unsigned i = 0, e = GlobalNodes.size(); i != e; ++i) {
|
||||||
Value *G = GlobalNodes[i].first;
|
Value *G = GlobalNodes[i].first;
|
||||||
hash_map<Value*, DSNodeHandle>::iterator I = ScalarMap.find(G);
|
ScalarMapTy::iterator I = ScalarMap.find(G);
|
||||||
assert(I != ScalarMap.end() && "Global not in scalar map anymore?");
|
assert(I != ScalarMap.end() && "Global not in scalar map anymore?");
|
||||||
assert(I->second.getNode() && "Global not pointing to anything?");
|
assert(I->second.getNode() && "Global not pointing to anything?");
|
||||||
assert(!Alive.count(I->second.getNode()) && "Node is alive??");
|
assert(!Alive.count(I->second.getNode()) && "Node is alive??");
|
||||||
@ -1325,7 +1324,7 @@ void DSGraph::AssertGraphOK() const {
|
|||||||
for (unsigned i = 0, e = Nodes.size(); i != e; ++i)
|
for (unsigned i = 0, e = Nodes.size(); i != e; ++i)
|
||||||
Nodes[i]->assertOK();
|
Nodes[i]->assertOK();
|
||||||
return; // FIXME: remove
|
return; // FIXME: remove
|
||||||
for (hash_map<Value*, DSNodeHandle>::const_iterator I = ScalarMap.begin(),
|
for (ScalarMapTy::const_iterator I = ScalarMap.begin(),
|
||||||
E = ScalarMap.end(); I != E; ++I) {
|
E = ScalarMap.end(); I != E; ++I) {
|
||||||
assert(I->second.getNode() && "Null node in scalarmap!");
|
assert(I->second.getNode() && "Null node in scalarmap!");
|
||||||
AssertNodeInGraph(I->second.getNode());
|
AssertNodeInGraph(I->second.getNode());
|
||||||
|
@ -149,10 +149,9 @@ DSGraph::DSGraph(Function &F, DSGraph *GG) : GlobalsGraph(GG) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Remove all integral constants from the scalarmap!
|
// Remove all integral constants from the scalarmap!
|
||||||
for (hash_map<Value*, DSNodeHandle>::iterator I = ScalarMap.begin();
|
for (ScalarMapTy::iterator I = ScalarMap.begin(); I != ScalarMap.end();)
|
||||||
I != ScalarMap.end();)
|
|
||||||
if (isa<ConstantIntegral>(I->first)) {
|
if (isa<ConstantIntegral>(I->first)) {
|
||||||
hash_map<Value*, DSNodeHandle>::iterator J = I++;
|
ScalarMapTy::iterator J = I++;
|
||||||
ScalarMap.erase(J);
|
ScalarMap.erase(J);
|
||||||
} else
|
} else
|
||||||
++I;
|
++I;
|
||||||
@ -190,7 +189,7 @@ DSNodeHandle GraphBuilder::getValueDest(Value &Val) {
|
|||||||
NH = getValueDest(*CE->getOperand(0));
|
NH = getValueDest(*CE->getOperand(0));
|
||||||
else if (CE->getOpcode() == Instruction::GetElementPtr) {
|
else if (CE->getOpcode() == Instruction::GetElementPtr) {
|
||||||
visitGetElementPtrInst(*CE);
|
visitGetElementPtrInst(*CE);
|
||||||
hash_map<Value*, DSNodeHandle>::iterator I = ScalarMap.find(CE);
|
DSGraph::ScalarMapTy::iterator I = ScalarMap.find(CE);
|
||||||
assert(I != ScalarMap.end() && "GEP didn't get processed right?");
|
assert(I != ScalarMap.end() && "GEP didn't get processed right?");
|
||||||
NH = I->second;
|
NH = I->second;
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,7 +77,7 @@ namespace {
|
|||||||
void Steens::ResolveFunctionCall(Function *F, const DSCallSite &Call,
|
void Steens::ResolveFunctionCall(Function *F, const DSCallSite &Call,
|
||||||
DSNodeHandle &RetVal) {
|
DSNodeHandle &RetVal) {
|
||||||
assert(ResultGraph != 0 && "Result graph not allocated!");
|
assert(ResultGraph != 0 && "Result graph not allocated!");
|
||||||
hash_map<Value*, DSNodeHandle> &ValMap = ResultGraph->getScalarMap();
|
DSGraph::ScalarMapTy &ValMap = ResultGraph->getScalarMap();
|
||||||
|
|
||||||
// Handle the return value of the function...
|
// Handle the return value of the function...
|
||||||
if (Call.getRetVal().getNode() && RetVal.getNode())
|
if (Call.getRetVal().getNode() && RetVal.getNode())
|
||||||
@ -87,7 +87,7 @@ void Steens::ResolveFunctionCall(Function *F, const DSCallSite &Call,
|
|||||||
unsigned PtrArgIdx = 0;
|
unsigned PtrArgIdx = 0;
|
||||||
for (Function::aiterator AI = F->abegin(), AE = F->aend();
|
for (Function::aiterator AI = F->abegin(), AE = F->aend();
|
||||||
AI != AE && PtrArgIdx < Call.getNumPtrArgs(); ++AI) {
|
AI != AE && PtrArgIdx < Call.getNumPtrArgs(); ++AI) {
|
||||||
hash_map<Value*, DSNodeHandle>::iterator I = ValMap.find(AI);
|
DSGraph::ScalarMapTy::iterator I = ValMap.find(AI);
|
||||||
if (I != ValMap.end()) // If its a pointer argument...
|
if (I != ValMap.end()) // If its a pointer argument...
|
||||||
I->second.mergeWith(Call.getPtrArg(PtrArgIdx++));
|
I->second.mergeWith(Call.getPtrArg(PtrArgIdx++));
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ bool Steens::run(Module &M) {
|
|||||||
// Incorporate the inlined Function's ScalarMap into the global
|
// Incorporate the inlined Function's ScalarMap into the global
|
||||||
// ScalarMap...
|
// ScalarMap...
|
||||||
DSGraph::ScalarMapTy &GVM = ResultGraph->getScalarMap();
|
DSGraph::ScalarMapTy &GVM = ResultGraph->getScalarMap();
|
||||||
for (hash_map<Value*, DSNodeHandle>::iterator I = ValMap.begin(),
|
for (DSGraph::ScalarMapTy::iterator I = ValMap.begin(),
|
||||||
E = ValMap.end(); I != E; ++I)
|
E = ValMap.end(); I != E; ++I)
|
||||||
GVM[I->first].mergeWith(I->second);
|
GVM[I->first].mergeWith(I->second);
|
||||||
|
|
||||||
@ -202,12 +202,12 @@ AliasAnalysis::AliasResult Steens::alias(const Value *V1, unsigned V1Size,
|
|||||||
// FIXME: HANDLE Size argument!
|
// FIXME: HANDLE Size argument!
|
||||||
assert(ResultGraph && "Result graph has not been computed yet!");
|
assert(ResultGraph && "Result graph has not been computed yet!");
|
||||||
|
|
||||||
hash_map<Value*, DSNodeHandle> &GSM = ResultGraph->getScalarMap();
|
DSGraph::ScalarMapTy &GSM = ResultGraph->getScalarMap();
|
||||||
|
|
||||||
hash_map<Value*, DSNodeHandle>::iterator I = GSM.find(const_cast<Value*>(V1));
|
DSGraph::ScalarMapTy::iterator I = GSM.find(const_cast<Value*>(V1));
|
||||||
if (I != GSM.end() && I->second.getNode()) {
|
if (I != GSM.end() && I->second.getNode()) {
|
||||||
DSNodeHandle &V1H = I->second;
|
DSNodeHandle &V1H = I->second;
|
||||||
hash_map<Value*, DSNodeHandle>::iterator J=GSM.find(const_cast<Value*>(V2));
|
DSGraph::ScalarMapTy::iterator J=GSM.find(const_cast<Value*>(V2));
|
||||||
if (J != GSM.end() && J->second.getNode()) {
|
if (J != GSM.end() && J->second.getNode()) {
|
||||||
DSNodeHandle &V2H = J->second;
|
DSNodeHandle &V2H = J->second;
|
||||||
// If the two pointers point to different data structure graph nodes, they
|
// If the two pointers point to different data structure graph nodes, they
|
||||||
|
Loading…
x
Reference in New Issue
Block a user