90 enum class VertexType {
113 using vertexProperties = boost::property<boost::vertex_attribute_t, GraphvizAttributes, Vertex>;
114 using edgeProperties = boost::property<
116 boost::property<boost::edge_name_t, cstring, boost::property<boost::edge_index_t, int>>>;
117 using graphProperties = boost::property<
118 boost::graph_name_t, std::string,
122 boost::property<boost::graph_edge_attribute_t, GraphvizAttributes>>>>;
123 using Graph_ = boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
124 vertexProperties, edgeProperties, graphProperties>;
125 using Graph = boost::subgraph<Graph_>;
126 using vertex_t = boost::graph_traits<Graph>::vertex_descriptor;
128 using Parents = std::vector<std::pair<vertex_t, EdgeTypeIface *>>;
134 vertex_t add_vertex(
const cstring &name, VertexType type);
135 vertex_t add_and_connect_vertex(
const cstring &name, VertexType type);
136 void add_edge(
const vertex_t &from,
const vertex_t &to,
const cstring &name);
143 void add_edge(
const vertex_t &from,
const vertex_t &to,
const cstring &name,
144 unsigned cluster_id);
148 void operator()(Graph &g)
const {
149 auto vertices = boost::vertices(g);
150 for (
auto &vit = vertices.first; vit != vertices.second; ++vit) {
151 const auto &vinfo = g[*vit];
152 auto attrs = boost::get(boost::vertex_attribute, g);
153 attrs[*vit][
"label"_cs] = vinfo.name;
154 attrs[*vit][
"style"_cs] = vertexTypeGetStyle(vinfo.type);
155 attrs[*vit][
"shape"_cs] = vertexTypeGetShape(vinfo.type);
156 attrs[*vit][
"margin"_cs] = vertexTypeGetMargin(vinfo.type);
158 auto edges = boost::edges(g);
159 for (
auto &eit = edges.first; eit != edges.second; ++eit) {
160 auto attrs = boost::get(boost::edge_attribute, g);
161 attrs[*eit][
"label"_cs] = boost::get(boost::edge_name, g, *eit);
166 static cstring vertexTypeGetShape(VertexType type) {
168 case VertexType::TABLE:
169 case VertexType::ACTION:
172 return "rectangle"_cs;
175 return cstring::empty;
178 static cstring vertexTypeGetStyle(VertexType type) {
180 case VertexType::CONTROL:
182 case VertexType::EMPTY:
184 case VertexType::KEY:
185 case VertexType::CONDITION:
186 case VertexType::SWITCH:
192 return cstring::empty;
195 static cstring vertexTypeGetMargin(VertexType type) {
198 return cstring::empty;
208 std::vector<const IR::Statement *> statementsStack{};
215 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:13