diff --git a/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp b/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
index c236e5094d592b40e723898dc7b1e19be4fc3627..827fb383e7350a8522cf3fe9b27d288aba7c596b 100644
--- a/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
+++ b/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
@@ -23,48 +23,50 @@ namespace builddfg {
 
 bool BuildDFG::runOnModule(Module &M) {
 
-  errs() << "-------- Searching for launch site ----------\n";
+  errs() << "-------- Searching for launch sites ----------\n";
 
-  bool foundLaunchSite = false;
   IntrinsicInst* II;
 
   // Iterate over all functions in the module
-  for (Module::iterator mi = M.begin(),
-       me = M.end(); (mi != me) && (!foundLaunchSite); ++mi) {
+  for (Module::iterator mi = M.begin(), me = M.end(); mi != me; ++mi) {
     Function* f = &*mi;
     errs() << "Function: " << f->getName() << "\n";
 
-    for (inst_iterator i = inst_begin(f), e = inst_end(f);
-         (i != e) && (!foundLaunchSite); ++i) {
+    for (inst_iterator i = inst_begin(f), e = inst_end(f); i != e ; ++i) {
       Instruction* I = &*i; // Grab pointer to Instruction
       if (isViscLaunchIntrinsic(I)) {
         errs() << "------------ Found launch site --------------\n";
-        foundLaunchSite = true;
         II = cast<IntrinsicInst>(I);
-      }
-    }
-  }
 
-  assert(foundLaunchSite && "Launch site not found!");
+        assert(II && "Launch intrinsic not recognized.");
 
-  // Intrinsic Instruction has been initialized from this point on.
+        // Intrinsic Instruction has been initialized from this point on.
 
-  Function* F = cast<Function>((II->getOperand(0))->stripPointerCasts());
-  Root = DFInternalNode::Create(II, F);
-  BuildGraph(Root, F);
+        Function* F = cast<Function>((II->getOperand(0))->stripPointerCasts());
+        Root = DFInternalNode::Create(II, F);
+        Roots.push_back(Root);
+        BuildGraph(Root, F);
 
-  for(DFGraph::children_iterator i = Root->getChildGraph()->begin(),
-      e = Root->getChildGraph()->end(); i!=e; i++) {
-    DFNode* N = *i;
-    errs() << "\t" << N->getFuncPointer()->getName() << "\n";
-  }
-  Root->getChildGraph()->sortChildren();
-  for(DFGraph::children_iterator i = Root->getChildGraph()->begin(),
-      e = Root->getChildGraph()->end(); i!=e; i++) {
-    DFNode* N = *i;
-    errs() << "\t" << N->getFuncPointer()->getName() << "\n";
+        for(DFGraph::children_iterator i = Root->getChildGraph()->begin(),
+            e = Root->getChildGraph()->end(); i!=e; i++) {
+          DFNode* N = *i;
+          errs() << "\t" << N->getFuncPointer()->getName() << "\n";
+        }
+        Root->getChildGraph()->sortChildren();
+        for(DFGraph::children_iterator i = Root->getChildGraph()->begin(),
+            e = Root->getChildGraph()->end(); i!=e; i++) {
+          DFNode* N = *i;
+          errs() << "\t" << N->getFuncPointer()->getName() << "\n";
+        }
+        viewDFGraph(Root->getChildGraph());
+
+      }
+    }
   }
-  viewDFGraph(Root->getChildGraph());
+
+  // Checking that we found at least one launch site
+  assert((Roots.size() != 0) && "Launch site not found.");
+
   return false; //TODO: What does returning "false" mean?
 }
 
@@ -72,6 +74,10 @@ DFInternalNode *BuildDFG::getRoot() const {
   return Root;
 }
 
+std::vector<DFInternalNode*> &BuildDFG::getRoots() {
+  return Roots;
+}
+
 //TODO: Maybe make this const
 BuildDFG::HandleToDFNode &BuildDFG::getHandleToDFNodeMap() {
   return HandleToDFNodeMap;
diff --git a/llvm/lib/Transforms/ClearDFG/ClearDFG.cpp b/llvm/lib/Transforms/ClearDFG/ClearDFG.cpp
index 4b392b2c966d802664598c3f2d09331910d6e555..6a410d31aee30e969f69b4e2bf4e694cd323335e 100644
--- a/llvm/lib/Transforms/ClearDFG/ClearDFG.cpp
+++ b/llvm/lib/Transforms/ClearDFG/ClearDFG.cpp
@@ -92,7 +92,8 @@ bool ClearDFG::runOnModule(Module &M) {
   // - Maps from i8* hansles to DFNode and DFEdge
   BuildDFG &DFG = getAnalysis<BuildDFG>();
 
-  DFInternalNode *Root = DFG.getRoot();
+  // DFInternalNode *Root = DFG.getRoot();
+  std::vector<DFInternalNode*> Roots = DFG.getRoots();
   // BuildDFG::HandleToDFNode &HandleToDFNodeMap = DFG.getHandleToDFNodeMap();
   // BuildDFG::HandleToDFEdge &HandleToDFEdgeMap = DFG.getHandleToDFEdgeMap();
 
@@ -100,7 +101,9 @@ bool ClearDFG::runOnModule(Module &M) {
   TreeTraversal *Visitor = new TreeTraversal(M, DFG);
 
   // Initiate code generation for root DFNode
-  Visitor->visit(Root);
+  for (auto rootNode: Roots) {
+    Visitor->visit(rootNode);
+  }
   delete Visitor;
   return true;
 }
diff --git a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
index e8c027686aba7fa19dfb0d3344f208e5ba2302b0..708711e1d9d85d3381c362ce9ddcc51f8fa130f1 100644
--- a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
+++ b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
@@ -98,7 +98,6 @@ public:
     localWGSize = V;
   }
 
-
   bool hasLocalWG() {
     return blockDim != 0;
   }
@@ -1110,15 +1109,20 @@ bool DFG2LLVM_NVPTX::runOnModule(Module &M) {
   // - Maps from i8* hansles to DFNode and DFEdge
   BuildDFG &DFG = getAnalysis<BuildDFG>();
 
-  DFInternalNode *Root = DFG.getRoot();
-//    BuildDFG::HandleToDFNode &HandleToDFNodeMap = DFG.getHandleToDFNodeMap();
-//    BuildDFG::HandleToDFEdge &HandleToDFEdgeMap = DFG.getHandleToDFEdgeMap();
+  // DFInternalNode *Root = DFG.getRoot();
+  std::vector<DFInternalNode*> Roots = DFG.getRoots();
+  //    BuildDFG::HandleToDFNode &HandleToDFNodeMap = DFG.getHandleToDFNodeMap();
+  //    BuildDFG::HandleToDFEdge &HandleToDFEdgeMap = DFG.getHandleToDFEdgeMap();
 
   // Visitor for Code Generation Graph Traversal
   CodeGenTraversal *CGTVisitor = new CodeGenTraversal(M, DFG);
 
-  // Initiate code generation for root DFNode
-  CGTVisitor->visit(Root);
+  // Iterate over all the DFGs and produce code for each one of them
+  for (auto rootNode: Roots) {
+    // Initiate code generation for root DFNode
+    CGTVisitor->visit(rootNode);
+  }
+
   //TODO: Edit module epilogue to remove the VISC intrinsic declarations
   delete CGTVisitor;
 
@@ -1246,7 +1250,7 @@ void CodeGenTraversal::addCLMetadata(Function *F) {
   NamedMDNode *MDN_annotations = KernelM.getOrInsertNamedMetadata("nvvm.annotations");
   MDN_annotations->addOperand(MDNvvmAnnotationsNode);
 
-//!1 = metadata !{void (float addrspace(1)*, float addrspace(1)*, float addrspace(1)*, i32, i32)* @matrixMul, metadata !"kernel", i32 1}
+  //!1 = metadata !{void (float addrspace(1)*, float addrspace(1)*, float addrspace(1)*, i32, i32)* @matrixMul, metadata !"kernel", i32 1}
 }
 
 void CodeGenTraversal::writeKernelsModule() {
diff --git a/llvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp b/llvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
index 818be97f6ff22d73fe362feff59cb5062bcef987..594e76384bd5ae2c9ca7fc013c6398f331b9249f 100644
--- a/llvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
+++ b/llvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
@@ -126,22 +126,24 @@ bool DFG2LLVM_X86::runOnModule(Module &M) {
   // - Maps from i8* hansles to DFNode and DFEdge
   BuildDFG &DFG = getAnalysis<BuildDFG>();
 
-  DFInternalNode *Root = DFG.getRoot();
+  //DFInternalNode *Root = DFG.getRoot();
+  std::vector<DFInternalNode*> Roots = DFG.getRoots();
   // BuildDFG::HandleToDFNode &HandleToDFNodeMap = DFG.getHandleToDFNodeMap();
   // BuildDFG::HandleToDFEdge &HandleToDFEdgeMap = DFG.getHandleToDFEdgeMap();
 
   // Visitor for Code Generation Graph Traversal
   CodeGenTraversal *CGTVisitor = new CodeGenTraversal(M, DFG);
 
-  // Initiate code generation for root DFNode
-  CGTVisitor->visit(Root);
-
-
-  // Go ahead and replace the launch intrinsic with pthread call, otherwise return now.
-  // TODO: Later on, we might like to do this in a separate pass, which would
-  // allow us the flexibility to switch between complete static code generation
-  // for DFG or having a customized runtime+scheduler
-  CGTVisitor->codeGenLaunch(Root);
+  // Iterate over all the DFGs and produce code for each one of them
+  for (auto rootNode: Roots) {
+    // Initiate code generation for root DFNode
+    CGTVisitor->visit(rootNode);
+    // Go ahead and replace the launch intrinsic with pthread call, otherwise return now.
+    // TODO: Later on, we might like to do this in a separate pass, which would
+    // allow us the flexibility to switch between complete static code generation
+    // for DFG or having a customized runtime+scheduler
+    CGTVisitor->codeGenLaunch(rootNode);
+  }
 
   delete CGTVisitor;
   return true;