• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daisytuner / sdfglib / 15656007340

14 Jun 2025 08:51PM UTC coverage: 13.234% (-49.9%) from 63.144%
15656007340

Pull #76

github

web-flow
Merge 9586c8161 into 413c53212
Pull Request #76: New Loop Dependency Analysis

361 of 465 new or added lines in 7 files covered. (77.63%)

6215 existing lines in 110 files now uncovered.

1612 of 12181 relevant lines covered (13.23%)

13.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/sdfg.cpp
1
#include "sdfg/sdfg.h"
2

3
#include "sdfg/codegen/language_extensions/c_language_extension.h"
4
#include "sdfg/element.h"
5
#include "sdfg/symbolic/symbolic.h"
6

7
namespace sdfg {
8

UNCOV
9
SDFG::SDFG(const std::string& name, FunctionType type)
×
UNCOV
10
    : Function(name, type), start_state_(nullptr) {};
×
11

UNCOV
12
const DebugInfo SDFG::debug_info() const {
×
UNCOV
13
    DebugInfo info;
×
UNCOV
14
    for (auto& state : this->states()) {
×
15
        info = DebugInfo::merge(info, state.debug_info());
×
16
        for (auto& data_flow_node : state.dataflow().nodes()) {
×
17
            info = DebugInfo::merge(info, data_flow_node.debug_info());
×
18
        }
19
        for (auto& edge : state.dataflow().edges()) {
×
20
            info = DebugInfo::merge(info, edge.debug_info());
×
21
        }
22
    }
UNCOV
23
    for (auto& edges : this->edges()) {
×
24
        info = DebugInfo::merge(info, edges.debug_info());
×
25
    }
UNCOV
26
    return info;
×
UNCOV
27
};
×
28

UNCOV
29
size_t SDFG::in_degree(const control_flow::State& state) const {
×
UNCOV
30
    return boost::in_degree(state.vertex(), this->graph_);
×
31
};
32

UNCOV
33
size_t SDFG::out_degree(const control_flow::State& state) const {
×
UNCOV
34
    return boost::out_degree(state.vertex(), this->graph_);
×
35
};
36

UNCOV
37
bool SDFG::is_adjacent(const control_flow::State& src, const control_flow::State& dst) const {
×
UNCOV
38
    return boost::edge(src.vertex(), dst.vertex(), this->graph_).second;
×
39
};
40

UNCOV
41
const control_flow::InterstateEdge& SDFG::edge(const control_flow::State& src,
×
42
                                               const control_flow::State& dst) const {
UNCOV
43
    auto e = boost::edge(src.vertex(), dst.vertex(), this->graph_);
×
UNCOV
44
    if (!e.second) {
×
45
        throw InvalidSDFGException("Edge does not exist");
×
46
    }
UNCOV
47
    return *this->edges_.at(e.first);
×
48
};
×
49

UNCOV
50
const control_flow::State& SDFG::start_state() const {
×
UNCOV
51
    if (this->start_state_ == nullptr) {
×
52
        throw InvalidSDFGException("Start state not set");
×
53
    }
UNCOV
54
    return *this->start_state_;
×
55
};
×
56

UNCOV
57
std::unordered_map<const control_flow::State*, const control_flow::State*> SDFG::dominator_tree()
×
58
    const {
UNCOV
59
    auto dom_tree_ = graph::dominator_tree(this->graph_, this->start_state_->vertex());
×
60

UNCOV
61
    std::unordered_map<const control_flow::State*, const control_flow::State*> dom_tree;
×
UNCOV
62
    for (auto& entry : dom_tree_) {
×
UNCOV
63
        control_flow::State* first = this->states_.at(entry.first).get();
×
UNCOV
64
        control_flow::State* second = nullptr;
×
UNCOV
65
        if (entry.second != boost::graph_traits<graph::Graph>::null_vertex()) {
×
UNCOV
66
            second = this->states_.at(entry.second).get();
×
UNCOV
67
        }
×
UNCOV
68
        dom_tree.insert({first, second});
×
69
    }
70

UNCOV
71
    return dom_tree;
×
UNCOV
72
};
×
73

74
std::unordered_map<const control_flow::State*, const control_flow::State*>
UNCOV
75
SDFG::post_dominator_tree() const {
×
UNCOV
76
    auto terminal_state = this->terminal_states();
×
UNCOV
77
    if (std::distance(terminal_state.begin(), terminal_state.end()) != 1) {
×
78
        throw InvalidSDFGException("SDFG: Multiple terminal states");
×
79
    }
80

UNCOV
81
    auto pdom_tree_ = graph::post_dominator_tree(this->graph_, (*terminal_state.begin()).vertex());
×
82

UNCOV
83
    std::unordered_map<const control_flow::State*, const control_flow::State*> pdom_tree;
×
UNCOV
84
    for (auto& entry : pdom_tree_) {
×
UNCOV
85
        control_flow::State* first = this->states_.at(entry.first).get();
×
UNCOV
86
        control_flow::State* second = nullptr;
×
UNCOV
87
        if (entry.second != boost::graph_traits<graph::Graph>::null_vertex()) {
×
UNCOV
88
            second = this->states_.at(entry.second).get();
×
UNCOV
89
        }
×
UNCOV
90
        pdom_tree.insert({first, second});
×
91
    }
92

UNCOV
93
    return pdom_tree;
×
UNCOV
94
};
×
95

UNCOV
96
std::list<const control_flow::InterstateEdge*> SDFG::back_edges() const {
×
UNCOV
97
    std::list<const control_flow::InterstateEdge*> bedges;
×
UNCOV
98
    for (const auto& edge : graph::back_edges(this->graph_, this->start_state_->vertex())) {
×
UNCOV
99
        bedges.push_back(this->edges_.find(edge)->second.get());
×
100
    }
101

UNCOV
102
    return bedges;
×
UNCOV
103
};
×
104

UNCOV
105
std::list<std::list<const control_flow::InterstateEdge*>> SDFG::all_simple_paths(
×
106
    const control_flow::State& src, const control_flow::State& dst) const {
UNCOV
107
    std::list<std::list<const control_flow::InterstateEdge*>> all_paths;
×
108

109
    std::list<std::list<graph::Edge>> all_paths_raw =
UNCOV
110
        graph::all_simple_paths(this->graph_, src.vertex(), dst.vertex());
×
UNCOV
111
    for (auto& path_raw : all_paths_raw) {
×
UNCOV
112
        std::list<const control_flow::InterstateEdge*> path;
×
UNCOV
113
        for (auto& edge : path_raw) {
×
UNCOV
114
            path.push_back(this->edges_.find(edge)->second.get());
×
115
        }
UNCOV
116
        all_paths.push_back(path);
×
UNCOV
117
    }
×
118

UNCOV
119
    return all_paths;
×
UNCOV
120
};
×
121

122
}  // namespace sdfg
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc