From 0b914eea5f7f47f299477fff50c8a07d841819d7 Mon Sep 17 00:00:00 2001
From: Maria Kotsifakou <kotsifa2@illinois.edu>
Date: Tue, 8 Jul 2014 20:06:03 +0000
Subject: [PATCH] Added functionality to BuildDFG Pass. (functions required to
 access the DFGraph for other passes)

---
 llvm/include/llvm/BuildDFG/BuildDFG.h     |  9 +++++++--
 llvm/lib/Transforms/BuildDFG/BuildDFG.cpp | 11 +++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/llvm/include/llvm/BuildDFG/BuildDFG.h b/llvm/include/llvm/BuildDFG/BuildDFG.h
index 9bbd30f0b6..b5b70bdbc5 100644
--- a/llvm/include/llvm/BuildDFG/BuildDFG.h
+++ b/llvm/include/llvm/BuildDFG/BuildDFG.h
@@ -24,11 +24,12 @@ namespace builddfg {
     static char ID; // Pass identification, replacement for typeid
     BuildDFG() : ModulePass(ID) {}
 
+    typedef ValueMap<Value*, DFNode*> HandleToDFNode;
+    typedef ValueMap<Value*, DFEdge*> HandleToDFEdge;
+
     private:
     // Member variables
     DFInternalNode *Root;
-    typedef ValueMap<Value*, DFNode*> HandleToDFNode;
-    typedef ValueMap<Value*, DFEdge*> HandleToDFEdge;
 
     HandleToDFNode HandleToDFNodeMap;   // This map associates the i8* pointer
                                         // with the DFNode structure that it
@@ -49,6 +50,10 @@ namespace builddfg {
     public:
     virtual bool runOnModule(Module &M);
 
+    const DFInternalNode *getRoot();
+    const HandleToDFNode &getHandleToDFNodeMap();
+    const HandleToDFEdge &getHandleToDFEdgeMap();
+
   };
 
 } // End of namespace
diff --git a/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp b/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
index 76f0e905bc..10acd26998 100644
--- a/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
+++ b/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
@@ -71,6 +71,17 @@ namespace builddfg {
     return false; //TODO: What does returning "false" mean?
   }
 
+  const DFInternalNode *BuildDFG::getRoot() {
+    return Root;
+  }
+
+  const BuildDFG::HandleToDFNode &BuildDFG::getHandleToDFNodeMap() {
+    return HandleToDFNodeMap;
+  }
+
+  const BuildDFG::HandleToDFEdge &BuildDFG::getHandleToDFEdgeMap() {
+    return HandleToDFEdgeMap;
+  }
 
   // Returns true if instruction I is a visc launch intrinsic, false otherwise
   bool BuildDFG::isViscLaunchIntrinsic(Instruction* I) {
-- 
GitLab