From: Chris Lattner Date: Thu, 19 Feb 2004 21:27:50 +0000 (+0000) Subject: Add a method useful for updating DSA X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bbdfe40ba747de4c642aaf9e91270482311a426f;p=oota-llvm.git Add a method useful for updating DSA git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11636 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/DSGraph.h b/include/llvm/Analysis/DSGraph.h index 1c108518489..803c36f5d88 100644 --- a/include/llvm/Analysis/DSGraph.h +++ b/include/llvm/Analysis/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 IP = ValueMap.insert(std::make_pair(V, DSNodeHandle())); diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h index 1c108518489..803c36f5d88 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 IP = ValueMap.insert(std::make_pair(V, DSNodeHandle()));