96 enum class VertexType {
118 using GraphvizAttributes = std::map<cstring, cstring>;
119 using vertexProperties = boost::property<boost::vertex_attribute_t, GraphvizAttributes, Vertex>;
120 using edgeProperties = boost::property<
121 boost::edge_attribute_t, GraphvizAttributes,
122 boost::property<boost::edge_name_t, cstring, boost::property<boost::edge_index_t, int>>>;
123 using graphProperties = boost::property<
126 boost::graph_graph_attribute_t, GraphvizAttributes,
127 boost::property<boost::graph_vertex_attribute_t, GraphvizAttributes,
128 boost::property<boost::graph_edge_attribute_t, GraphvizAttributes>>>>;
129 using Graph_ = boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
130 vertexProperties, edgeProperties, graphProperties>;
131 using Graph = boost::subgraph<Graph_>;
132 using vertex_t = boost::graph_traits<Graph>::vertex_descriptor;
134 using Parents = std::vector<std::pair<vertex_t, EdgeTypeIface *>>;
138 std::optional<vertex_t> merge_other_statements_into_vertex();
140 vertex_t add_vertex(
const cstring &name, VertexType type);
141 vertex_t add_and_connect_vertex(
const cstring &name, VertexType type);
142 void add_edge(
const vertex_t &from,
const vertex_t &to,
const cstring &name);
150 void add_edge(
const vertex_t &from,
const vertex_t &to,
const cstring &name,
151 unsigned cluster_id);
155 void operator()(Graph &g)
const {
156 auto vertices = boost::vertices(g);
157 for (
auto &vit = vertices.first; vit != vertices.second; ++vit) {
158 const auto &vinfo = g[*vit];
159 auto attrs = boost::get(boost::vertex_attribute, g);
160 attrs[*vit][
"label"] = vinfo.name;
161 attrs[*vit][
"style"] = vertexTypeGetStyle(vinfo.type);
162 attrs[*vit][
"shape"] = vertexTypeGetShape(vinfo.type);
163 attrs[*vit][
"margin"] = vertexTypeGetMargin(vinfo.type);
165 auto edges = boost::edges(g);
166 for (
auto &eit = edges.first; eit != edges.second; ++eit) {
167 auto attrs = boost::get(boost::edge_attribute, g);
168 attrs[*eit][
"label"] = boost::get(boost::edge_name, g, *eit);
173 static cstring vertexTypeGetShape(VertexType type) {
175 case VertexType::TABLE:
176 case VertexType::ACTION:
185 static cstring vertexTypeGetStyle(VertexType type) {
187 case VertexType::CONTROL:
189 case VertexType::EMPTY:
191 case VertexType::KEY:
192 case VertexType::CONDITION:
193 case VertexType::SWITCH:
202 static cstring vertexTypeGetMargin(VertexType type) {
215 std::vector<const IR::Statement *> statementsStack{};
223 void limitStringSize(std::stringstream &sstream, std::stringstream &helper_sstream);