• 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/deepcopy/structured_sdfg_deep_copy.cpp
1
#include "sdfg/deepcopy/structured_sdfg_deep_copy.h"
2

3
#include "sdfg/element.h"
4

5
namespace sdfg {
6
namespace deepcopy {
7

UNCOV
8
void StructuredSDFGDeepCopy::append(structured_control_flow::Sequence& root,
×
9
                                    structured_control_flow::Sequence& source) {
UNCOV
10
    for (size_t i = 0; i < source.size(); i++) {
×
UNCOV
11
        auto child = source.at(i);
×
UNCOV
12
        auto& node = child.first;
×
UNCOV
13
        auto& trans = child.second;
×
14

UNCOV
15
        if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(&node)) {
×
UNCOV
16
            auto& block = this->builder_.add_block(root, block_stmt->dataflow(),
×
UNCOV
17
                                                   trans.assignments(), block_stmt->debug_info());
×
UNCOV
18
            this->node_mapping[block_stmt] = &block;
×
UNCOV
19
        } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(&node)) {
×
UNCOV
20
            auto& new_seq =
×
UNCOV
21
                this->builder_.add_sequence(root, trans.assignments(), sequence_stmt->debug_info());
×
UNCOV
22
            this->node_mapping[sequence_stmt] = &new_seq;
×
UNCOV
23
            this->append(new_seq, *sequence_stmt);
×
UNCOV
24
        } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&node)) {
×
UNCOV
25
            auto& new_scope =
×
UNCOV
26
                this->builder_.add_if_else(root, trans.assignments(), if_else_stmt->debug_info());
×
UNCOV
27
            this->node_mapping[if_else_stmt] = &new_scope;
×
UNCOV
28
            for (size_t i = 0; i < if_else_stmt->size(); i++) {
×
UNCOV
29
                auto branch = if_else_stmt->at(i);
×
UNCOV
30
                auto& new_branch =
×
UNCOV
31
                    this->builder_.add_case(new_scope, branch.second, branch.first.debug_info());
×
UNCOV
32
                this->node_mapping[&branch.first] = &new_branch;
×
UNCOV
33
                this->append(new_branch, branch.first);
×
UNCOV
34
            }
×
UNCOV
35
        } else if (auto loop_stmt = dynamic_cast<structured_control_flow::While*>(&node)) {
×
UNCOV
36
            auto& new_scope =
×
UNCOV
37
                this->builder_.add_while(root, trans.assignments(), loop_stmt->debug_info());
×
UNCOV
38
            this->node_mapping[loop_stmt] = &new_scope;
×
UNCOV
39
            this->append(new_scope.root(), loop_stmt->root());
×
UNCOV
40
        } else if (auto cont_stmt = dynamic_cast<structured_control_flow::Continue*>(&node)) {
×
UNCOV
41
            auto& new_cont =
×
UNCOV
42
                this->builder_.add_continue(root, trans.assignments(), cont_stmt->debug_info());
×
UNCOV
43
            this->node_mapping[cont_stmt] = &new_cont;
×
UNCOV
44
        } else if (auto br_stmt = dynamic_cast<structured_control_flow::Break*>(&node)) {
×
UNCOV
45
            auto& new_br =
×
UNCOV
46
                this->builder_.add_break(root, trans.assignments(), br_stmt->debug_info());
×
UNCOV
47
            this->node_mapping[br_stmt] = &new_br;
×
UNCOV
48
        } else if (auto ret_stmt = dynamic_cast<structured_control_flow::Return*>(&node)) {
×
UNCOV
49
            auto& new_ret =
×
UNCOV
50
                this->builder_.add_return(root, trans.assignments(), ret_stmt->debug_info());
×
UNCOV
51
            this->node_mapping[ret_stmt] = &new_ret;
×
UNCOV
52
        } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(&node)) {
×
UNCOV
53
            auto& new_scope = this->builder_.add_for(
×
UNCOV
54
                root, for_stmt->indvar(), for_stmt->condition(), for_stmt->init(),
×
UNCOV
55
                for_stmt->update(), trans.assignments(), for_stmt->debug_info());
×
UNCOV
56
            this->node_mapping[for_stmt] = &new_scope;
×
UNCOV
57
            this->append(new_scope.root(), for_stmt->root());
×
UNCOV
58
        } else if (auto map_stmt = dynamic_cast<structured_control_flow::Map*>(&node)) {
×
UNCOV
59
            auto& new_scope = this->builder_.add_map(
×
UNCOV
60
                root, map_stmt->indvar(), map_stmt->num_iterations(), map_stmt->schedule_type(),
×
UNCOV
61
                trans.assignments(), map_stmt->debug_info());
×
UNCOV
62
            this->node_mapping[map_stmt] = &new_scope;
×
UNCOV
63
            this->append(new_scope.root(), map_stmt->root());
×
UNCOV
64
        } else {
×
65
            throw std::runtime_error("Deep copy not implemented");
×
66
        }
UNCOV
67
    }
×
UNCOV
68
};
×
69

UNCOV
70
void StructuredSDFGDeepCopy::insert(structured_control_flow::Sequence& root,
×
71
                                    structured_control_flow::ControlFlowNode& source) {
UNCOV
72
    if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(&source)) {
×
73
        auto& block =
×
74
            this->builder_.add_block(root, block_stmt->dataflow(), {}, block_stmt->debug_info());
×
75
        this->node_mapping[block_stmt] = &block;
×
UNCOV
76
    } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(&source)) {
×
UNCOV
77
        auto& new_seq = this->builder_.add_sequence(root, {}, sequence_stmt->debug_info());
×
UNCOV
78
        this->node_mapping[sequence_stmt] = &new_seq;
×
UNCOV
79
        this->append(new_seq, *sequence_stmt);
×
UNCOV
80
    } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&source)) {
×
81
        auto& new_scope = this->builder_.add_if_else(root);
×
82
        this->node_mapping[if_else_stmt] = &new_scope;
×
83
        for (size_t i = 0; i < if_else_stmt->size(); i++) {
×
84
            auto branch = if_else_stmt->at(i);
×
85
            auto& new_branch =
×
86
                this->builder_.add_case(new_scope, branch.second, branch.first.debug_info());
×
87
            this->node_mapping[&branch.first] = &new_branch;
×
88
            this->append(new_branch, branch.first);
×
89
        }
×
90
    } else if (auto loop_stmt = dynamic_cast<structured_control_flow::While*>(&source)) {
×
91
        auto& new_scope = this->builder_.add_while(root, {}, loop_stmt->debug_info());
×
92
        this->node_mapping[loop_stmt] = &new_scope;
×
93
        this->append(new_scope.root(), loop_stmt->root());
×
94
    } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(&source)) {
×
95
        auto& new_scope = this->builder_.add_for(root, for_stmt->indvar(), for_stmt->condition(),
×
96
                                                 for_stmt->init(), for_stmt->update(), {},
×
97
                                                 for_stmt->debug_info());
×
98
        this->node_mapping[for_stmt] = &new_scope;
×
99
        this->append(new_scope.root(), for_stmt->root());
×
100
    } else if (auto cont_stmt = dynamic_cast<structured_control_flow::Continue*>(&source)) {
×
101
        auto& new_cont = this->builder_.add_continue(root, cont_stmt->debug_info());
×
102
        this->node_mapping[cont_stmt] = &new_cont;
×
103
    } else if (auto br_stmt = dynamic_cast<structured_control_flow::Break*>(&source)) {
×
104
        auto& new_br = this->builder_.add_break(root, br_stmt->debug_info());
×
105
        this->node_mapping[br_stmt] = &new_br;
×
106
    } else if (auto ret_stmt = dynamic_cast<structured_control_flow::Return*>(&source)) {
×
107
        auto& new_ret = this->builder_.add_return(root, {}, ret_stmt->debug_info());
×
108
        this->node_mapping[ret_stmt] = &new_ret;
×
109
    } else if (auto map_stmt = dynamic_cast<structured_control_flow::Map*>(&source)) {
×
110
        auto& new_scope =
×
111
            this->builder_.add_map(root, map_stmt->indvar(), map_stmt->num_iterations(),
×
112
                                   map_stmt->schedule_type(), {}, map_stmt->debug_info());
×
113
        this->node_mapping[map_stmt] = &new_scope;
×
114
        this->append(new_scope.root(), map_stmt->root());
×
115
    } else {
×
116
        throw std::runtime_error("Deep copy not implemented");
×
117
    }
UNCOV
118
};
×
119

UNCOV
120
StructuredSDFGDeepCopy::StructuredSDFGDeepCopy(builder::StructuredSDFGBuilder& builder,
×
121
                                               structured_control_flow::Sequence& root,
122
                                               structured_control_flow::ControlFlowNode& source)
UNCOV
123
    : builder_(builder), root_(root), source_(source) {};
×
124

125
std::unordered_map<const structured_control_flow::ControlFlowNode*,
126
                   const structured_control_flow::ControlFlowNode*>
UNCOV
127
StructuredSDFGDeepCopy::copy() {
×
UNCOV
128
    this->node_mapping.clear();
×
UNCOV
129
    this->insert(this->root_, this->source_);
×
UNCOV
130
    return this->node_mapping;
×
131
};
132

133
std::unordered_map<const structured_control_flow::ControlFlowNode*,
134
                   const structured_control_flow::ControlFlowNode*>
UNCOV
135
StructuredSDFGDeepCopy::insert() {
×
UNCOV
136
    if (auto seq_source = dynamic_cast<structured_control_flow::Sequence*>(&this->source_)) {
×
UNCOV
137
        this->node_mapping.clear();
×
UNCOV
138
        this->append(this->root_, *seq_source);
×
UNCOV
139
        return this->node_mapping;
×
140
    } else {
141
        throw std::runtime_error("Source node must be a sequence");
×
142
    }
143
};
×
144

145
}  // namespace deepcopy
146
}  // 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