aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/GraphWriter.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-01-25 07:45:25 +0000
committerAndrew Trick <atrick@apple.com>2013-01-25 07:45:25 +0000
commitc6ada8e5f38168f13830e448f2b9e2d8e3eac72b (patch)
tree4ea636736947bf200b145430436b821c5a4c50f8 /lib/Support/GraphWriter.cpp
parenta5a73ad15905c18843a8312bb3f20f5c501744de (diff)
downloadexternal_llvm-c6ada8e5f38168f13830e448f2b9e2d8e3eac72b.zip
external_llvm-c6ada8e5f38168f13830e448f2b9e2d8e3eac72b.tar.gz
external_llvm-c6ada8e5f38168f13830e448f2b9e2d8e3eac72b.tar.bz2
ScheduleDAG: colorize the DOT graph and improve formatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173431 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/GraphWriter.cpp')
-rw-r--r--lib/Support/GraphWriter.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Support/GraphWriter.cpp b/lib/Support/GraphWriter.cpp
index 669c238..bff182f 100644
--- a/lib/Support/GraphWriter.cpp
+++ b/lib/Support/GraphWriter.cpp
@@ -53,6 +53,17 @@ std::string llvm::DOT::EscapeString(const std::string &Label) {
return Str;
}
+/// \brief Get a color string for this node number. Simply round-robin selects
+/// from a reasonable number of colors.
+StringRef llvm::DOT::getColorString(unsigned ColorNumber) {
+ static const int NumColors = 20;
+ static const char* Colors[NumColors] = {
+ "aaaaaa", "aa0000", "00aa00", "aa5500", "0055ff", "aa00aa", "00aaaa",
+ "555555", "ff5555", "55ff55", "ffff55", "5555ff", "ff55ff", "55ffff",
+ "ffaaaa", "aaffaa", "ffffaa", "aaaaff", "ffaaff", "aaffff"};
+ return Colors[ColorNumber % NumColors];
+}
+
// Execute the graph viewer. Return true if successful.
static bool LLVM_ATTRIBUTE_UNUSED
ExecGraphViewer(const sys::Path &ExecPath, std::vector<const char*> &args,