3#include <boost/graph/graphviz.hpp>
4#include <boost/lexical_cast.hpp>
12#include <unordered_map>
13#include <unordered_set>
41 std::unordered_map<graph::Vertex, std::unique_ptr<control_flow::State>, boost::hash<graph::Vertex>> states_;
42 std::unordered_map<graph::Edge, std::unique_ptr<control_flow::InterstateEdge>, boost::hash<graph::Edge>> edges_;
63 return std::views::values(this->edges_) |
69 auto [eb, ee] = boost::in_edges(state.
vertex(), this->graph_);
70 auto edges = std::ranges::subrange(eb, ee);
73 auto interstate_edges =
74 std::views::transform(
77 return *(lookup_table.find(
edge)->second);
82 return interstate_edges;
86 auto [eb, ee] = boost::out_edges(state.
vertex(), this->graph_);
87 auto edges = std::ranges::subrange(eb, ee);
90 auto interstate_edges =
91 std::views::transform(
94 return *(lookup_table.find(
edge)->second);
99 return interstate_edges;
118 std::unordered_map<const control_flow::State*, const control_flow::State*>
dominator_tree()
const;
122 std::list<const control_flow::InterstateEdge*>
back_edges()
const;
124 std::list<std::list<const control_flow::InterstateEdge*>>
Access nodes for reading/writing data in the dataflow graph.
const types::IType & return_type() const
FunctionType type() const
Function(const std::string &name, FunctionType type)
const std::string & name() const
SDFG(const std::string &name, FunctionType type, const types::IType &return_type)
const control_flow::InterstateEdge & edge(const control_flow::State &src, const control_flow::State &dst) const
auto terminal_states() const
Definition sdfg.h:104
std::unordered_map< const control_flow::State *, const control_flow::State * > dominator_tree() const
SDFG(const SDFG &sdfg)=delete
auto edges() const
Definition sdfg.h:62
bool is_adjacent(const control_flow::State &src, const control_flow::State &dst) const
size_t in_degree(const control_flow::State &state) const
void as_dot(std::ostream &out) const
std::list< const control_flow::InterstateEdge * > back_edges() const
auto states() const
Definition sdfg.h:57
void validate() const override
Validates the function.
auto in_edges(const control_flow::State &state) const
Definition sdfg.h:68
const control_flow::State & start_state() const
size_t out_degree(const control_flow::State &state) const
std::list< std::list< const control_flow::InterstateEdge * > > all_simple_paths(const control_flow::State &src, const control_flow::State &dst) const
auto out_edges(const control_flow::State &state) const
Definition sdfg.h:85
std::unordered_map< const control_flow::State *, const control_flow::State * > post_dominator_tree()
SDFG & operator=(const SDFG &)=delete
SDFG(const std::string &name, FunctionType type)
Definition sdfg_builder.h:13
Note: Even though the class references unique_ptr, it will never delete an SDFG it has a reference to...
Definition structured_sdfg_builder.h:44
An edge connecting two states in an SDFG control-flow graph.
Definition interstate_edge.h:71
A state in a Stateful DataFlow Graph (SDFG).
Definition state.h:38
graph::Vertex vertex() const
Returns the graph vertex representing this state.
Abstract base interface for all types in the sdfglib type system.
Definition type.h:625
Base class for all nodes in the dataflow graph.
Edges in the dataflow graph representing data movement.
Definition function_builder.h:10
boost::graph_traits< Graph >::edge_descriptor Edge
Definition graph.h:26
boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS > Graph
Definition graph.h:24
const T & add_const(T &s)
Definition helpers.h:44
T & indirect(const std::unique_ptr< T > &ptr)
Definition helpers.h:39
StringEnum FunctionType
Definition function.h:37
Simple computational operations in the dataflow graph.