Enhancements for --view-graph
llvm-svn: 50737
diff --git a/llvm/tools/llvmc2/CompilationGraph.cpp b/llvm/tools/llvmc2/CompilationGraph.cpp
index 53195cb..c0c849b 100644
--- a/llvm/tools/llvmc2/CompilationGraph.cpp
+++ b/llvm/tools/llvmc2/CompilationGraph.cpp
@@ -204,15 +204,29 @@
: public DefaultDOTGraphTraits
{
- template<typename GraphType>
- static std::string getNodeLabel(const Node* N, const GraphType&) {
- if (N->ToolPtr)
- return N->Name();
- else
- return "root";
- }
+ template<typename GraphType>
+ static std::string getNodeLabel(const Node* N, const GraphType&)
+ {
+ if (N->ToolPtr)
+ if (N->ToolPtr->IsJoin())
+ return N->Name() + "\n (join" +
+ (N->HasChildren() ? ")"
+ : std::string(": ") + N->ToolPtr->OutputLanguage() + ')');
+ else
+ return N->Name();
+ else
+ return "root";
+ }
+ template<typename EdgeIter>
+ static std::string getEdgeSourceLabel(const Node* N, EdgeIter I) {
+ if (N->ToolPtr)
+ return N->ToolPtr->OutputLanguage();
+ else
+ return I->ToolPtr->InputLanguage();
+ }
};
+
}
void CompilationGraph::writeGraph() {