Jlm
view.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2024 David Metz <david.c.metz@ntnu.no>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_BACKEND_HLS_UTIL_VIEW_HPP
7 #define JLM_BACKEND_HLS_UTIL_VIEW_HPP
8 
10 #include <jlm/rvsdg/graph.hpp>
12 #include <jlm/util/Statistics.hpp>
13 #include <string>
14 
15 namespace jlm::hls
16 {
17 
19 {
22  RED
23 };
24 
25 std::string
26 ViewcolorToString(const ViewColors & color);
27 
28 std::string
30  rvsdg::Region * region,
31  std::unordered_map<rvsdg::Output *, ViewColors> & outputColor,
32  std::unordered_map<rvsdg::Input *, ViewColors> & inputColor,
33  std::unordered_map<rvsdg::Output *, ViewColors> & tailLabel);
34 
35 std::string
36 ToDot(
37  rvsdg::Region * region,
38  std::unordered_map<rvsdg::Output *, ViewColors> & outputColor,
39  std::unordered_map<rvsdg::Input *, ViewColors> & inputColor,
40  std::unordered_map<rvsdg::Output *, ViewColors> & tailLabel);
41 
42 void
43 ViewDot(rvsdg::Region * region, FILE * out);
44 
45 void
46 ViewDot(
47  rvsdg::Region * region,
48  FILE * out,
49  std::unordered_map<rvsdg::Output *, ViewColors> & outputColor,
50  std::unordered_map<rvsdg::Input *, ViewColors> & inputColor,
51  std::unordered_map<rvsdg::Output *, ViewColors> & tailLabel);
52 
53 void
54 DumpDot(
55  llvm::LlvmRvsdgModule & rvsdgModule,
56  const std::string & fileName,
57  std::unordered_map<rvsdg::Output *, ViewColors> outputColor,
58  std::unordered_map<rvsdg::Input *, ViewColors> inputColor,
59  std::unordered_map<rvsdg::Output *, ViewColors> tailLabel);
60 void
61 
62 DumpDot(llvm::LlvmRvsdgModule & rvsdgModule, const std::string & fileName);
63 
64 void
65 DumpDot(
66  rvsdg::Region * region,
67  const std::string & fileName,
68  std::unordered_map<rvsdg::Output *, ViewColors> outputColor,
69  std::unordered_map<rvsdg::Input *, ViewColors> inputColor,
70  std::unordered_map<rvsdg::Output *, ViewColors> tailLabel);
71 void
72 DumpDot(rvsdg::Region * region, const std::string & fileName);
73 
74 void
75 DotToSvg(const std::string & fileName);
76 
82 {
83 public:
84  ~DumpDotTransformation() noexcept override;
85 
87 
89 
91  operator=(const DumpDotTransformation &) = delete;
92 
99  void
100  Run(rvsdg::RvsdgModule & rvsdgModule, util::StatisticsCollector & statisticsCollector) override;
101 
102  static void
103  createAndRun(rvsdg::RvsdgModule & rvsdgModule, util::StatisticsCollector & statisticsCollector)
104  {
105  DumpDotTransformation dumpDot;
106  dumpDot.Run(rvsdgModule, statisticsCollector);
107  }
108 };
109 
110 } // namespace jlm::hls
111 
112 #endif // JLM_BACKEND_HLS_UTIL_VIEW_HPP
~DumpDotTransformation() noexcept override
void Run(rvsdg::RvsdgModule &rvsdgModule, util::StatisticsCollector &statisticsCollector) override
Definition: view.cpp:511
static void createAndRun(rvsdg::RvsdgModule &rvsdgModule, util::StatisticsCollector &statisticsCollector)
Definition: view.hpp:103
Represent acyclic RVSDG subgraphs.
Definition: region.hpp:213
Represents an RVSDG transformation.
void DumpDot(llvm::LlvmRvsdgModule &rvsdgModule, const std::string &file_name)
Definition: view.cpp:459
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)
Definition: view.cpp:350
ViewColors
Definition: view.hpp:19
@ BLACK
Definition: view.hpp:21
@ NONE
Definition: view.hpp:20
@ RED
Definition: view.hpp:22
void DotToSvg(const std::string &file_name)
Definition: view.cpp:497
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)
Definition: view.cpp:438
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)
Definition: view.cpp:424
std::string ViewcolorToString(const ViewColors &color)
Definition: view.cpp:22