From d5af7c4df6b9e18c017ab0138c02f687d5dc84a0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 24 Jan 2005 19:55:34 +0000 Subject: [PATCH] Add some methods. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19817 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DataStructure/DSGraph.h | 13 +++++++++++++ include/llvm/Analysis/DataStructure/DataStructure.h | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h index 5efdde9a69c..bc5f8242c15 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 IP = ValueMap.insert(std::make_pair(V, DSNodeHandle())); diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index 627c7c4d7b4..eb0134d97fc 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -113,6 +113,11 @@ public: DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } + /// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. + /// These correspond to the interfaces defined in the AliasAnalysis class. + void deleteValue(Value *V); + void copyValue(Value *From, Value *To); + /// print - Print out the analysis results... /// void print(std::ostream &O, const Module *M) const; @@ -175,6 +180,11 @@ public: DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } + /// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. + /// These correspond to the interfaces defined in the AliasAnalysis class. + void deleteValue(Value *V); + void copyValue(Value *From, Value *To); + /// print - Print out the analysis results... /// void print(std::ostream &O, const Module *M) const; -- 2.34.1