aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/DataStructure/DSGraph.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-24 19:55:34 +0000
committerChris Lattner <sabre@nondot.org>2005-01-24 19:55:34 +0000
commitd5af7c4df6b9e18c017ab0138c02f687d5dc84a0 (patch)
treeb068d7492783630266c9c0d0a5f1486f13ec8709 /include/llvm/Analysis/DataStructure/DSGraph.h
parent2d6f022a9877bf08cad6f94d29c1c11596ec9499 (diff)
Add some methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19817 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/DataStructure/DSGraph.h')
-rw-r--r--include/llvm/Analysis/DataStructure/DSGraph.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h
index 5efdde9a69..bc5f8242c1 100644
--- a/include/llvm/Analysis/DataStructure/DSGraph.h
+++ b/include/llvm/Analysis/DataStructure/DSGraph.h
@@ -55,6 +55,11 @@ public:
void erase(Value *V) { erase(find(V)); }
+ void eraseIfExists(Value *V) {
+ iterator I = find(V);
+ if (I != end()) erase(I);
+ }
+
/// 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.
///
@@ -65,6 +70,14 @@ public:
erase(I);
}
+ /// copyScalarIfExists - If Old exists in the scalar map, make New point to
+ /// whatever Old did.
+ void copyScalarIfExists(Value *Old, Value *New) {
+ iterator I = find(Old);
+ if (I != end())
+ ValueMap.insert(std::make_pair(New, I->second));
+ }
+
DSNodeHandle &operator[](Value *V) {
std::pair<iterator,bool> IP =
ValueMap.insert(std::make_pair(V, DSNodeHandle()));