[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Mar 21 16:09:58 PST 2005
Changes in directory llvm/lib/Analysis/DataStructure:
DataStructure.cpp updated: 1.219 -> 1.220
---
Log message:
move this out of line
---
Diffs of the changes: (+28 -0)
DataStructure.cpp | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+)
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.219 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.220
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.219 Mon Mar 21 16:49:53 2005
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Mar 21 18:09:45 2005
@@ -76,6 +76,34 @@
}
//===----------------------------------------------------------------------===//
+// DSScalarMap Implementation
+//===----------------------------------------------------------------------===//
+
+DSNodeHandle &DSScalarMap::AddGlobal(GlobalValue *GV) {
+ assert(ValueMap.count(GV) == 0 && "GV already exists!");
+
+ // If the node doesn't exist, check to see if it's a global that is
+ // equated to another global in the program.
+ EquivalenceClasses<GlobalValue*>::iterator ECI = GlobalECs.findValue(GV);
+ if (ECI != GlobalECs.end()) {
+ GlobalValue *Leader = *GlobalECs.findLeader(ECI);
+ if (Leader != GV) {
+ GV = Leader;
+ iterator I = ValueMap.find(GV);
+ if (I != ValueMap.end())
+ return I->second;
+ }
+ }
+
+ // Okay, this is either not an equivalenced global or it is the leader, it
+ // will be inserted into the scalar map now.
+ GlobalSet.insert(GV);
+
+ return ValueMap.insert(std::make_pair(GV, DSNodeHandle())).first->second;
+}
+
+
+//===----------------------------------------------------------------------===//
// DSNode Implementation
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list