• 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

5.21
/src/structured_sdfg.cpp
1
#include "sdfg/structured_sdfg.h"
2

3
#include "sdfg/builder/structured_sdfg_builder.h"
4
#include "sdfg/data_flow/access_node.h"
5
#include "sdfg/data_flow/tasklet.h"
6
#include "sdfg/deepcopy/structured_sdfg_deep_copy.h"
7
#include "sdfg/element.h"
8

9
namespace sdfg {
10

11
StructuredSDFG::StructuredSDFG(const std::string& name, FunctionType type) : Function(name, type) {
17✔
12
    this->root_ = std::unique_ptr<structured_control_flow::Sequence>(
17✔
13
        new structured_control_flow::Sequence(DebugInfo()));
17✔
14
};
17✔
15

16
const structured_control_flow::Sequence& StructuredSDFG::root() const { return *this->root_; };
×
17

18
structured_control_flow::Sequence& StructuredSDFG::root() { return *this->root_; };
510✔
19

UNCOV
20
std::unique_ptr<StructuredSDFG> StructuredSDFG::clone() const {
×
UNCOV
21
    builder::StructuredSDFGBuilder builder(this->name_, this->type_);
×
UNCOV
22
    auto& new_sdfg = builder.subject();
×
23

UNCOV
24
    for (auto& structure : this->structures_) {
×
UNCOV
25
        new_sdfg.structures_.insert({structure.first, structure.second->clone()});
×
26
    }
27

UNCOV
28
    for (auto& container : this->containers_) {
×
UNCOV
29
        new_sdfg.containers_.insert({container.first, container.second->clone()});
×
30
    }
31

UNCOV
32
    for (auto& arg : this->arguments_) {
×
UNCOV
33
        new_sdfg.arguments_.push_back(arg);
×
34
    }
35

UNCOV
36
    for (auto& ext : this->externals_) {
×
UNCOV
37
        new_sdfg.externals_.push_back(ext);
×
38
    }
39

UNCOV
40
    for (auto& entry : this->metadata_) {
×
41
        new_sdfg.metadata_[entry.first] = entry.second;
×
42
    }
43

UNCOV
44
    for (auto& assumption : this->assumptions_) {
×
UNCOV
45
        new_sdfg.assumptions_.insert({assumption.first, assumption.second});
×
46
    }
47

UNCOV
48
    deepcopy::StructuredSDFGDeepCopy copier(builder, new_sdfg.root(), *this->root_);
×
UNCOV
49
    auto mapping = copier.insert();
×
50

UNCOV
51
    return builder.move();
×
UNCOV
52
};
×
53

54
size_t StructuredSDFG::num_nodes() const {
×
55
    size_t count = 0;
×
56
    std::set<const ControlFlowNode*> to_visit = {&this->root()};
×
57
    while (!to_visit.empty()) {
×
58
        auto current = *to_visit.begin();
×
59
        to_visit.erase(to_visit.begin());
×
60
        // if instance of block, add children to to_visit
61
        if (auto block = dynamic_cast<const structured_control_flow::Block*>(current)) {
×
62
            count += block->dataflow().nodes().size();
×
63
        } else if (auto sloop_node =
×
64
                       dynamic_cast<const structured_control_flow::StructuredLoop*>(current)) {
×
65
            to_visit.insert(&sloop_node->root());
×
66
        } else if (auto condition_node =
×
67
                       dynamic_cast<const structured_control_flow::IfElse*>(current)) {
×
68
            for (size_t i = 0; i < condition_node->size(); i++) {
×
69
                to_visit.insert(&condition_node->at(i).first);
×
70
            }
×
71
        } else if (auto while_node = dynamic_cast<const structured_control_flow::While*>(current)) {
×
72
            to_visit.insert(&while_node->root());
×
73
        } else if (auto sequence_node =
×
74
                       dynamic_cast<const structured_control_flow::Sequence*>(current)) {
×
75
            for (size_t i = 0; i < sequence_node->size(); i++) {
×
76
                to_visit.insert(&sequence_node->at(i).first);
×
77
            }
×
78
        } else if (dynamic_cast<const structured_control_flow::Return*>(current)) {
×
79
            continue;
×
80
        } else if (auto map_node = dynamic_cast<const structured_control_flow::Map*>(current)) {
×
81
            to_visit.insert(&map_node->root());
×
82
        }
×
83
    }
84
    return count;
×
85
};
×
86

87
const DebugInfo StructuredSDFG::debug_info() const {
×
88
    DebugInfo info;
×
89
    std::set<const ControlFlowNode*> to_visit = {&this->root()};
×
90
    while (!to_visit.empty()) {
×
91
        auto current = *to_visit.begin();
×
92
        to_visit.erase(to_visit.begin());
×
93
        info = DebugInfo::merge(info, current->debug_info());
×
94

95
        // if instance of block, add children to to_visit
96
        if (auto block = dynamic_cast<const structured_control_flow::Block*>(current)) {
×
97
            for (auto& node : block->dataflow().nodes()) {
×
98
                info = DebugInfo::merge(info, node.debug_info());
×
99
            }
100
            for (auto& edge : block->dataflow().edges()) {
×
101
                info = DebugInfo::merge(info, edge.debug_info());
×
102
            }
103
        } else if (auto sloop_node =
×
104
                       dynamic_cast<const structured_control_flow::StructuredLoop*>(current)) {
×
105
            info = DebugInfo::merge(info, sloop_node->debug_info());
×
106
            to_visit.insert(&sloop_node->root());
×
107
        } else if (auto condition_node =
×
108
                       dynamic_cast<const structured_control_flow::IfElse*>(current)) {
×
109
            info = DebugInfo::merge(info, condition_node->debug_info());
×
110
            for (size_t i = 0; i < condition_node->size(); i++) {
×
111
                to_visit.insert(&condition_node->at(i).first);
×
112
            }
×
113
        } else if (auto while_node = dynamic_cast<const structured_control_flow::While*>(current)) {
×
114
            info = DebugInfo::merge(info, while_node->debug_info());
×
115
            to_visit.insert(&while_node->root());
×
116
        } else if (auto sequence_node =
×
117
                       dynamic_cast<const structured_control_flow::Sequence*>(current)) {
×
118
            info = DebugInfo::merge(info, sequence_node->debug_info());
×
119
            for (size_t i = 0; i < sequence_node->size(); i++) {
×
120
                to_visit.insert(&sequence_node->at(i).first);
×
121
                info = DebugInfo::merge(info, sequence_node->at(i).second.debug_info());
×
122
            }
×
123
        } else if (auto return_node =
×
124
                       dynamic_cast<const structured_control_flow::Return*>(current)) {
×
125
            info = DebugInfo::merge(info, return_node->debug_info());
×
126
        } else if (auto map_node = dynamic_cast<const structured_control_flow::Map*>(current)) {
×
127
            info = DebugInfo::merge(info, map_node->debug_info());
×
128
            to_visit.insert(&map_node->root());
×
129
        }
×
130
    }
131
    return info;
×
132
};
×
133

134
}  // 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