| 1 | #include <list>
|
|---|
| 2 | #include <boost/graph/reverse_graph.hpp>
|
|---|
| 3 | #include <boost/graph/adjacency_list.hpp>
|
|---|
| 4 | #include <boost/graph/properties.hpp>
|
|---|
| 5 | #include <boost/foreach.hpp>
|
|---|
| 6 |
|
|---|
| 7 | class Basic_block;
|
|---|
| 8 | class Edge;
|
|---|
| 9 | enum vertex_bb_t { vertex_bb };
|
|---|
| 10 | enum edge_cfg_edge_t { edge_cfg_edge };
|
|---|
| 11 | struct phc_listS {};
|
|---|
| 12 |
|
|---|
| 13 | namespace boost {
|
|---|
| 14 | BOOST_INSTALL_PROPERTY(vertex, bb);
|
|---|
| 15 | BOOST_INSTALL_PROPERTY(edge, cfg_edge);
|
|---|
| 16 | template <class ValueType>
|
|---|
| 17 | struct container_gen <phc_listS, ValueType> { typedef std::list<ValueType> type; };
|
|---|
| 18 | template<> struct parallel_edge_traits<phc_listS> { typedef allow_parallel_edge_tag type; };
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | typedef boost::adjacency_list<
|
|---|
| 22 | phc_listS,
|
|---|
| 23 | phc_listS,
|
|---|
| 24 | boost::bidirectionalS, // we want access to source and targets of edges
|
|---|
| 25 | boost::property<boost::vertex_index_t, int,
|
|---|
| 26 | boost::property<boost::vertex_color_t, boost::default_color_type,
|
|---|
| 27 | boost::property<vertex_bb_t, Basic_block*> > >,
|
|---|
| 28 | boost::property<edge_cfg_edge_t, Edge*>,
|
|---|
| 29 | boost::no_property,
|
|---|
| 30 | phc_listS
|
|---|
| 31 | > Graph;
|
|---|
| 32 |
|
|---|
| 33 | void calculate_dominance2 (boost::reverse_graph<Graph>& graph)
|
|---|
| 34 | {
|
|---|
| 35 | /* Use the function in Cooper/Torczon, Figure 9.10 */
|
|---|
| 36 | BOOST_FOREACH (Graph::vertex_descriptor n, vertices (graph))
|
|---|
| 37 | {
|
|---|
| 38 | if (in_degree (n, graph) > 0)
|
|---|
| 39 | {
|
|---|
| 40 | BOOST_FOREACH (Graph::edge_descriptor e, in_edges (n, graph))
|
|---|
| 41 | {
|
|---|
| 42 | }
|
|---|
| 43 | }
|
|---|
| 44 | }
|
|---|
| 45 | }
|
|---|