aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Analysis/DSGraph.h7
-rw-r--r--include/llvm/Analysis/DataStructure/DSGraph.h7
2 files changed, 14 insertions, 0 deletions
diff --git a/include/llvm/Analysis/DSGraph.h b/include/llvm/Analysis/DSGraph.h
index 3891c0e70d..a2687438ce 100644
--- a/include/llvm/Analysis/DSGraph.h
+++ b/include/llvm/Analysis/DSGraph.h
@@ -76,6 +76,13 @@ public:
///
DSNodeHandle &getNodeForValue(Value *V) { return ScalarMap[V]; }
+ const DSNodeHandle &getNodeForValue(Value *V) const {
+ std::map<Value*, DSNodeHandle>::const_iterator I = ScalarMap.find(V);
+ assert(I != ScalarMap.end() &&
+ "Use non-const lookup function if node may not be in the map");
+ return I->second;
+ }
+
const DSNodeHandle &getRetNode() const { return RetNode; }
DSNodeHandle &getRetNode() { return RetNode; }
diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h
index 3891c0e70d..a2687438ce 100644
--- a/include/llvm/Analysis/DataStructure/DSGraph.h
+++ b/include/llvm/Analysis/DataStructure/DSGraph.h
@@ -76,6 +76,13 @@ public:
///
DSNodeHandle &getNodeForValue(Value *V) { return ScalarMap[V]; }
+ const DSNodeHandle &getNodeForValue(Value *V) const {
+ std::map<Value*, DSNodeHandle>::const_iterator I = ScalarMap.find(V);
+ assert(I != ScalarMap.end() &&
+ "Use non-const lookup function if node may not be in the map");
+ return I->second;
+ }
+
const DSNodeHandle &getRetNode() const { return RetNode; }
DSNodeHandle &getRetNode() { return RetNode; }