45static inline std::string
125 +
" [shape=plaintext label=<\n"
126 " <TABLE BORDER=\"0\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">\n"
128 " <TD PORT=\"default\" BORDER=\"1\" CELLPADDING=\"1\"><FONT "
176 std::unordered_map<rvsdg::Output *, ViewColors> &
tailLabel,
179 auto color =
"black";
184 +
" [style=\"\", arrowhead=\"normal\", color=" +
color
185 +
", headlabel=<>, fontsize=15, labelangle=45, labeldistance=2.0, labelfontcolor=blue, "
191 +
" [style=\"\", arrowhead=\"normal\", color=" +
color
192 +
", headlabel=<>, fontsize=15, labelangle=45, labeldistance=2.0, labelfontcolor=blue, "
193 "constraint=false, tooltip=\""
201 auto color =
"black";
203 +
" [style=\"\", arrowhead=\"normal\", color=" +
color
204 +
", headlabel=<>, fontsize=10, labelangle=45, labeldistance=2.0, labelfontcolor=black, "
206 + output->
Type()->debug_string() +
"\"];\n";
212 if ((
'A' <=
c &&
c <=
'Z') || (
'a' <=
c &&
c <=
'z') || (
'0' <=
c &&
c <=
'9') ||
'_' ==
c)
222 std::unordered_map<rvsdg::Output *, ViewColors> &
outputColor,
223 std::unordered_map<rvsdg::Input *, ViewColors> &
inputColor,
224 std::unordered_map<rvsdg::Output *, ViewColors> &
tailLabel)
227 std::ostringstream
dot;
229 dot <<
"color=\"#ff8080\"\n";
230 dot <<
"penwidth=6\n";
232 dot <<
"labeljust=l\n";
275 std::unordered_map<rvsdg::Output *, ViewColors> &
outputColor,
276 std::unordered_map<rvsdg::Input *, ViewColors> &
inputColor)
278 auto SPACER =
" <TD WIDTH=\"10\"></TD>\n";
283 std::ostringstream
inputs;
293 <<
"\" BORDER=\"1\" CELLPADDING=\"1\" COLOR=\"" <<
color
294 <<
"\"><FONT POINT-SIZE=\"10\" COLOR=\"" <<
color <<
"\"> i" <<
i <<
"</FONT></TD>\n";
307 <<
"\" BORDER=\"1\" CELLPADDING=\"1\" COLOR=\"" <<
color
308 <<
"\"><FONT POINT-SIZE=\"10\" COLOR=\"" <<
color <<
"\"> o" <<
i <<
"</FONT></TD>\n";
311 std::string
color =
"black";
314 +
" [shape=plaintext label=<\n"
315 "<TABLE BORDER=\"0\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">\n"
318 " <TD BORDER=\"0\">\n"
319 " <TABLE BORDER=\"0\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">\n"
321 " <TD WIDTH=\"20\"></TD>\n"
323 +
" <TD WIDTH=\"20\"></TD>\n"
329 " <TD BORDER=\"3\" STYLE=\"ROUNDED\" CELLPADDING=\"4\">"
330 +
opname +
"<BR/><FONT POINT-SIZE=\"10\">" + name
334 " <TD BORDER=\"0\">\n"
335 " <TABLE BORDER=\"0\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">\n"
337 " <TD WIDTH=\"20\"></TD>\n"
339 +
" <TD WIDTH=\"20\"></TD>\n"
353 std::unordered_map<rvsdg::Output *, ViewColors> &
outputColor,
354 std::unordered_map<rvsdg::Input *, ViewColors> &
inputColor,
355 std::unordered_map<rvsdg::Output *, ViewColors> &
tailLabel)
357 std::ostringstream
dot;
359 dot <<
"color=\"#80b3ff\"\n";
360 dot <<
"penwidth=6\n";
364 dot <<
"{rank=source; ";
387 for (
size_t i = 0;
i < node->ninputs(); ++
i)
394 dot <<
"{rank=sink; ";
414 for (auto & var : theta.GetLoopVars())
416 dot << Edge(var.pre, var.post, tailLabel, true);
421 for (
auto &
var : loop.getBackEdgeVars())
436 std::unordered_map<rvsdg::Output *, ViewColors> & outputColor,
437 std::unordered_map<rvsdg::Input *, ViewColors> & inputColor,
438 std::unordered_map<rvsdg::Output *, ViewColors> & tailLabel)
440 std::ostringstream dot;
441 dot <<
"digraph G {\n";
442 dot <<
RegionToDot(region, outputColor, inputColor, tailLabel);
451 std::unordered_map<rvsdg::Output *, ViewColors> & outputColor,
452 std::unordered_map<rvsdg::Input *, ViewColors> & inputColor,
453 std::unordered_map<rvsdg::Output *, ViewColors> & tailLabel)
455 fputs(
ToDot(region, outputColor, inputColor, tailLabel).c_str(), out);
462 std::unordered_map<rvsdg::Output *, ViewColors> outputColor;
463 std::unordered_map<rvsdg::Input *, ViewColors> inputColor;
464 std::unordered_map<rvsdg::Output *, ViewColors> tailLabel;
465 ViewDot(region, out, outputColor, inputColor, tailLabel);
477 const std::string & file_name,
478 std::unordered_map<rvsdg::Output *, ViewColors> outputColor,
479 std::unordered_map<rvsdg::Input *, ViewColors> inputColor,
480 std::unordered_map<rvsdg::Output *, ViewColors> tailLabel)
488 auto dot_file = fopen(file_name.c_str(),
"w");
496 const std::string & file_name,
497 std::unordered_map<rvsdg::Output *, ViewColors> outputColor,
498 std::unordered_map<rvsdg::Input *, ViewColors> inputColor,
499 std::unordered_map<rvsdg::Output *, ViewColors> tailLabel)
501 auto dot_file = fopen(file_name.c_str(),
"w");
502 ViewDot(region, dot_file, outputColor, inputColor, tailLabel);
509 auto cmd =
"dot -Tsvg -O " + file_name;
510 if (system(cmd.c_str()))
514DumpDotTransformation::~DumpDotTransformation() noexcept = default;
521DumpDotTransformation::Run(
static jlm::util::StatisticsCollector statisticsCollector
Region & GetRootRegion() const noexcept
size_t index() const noexcept
const std::shared_ptr< const rvsdg::Type > & Type() const noexcept
Represents the argument of a region.
Represents the result of a region.
Represent acyclic RVSDG subgraphs.
RegionArgument * argument(size_t index) const noexcept
size_t nresults() const noexcept
RegionResult * result(size_t index) const noexcept
size_t index() const noexcept
rvsdg::StructuralNode * node() const noexcept
size_t narguments() const noexcept
File createOutputFile(std::string fileNameSuffix, bool includeCount=false)
#define JLM_UNREACHABLE(msg)
std::string GetDotName(rvsdg::Node *node)
ViewColors GetDefaultLabel(std::unordered_map< T *, ViewColors > &map, T *elem, ViewColors def=NONE)
std::string SymbolicEdge(rvsdg::Input *output, rvsdg::Output *input)
void DumpDot(llvm::LlvmRvsdgModule &rvsdgModule, const std::string &file_name)
std::string RegionToDot(rvsdg::Region *region, std::unordered_map< rvsdg::Output *, ViewColors > &outputColor, std::unordered_map< rvsdg::Input *, ViewColors > &inputColor, std::unordered_map< rvsdg::Output *, ViewColors > &tailLabel)
std::string ResultToDot(rvsdg::RegionResult *result, const ViewColors &color)
std::string PortToDot(const std::string &display_name, const std::string &dot_name, const ViewColors &color)
void DotToSvg(const std::string &file_name)
void ViewDot(rvsdg::Region *region, FILE *out, std::unordered_map< rvsdg::Output *, ViewColors > &outputColor, std::unordered_map< rvsdg::Input *, ViewColors > &inputColor, std::unordered_map< rvsdg::Output *, ViewColors > &tailLabel)
std::string Edge(jlm::rvsdg::Output *output, jlm::rvsdg::Input *input, std::unordered_map< rvsdg::Output *, ViewColors > &tailLabel, bool back_edge=false)
std::string StructuralOutputToDot(rvsdg::StructuralOutput *structuralOutput, const ViewColors &color)
ViewColors GetDefaultColor(std::unordered_map< T *, ViewColors > &map, T *elem, ViewColors def=BLACK)
std::string ToDot(rvsdg::Region *region, std::unordered_map< rvsdg::Output *, ViewColors > &outputColor, std::unordered_map< rvsdg::Input *, ViewColors > &inputColor, std::unordered_map< rvsdg::Output *, ViewColors > &tailLabel)
static std::string hex(size_t i)
std::string ArgumentToDot(rvsdg::RegionArgument *argument, const ViewColors &color)
std::string StructuralNodeToDot(rvsdg::StructuralNode *structuralNode, std::unordered_map< rvsdg::Output *, ViewColors > &outputColor, std::unordered_map< rvsdg::Input *, ViewColors > &inputColor, std::unordered_map< rvsdg::Output *, ViewColors > &tailLabel)
std::string StructuralInputToDot(rvsdg::StructuralInput *structuralInput, const ViewColors &color)
std::string ViewcolorToString(const ViewColors &color)
bool isForbiddenChar(char c)
std::string SimpleNodeToDot(rvsdg::SimpleNode *simpleNode, std::unordered_map< rvsdg::Output *, ViewColors > &outputColor, std::unordered_map< rvsdg::Input *, ViewColors > &inputColor)
void MatchType(T &obj, const Fns &... fns)
Pattern match over subclass type of given object.
static std::vector< jlm::rvsdg::Output * > outputs(const Node *node)
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
detail::TopDownTraverserGeneric< false > TopDownTraverser
Traverser for visiting every node in a region in a top down order.
static std::string strfmt(Args... args)