diff options
author | Chris Lattner <sabre@nondot.org> | 2004-03-02 21:39:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-03-02 21:39:43 +0000 |
commit | 2e92b469c8046370e2d7334539ce9006a41c8bc2 (patch) | |
tree | b96411f5b41a036d36df4fc136c5d5cadb4641c9 /llvm/lib/Analysis/DataStructure/Printer.cpp | |
parent | 9e100fc3f70718177638fb46494eb137876f85e1 (diff) | |
download | bcm5719-llvm-2e92b469c8046370e2d7334539ce9006a41c8bc2.tar.gz bcm5719-llvm-2e92b469c8046370e2d7334539ce9006a41c8bc2.zip |
FINALLY be able to get symbolic type names in the globals graph!
llvm-svn: 12082
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/Printer.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/Printer.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Printer.cpp b/llvm/lib/Analysis/DataStructure/Printer.cpp index 6775efe398e..03058fb3825 100644 --- a/llvm/lib/Analysis/DataStructure/Printer.cpp +++ b/llvm/lib/Analysis/DataStructure/Printer.cpp @@ -40,11 +40,17 @@ static std::string getCaption(const DSNode *N, const DSGraph *G) { 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 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits { 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(); |