82 enum class VertexType {
105 using vertexProperties = boost::property<boost::vertex_attribute_t, GraphvizAttributes, Vertex>;
106 using edgeProperties = boost::property<
108 boost::property<boost::edge_name_t, cstring, boost::property<boost::edge_index_t, int>>>;
109 using graphProperties = boost::property<
110 boost::graph_name_t, std::string,
114 boost::property<boost::graph_edge_attribute_t, GraphvizAttributes>>>>;
115 using Graph_ = boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
116 vertexProperties, edgeProperties, graphProperties>;
117 using Graph = boost::subgraph<Graph_>;
118 using vertex_t = boost::graph_traits<Graph>::vertex_descriptor;
120 using Parents = std::vector<std::pair<vertex_t, EdgeTypeIface *>>;
126 vertex_t add_vertex(
const cstring &name, VertexType type);
127 vertex_t add_and_connect_vertex(
const cstring &name, VertexType type);
128 void add_edge(
const vertex_t &from,
const vertex_t &to,
const cstring &name);
135 void add_edge(
const vertex_t &from,
const vertex_t &to,
const cstring &name,
136 unsigned cluster_id);
140 void operator()(Graph &g)
const {
141 auto vertices = boost::vertices(g);
142 for (
auto &vit = vertices.first; vit != vertices.second; ++vit) {
143 const auto &vinfo = g[*vit];
144 auto attrs = boost::get(boost::vertex_attribute, g);
145 attrs[*vit][
"label"_cs] = vinfo.name;
146 attrs[*vit][
"style"_cs] = vertexTypeGetStyle(vinfo.type);
147 attrs[*vit][
"shape"_cs] = vertexTypeGetShape(vinfo.type);
148 attrs[*vit][
"margin"_cs] = vertexTypeGetMargin(vinfo.type);
150 auto edges = boost::edges(g);
151 for (
auto &eit = edges.first; eit != edges.second; ++eit) {
152 auto attrs = boost::get(boost::edge_attribute, g);
153 attrs[*eit][
"label"_cs] = boost::get(boost::edge_name, g, *eit);
158 static cstring vertexTypeGetShape(VertexType type) {
160 case VertexType::TABLE:
161 case VertexType::ACTION:
164 return "rectangle"_cs;
167 return cstring::empty;
170 static cstring vertexTypeGetStyle(VertexType type) {
172 case VertexType::CONTROL:
174 case VertexType::EMPTY:
176 case VertexType::KEY:
177 case VertexType::CONDITION:
178 case VertexType::SWITCH:
184 return cstring::empty;
187 static cstring vertexTypeGetMargin(VertexType type) {
190 return cstring::empty;
200 std::vector<const IR::Statement *> statementsStack{};
207 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