[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Mar 2 15:40:01 PST 2004


Changes in directory llvm/lib/Analysis/DataStructure:

Printer.cpp updated: 1.66 -> 1.67

---
Log message:

FINALLY be able to get symbolic type names in the globals graph!


---
Diffs of the changes:  (+14 -1)

Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.66 llvm/lib/Analysis/DataStructure/Printer.cpp:1.67
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.66	Wed Feb 25 17:06:30 2004
+++ llvm/lib/Analysis/DataStructure/Printer.cpp	Tue Mar  2 15:39:43 2004
@@ -40,11 +40,17 @@
   std::stringstream OS;
   Module *M = 0;
 
-  if (G) G = N->getParentGraph();
+  if (!G) G = N->getParentGraph();
 
   // Get the module from ONE of the functions in the graph it is available.
   if (G && !G->getReturnNodes().empty())
     M = G->getReturnNodes().begin()->first->getParent();
+  if (M == 0 && G) {
+    // If there is a global in the graph, we can use it to find the module.
+    const DSScalarMap &SM = G->getScalarMap();
+    if (SM.global_begin() != SM.global_end())
+      M = (*SM.global_begin())->getParent();
+  }
 
   if (N->isNodeCompletelyFolded())
     OS << "COLLAPSED";
@@ -108,6 +114,13 @@
     Module *CurMod = 0;
     if (!G->getReturnNodes().empty())
       CurMod = G->getReturnNodes().begin()->first->getParent();
+    else {
+      // If there is a global in the graph, we can use it to find the module.
+      const DSScalarMap &SM = G->getScalarMap();
+      if (SM.global_begin() != SM.global_end())
+        CurMod = (*SM.global_begin())->getParent();
+    }
+
 
     // Add scalar nodes to the graph...
     const DSGraph::ScalarMapTy &VM = G->getScalarMap();





More information about the llvm-commits mailing list