diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-19 21:27:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-19 21:27:50 +0000 |
commit | bbdfe40ba747de4c642aaf9e91270482311a426f (patch) | |
tree | 252bfa9364bebf55845a68e1d7a8d65102834734 /include/llvm/Analysis/DataStructure/DSGraph.h | |
parent | 6559615fc4b5215194335d434e211ff4a1efbc55 (diff) |
Add a method useful for updating DSA
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/DataStructure/DSGraph.h')
-rw-r--r-- | include/llvm/Analysis/DataStructure/DSGraph.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h index 1c10851848..803c36f5d8 100644 --- a/include/llvm/Analysis/DataStructure/DSGraph.h +++ b/include/llvm/Analysis/DataStructure/DSGraph.h @@ -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())); |