summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DataStructure
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-22 00:09:45 +0000
committerChris Lattner <sabre@nondot.org>2005-03-22 00:09:45 +0000
commit410da35a1ff33974bba973d8f250b31e9787df16 (patch)
tree76a485369da90cd3fb75d78ac965038181a20e2e /llvm/lib/Analysis/DataStructure
parent7b5fe1bdb6b12eeb4e600d60451a268057db326c (diff)
downloadbcm5719-llvm-410da35a1ff33974bba973d8f250b31e9787df16.tar.gz
bcm5719-llvm-410da35a1ff33974bba973d8f250b31e9787df16.zip
move this out of line
llvm-svn: 20751
Diffstat (limited to 'llvm/lib/Analysis/DataStructure')
-rw-r--r--llvm/lib/Analysis/DataStructure/DataStructure.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
index eab91d238ff..e2edb1cb725 100644
--- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
@@ -76,6 +76,34 @@ DSNode *DSNodeHandle::HandleForwarding() const {
}
//===----------------------------------------------------------------------===//
+// 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
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud