Add a method useful for updating DSA
authorChris Lattner <sabre@nondot.org>
Thu, 19 Feb 2004 21:27:50 +0000 (21:27 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 19 Feb 2004 21:27:50 +0000 (21:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11636 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DSGraph.h
include/llvm/Analysis/DataStructure/DSGraph.h

index 1c108518489b445ddd4d7a64c58215ef157f5979..803c36f5d8848cde19cfd86f2c01527820c0decb 100644 (file)
@@ -54,6 +54,15 @@ public:
 
   void erase(Value *V) { erase(find(V)); }
 
+  /// replaceScalar - When an instruction needs to be modified, this method can
+  /// be used to update the scalar map to remove the old and insert the new.
+  void replaceScalar(Value *Old, Value *New) {
+    iterator I = find(Old);
+    assert(I != end() && "Old value is not in the map!");
+    ValueMap.insert(std::make_pair(New, I->second));
+    erase(I);
+  }
+
   DSNodeHandle &operator[](Value *V) {
     std::pair<iterator,bool> IP = 
       ValueMap.insert(std::make_pair(V, DSNodeHandle()));
index 1c108518489b445ddd4d7a64c58215ef157f5979..803c36f5d8848cde19cfd86f2c01527820c0decb 100644 (file)
@@ -54,6 +54,15 @@ public:
 
   void erase(Value *V) { erase(find(V)); }
 
+  /// replaceScalar - When an instruction needs to be modified, this method can
+  /// be used to update the scalar map to remove the old and insert the new.
+  void replaceScalar(Value *Old, Value *New) {
+    iterator I = find(Old);
+    assert(I != end() && "Old value is not in the map!");
+    ValueMap.insert(std::make_pair(New, I->second));
+    erase(I);
+  }
+
   DSNodeHandle &operator[](Value *V) {
     std::pair<iterator,bool> IP = 
       ValueMap.insert(std::make_pair(V, DSNodeHandle()));