docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
control_flow_analysis.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <unordered_map>
5#include <unordered_set>
6
8#include "sdfg/element.h"
11
12namespace sdfg {
13namespace analysis {
14
16 friend class AnalysisManager;
17
18private:
19 graph::Graph graph_;
20
21 // Temporary storage for loop nodes
22 graph::Vertex last_loop_;
23
24 std::unordered_map<graph::Vertex, structured_control_flow::ControlFlowNode*, boost::hash<graph::Vertex>> nodes_;
25 std::unordered_map<structured_control_flow::ControlFlowNode*, structured_control_flow::ControlFlowNode*> dom_tree_;
26 std::unordered_map<structured_control_flow::ControlFlowNode*, structured_control_flow::ControlFlowNode*> pdom_tree_;
27
28 std::pair<graph::Vertex, graph::Vertex> traverse(structured_control_flow::ControlFlowNode& current);
29
30 // Walk a boost (post)dominator tree from `start`, skipping synthetic vertices (IfElse merge points and the
31 // post-dominance super-terminal) that map to no real control-flow node, and return the first real ancestor.
33 resolve_real_ancestor(const std::unordered_map<graph::Vertex, graph::Vertex>& tree, graph::Vertex start) const;
34
35public:
37
38 std::string name() const override {
39 return "ControlFlowAnalysis";
40 }
41
42 void run(analysis::AnalysisManager& analysis_manager) override;
43
44 std::unordered_set<structured_control_flow::ControlFlowNode*> exits() const;
45
46 const std::unordered_map<structured_control_flow::ControlFlowNode*, structured_control_flow::ControlFlowNode*>&
47 dom_tree() const;
48
49 const std::unordered_map<structured_control_flow::ControlFlowNode*, structured_control_flow::ControlFlowNode*>&
50 pdom_tree() const;
51
53
55};
56
57} // namespace analysis
58} // namespace sdfg
Definition structured_sdfg.h:30
Definition analysis.h:53
Analysis(StructuredSDFG &sdfg)
std::unordered_set< structured_control_flow::ControlFlowNode * > exits() const
ControlFlowAnalysis(StructuredSDFG &sdfg)
const std::unordered_map< structured_control_flow::ControlFlowNode *, structured_control_flow::ControlFlowNode * > & dom_tree() const
bool dominates(structured_control_flow::ControlFlowNode &a, structured_control_flow::ControlFlowNode &b) const
const std::unordered_map< structured_control_flow::ControlFlowNode *, structured_control_flow::ControlFlowNode * > & pdom_tree() const
bool post_dominates(structured_control_flow::ControlFlowNode &a, structured_control_flow::ControlFlowNode &b) const
void run(analysis::AnalysisManager &analysis_manager) override
std::string name() const override
Definition control_flow_analysis.h:38
friend class AnalysisManager
Definition control_flow_analysis.h:16
Base class for all structured control flow nodes in a StructuredSDFG.
Definition control_flow_node.h:44
Definition analysis.h:8
boost::graph_traits< Graph >::vertex_descriptor Vertex
Definition graph.h:25
boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS > Graph
Definition graph.h:24
Definition analysis.h:7