99 enum class VertexType {
122 using vertexProperties = boost::property<boost::vertex_attribute_t, GraphvizAttributes, Vertex>;
123 using edgeProperties = boost::property<
125 boost::property<boost::edge_name_t, cstring, boost::property<boost::edge_index_t, int>>>;
126 using graphProperties = boost::property<
127 boost::graph_name_t, std::string,
131 boost::property<boost::graph_edge_attribute_t, GraphvizAttributes>>>>;
132 using Graph_ = boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
133 vertexProperties, edgeProperties, graphProperties>;
134 using Graph = boost::subgraph<Graph_>;
135 using vertex_t = boost::graph_traits<Graph>::vertex_descriptor;
137 using Parents = std::vector<std::pair<vertex_t, EdgeTypeIface *>>;
143 vertex_t add_vertex(
const cstring &name, VertexType type);
144 vertex_t add_and_connect_vertex(
const cstring &name, VertexType type);
145 void add_edge(
const vertex_t &from,
const vertex_t &to,
const cstring &name);
152 void add_edge(
const vertex_t &from,
const vertex_t &to,
const cstring &name,
153 unsigned cluster_id);
157 void operator()(Graph &g)
const {
158 auto vertices = boost::vertices(g);
159 for (
auto &vit = vertices.first; vit != vertices.second; ++vit) {
160 const auto &vinfo = g[*vit];
161 auto attrs = boost::get(boost::vertex_attribute, g);
162 attrs[*vit][
"label"_cs] = vinfo.name;
163 attrs[*vit][
"style"_cs] = vertexTypeGetStyle(vinfo.type);
164 attrs[*vit][
"shape"_cs] = vertexTypeGetShape(vinfo.type);
165 attrs[*vit][
"margin"_cs] = vertexTypeGetMargin(vinfo.type);
167 auto edges = boost::edges(g);
168 for (
auto &eit = edges.first; eit != edges.second; ++eit) {
169 auto attrs = boost::get(boost::edge_attribute, g);
170 attrs[*eit][
"label"_cs] = boost::get(boost::edge_name, g, *eit);
175 static cstring vertexTypeGetShape(VertexType type) {
177 case VertexType::TABLE:
178 case VertexType::ACTION:
181 return "rectangle"_cs;
184 return cstring::empty;
187 static cstring vertexTypeGetStyle(VertexType type) {
189 case VertexType::CONTROL:
191 case VertexType::EMPTY:
193 case VertexType::KEY:
194 case VertexType::CONDITION:
195 case VertexType::SWITCH:
201 return cstring::empty;
204 static cstring vertexTypeGetMargin(VertexType type) {
207 return cstring::empty;
217 std::vector<const IR::Statement *> statementsStack{};
224 void limitStringSize(std::stringstream &sstream, std::stringstream &helper_sstream);
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24