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

daisytuner / sdfglib / 19143519527

06 Nov 2025 05:01PM UTC coverage: 61.911% (-0.2%) from 62.068%
19143519527

push

github

web-flow
Merge pull request #324 from daisytuner/stable-sdfg-registry

Stable sdfg registry

7 of 53 new or added lines in 3 files covered. (13.21%)

1 existing line in 1 file now uncovered.

10271 of 16590 relevant lines covered (61.91%)

101.5 hits per line

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

51.09
/src/visitor/structured_sdfg_visitor.cpp
1
#include "sdfg/visitor/structured_sdfg_visitor.h"
2

3
namespace sdfg {
4
namespace visitor {
5

6
StructuredSDFGVisitor::
7
    StructuredSDFGVisitor(builder::StructuredSDFGBuilder& builder, analysis::AnalysisManager& analysis_manager)
43✔
8
    : builder_(builder), analysis_manager_(analysis_manager) {}
43✔
9

10
bool StructuredSDFGVisitor::visit() { return this->visit_internal(builder_.subject().root()); }
23✔
11

12
bool StructuredSDFGVisitor::visit_internal(structured_control_flow::Sequence& parent) {
33✔
13
    if (this->accept(parent)) {
33✔
14
        return true;
4✔
15
    }
16

17
    for (size_t i = 0; i < parent.size(); i++) {
43✔
18
        auto& current = parent.at(i).first;
34✔
19

20
        if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(&current)) {
34✔
21
            if (this->accept(*block_stmt)) {
5✔
22
                return true;
1✔
23
            }
24
        } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(&current)) {
33✔
25
            if (this->visit_internal(*sequence_stmt)) {
2✔
26
                return true;
1✔
27
            }
28
        } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&current)) {
28✔
29
            if (this->accept(*if_else_stmt)) {
3✔
30
                return true;
1✔
31
            }
32

33
            for (size_t i = 0; i < if_else_stmt->size(); i++) {
3✔
34
                if (this->visit_internal(if_else_stmt->at(i).first)) {
1✔
35
                    return true;
×
36
                }
37
            }
1✔
38
        } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(&current)) {
26✔
39
            if (this->accept(*for_stmt)) {
12✔
40
                return true;
9✔
41
            }
42

43
            if (this->visit_internal(for_stmt->root())) {
3✔
44
                return true;
×
45
            }
46
        } else if (auto map_stmt = dynamic_cast<structured_control_flow::Map*>(&current)) {
15✔
47
            if (this->accept(*map_stmt)) {
2✔
48
                return true;
1✔
49
            }
50

51
            if (this->visit_internal(map_stmt->root())) {
1✔
52
                return true;
1✔
53
            }
54
        } else if (auto while_stmt = dynamic_cast<structured_control_flow::While*>(&current)) {
10✔
55
            if (this->accept(*while_stmt)) {
4✔
56
                return true;
1✔
57
            }
58

59
            if (this->visit_internal(while_stmt->root())) {
3✔
60
                return true;
2✔
61
            }
62
        } else if (auto continue_stmt = dynamic_cast<structured_control_flow::Continue*>(&current)) {
7✔
63
            if (this->accept(*continue_stmt)) {
2✔
64
                return true;
1✔
65
            }
66
        } else if (auto break_stmt = dynamic_cast<structured_control_flow::Break*>(&current)) {
5✔
67
            if (this->accept(*break_stmt)) {
2✔
68
                return true;
1✔
69
            }
70
        } else if (auto return_stmt = dynamic_cast<structured_control_flow::Return*>(&current)) {
3✔
71
            if (this->accept(*return_stmt)) {
2✔
72
                return true;
1✔
73
            }
74
        }
1✔
75
    }
14✔
76

77
    return false;
9✔
78
};
33✔
79

80
bool StructuredSDFGVisitor::accept(structured_control_flow::Block& node) { return false; };
15✔
81

82
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& node) { return false; };
28✔
83

84
bool StructuredSDFGVisitor::accept(structured_control_flow::Return& node) { return false; };
1✔
85

86
bool StructuredSDFGVisitor::accept(structured_control_flow::IfElse& node) { return false; };
2✔
87

88
bool StructuredSDFGVisitor::accept(structured_control_flow::While& node) { return false; };
1✔
89

90
bool StructuredSDFGVisitor::accept(structured_control_flow::Continue& node) { return false; };
1✔
91

92
bool StructuredSDFGVisitor::accept(structured_control_flow::Break& node) { return false; };
1✔
93

94
bool StructuredSDFGVisitor::accept(structured_control_flow::For& node) { return false; };
2✔
95

96
bool StructuredSDFGVisitor::accept(structured_control_flow::Map& node) { return false; };
1✔
97

98
NonStoppingStructuredSDFGVisitor::NonStoppingStructuredSDFGVisitor(
20✔
99
    builder::StructuredSDFGBuilder& builder, analysis::AnalysisManager& analysis_manager
100
)
101
    : StructuredSDFGVisitor(builder, analysis_manager), applied_(false) {}
20✔
102

103
bool NonStoppingStructuredSDFGVisitor::visit() {
20✔
104
    this->visit_internal(builder_.subject().root());
20✔
105
    return this->applied_;
20✔
106
}
107

108
bool NonStoppingStructuredSDFGVisitor::visit_internal(structured_control_flow::Sequence& parent) {
20✔
109
    applied_ |= this->accept(parent);
20✔
110

111
    for (size_t i = 0; i < parent.size(); i++) {
46✔
112
        auto& current = parent.at(i).first;
26✔
113

114
        if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(&current)) {
26✔
115
            applied_ |= this->accept(*block_stmt);
26✔
116
        } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(&current)) {
26✔
117
            this->visit_internal(*sequence_stmt);
×
118
        } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&current)) {
×
119
            applied_ |= this->accept(*if_else_stmt);
×
120

121
            for (size_t i = 0; i < if_else_stmt->size(); i++) {
×
122
                this->visit_internal(if_else_stmt->at(i).first);
×
123
            }
×
124
        } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(&current)) {
×
125
            applied_ |= this->accept(*for_stmt);
×
126
            this->visit_internal(for_stmt->root());
×
127
        } else if (auto map_stmt = dynamic_cast<structured_control_flow::Map*>(&current)) {
×
128
            applied_ |= this->accept(*map_stmt);
×
129
            this->visit_internal(map_stmt->root());
×
130
        } else if (auto while_stmt = dynamic_cast<structured_control_flow::While*>(&current)) {
×
131
            applied_ |= this->accept(*while_stmt);
×
132
            this->visit_internal(while_stmt->root());
×
133
        } else if (auto continue_stmt = dynamic_cast<structured_control_flow::Continue*>(&current)) {
×
134
            applied_ |= this->accept(*continue_stmt);
×
135
        } else if (auto break_stmt = dynamic_cast<structured_control_flow::Break*>(&current)) {
×
136
            applied_ |= this->accept(*break_stmt);
×
137
        } else if (auto return_stmt = dynamic_cast<structured_control_flow::Return*>(&current)) {
×
138
            applied_ |= this->accept(*return_stmt);
×
139
        }
×
140
    }
26✔
141

142
    return false;
20✔
143
};
×
144

NEW
145
bool ActualStructuredSDFGVisitor::visit(sdfg::structured_control_flow::ControlFlowNode& node) { return dispatch(node); }
×
146

NEW
147
bool ActualStructuredSDFGVisitor::dispatch(ControlFlowNode& node) {
×
148
    //// ARGH. The most inefficient variant of them all. Is there a good way to
NEW
149
    if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(&node)) {
×
NEW
150
        return this->visit(*block_stmt);
×
NEW
151
    } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(&node)) {
×
NEW
152
        return this->visit(*sequence_stmt);
×
NEW
153
    } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&node)) {
×
NEW
154
        return this->visit(*if_else_stmt);
×
NEW
155
    } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(&node)) {
×
NEW
156
        return this->visit(*for_stmt);
×
NEW
157
    } else if (auto map_stmt = dynamic_cast<structured_control_flow::Map*>(&node)) {
×
NEW
158
        return this->visit(*map_stmt);
×
NEW
159
    } else if (auto while_stmt = dynamic_cast<structured_control_flow::While*>(&node)) {
×
NEW
160
        return this->visit(*while_stmt);
×
NEW
161
    } else if (auto continue_stmt = dynamic_cast<structured_control_flow::Continue*>(&node)) {
×
NEW
162
        return this->visit(*continue_stmt);
×
NEW
163
    } else if (auto break_stmt = dynamic_cast<structured_control_flow::Break*>(&node)) {
×
NEW
164
        return this->visit(*break_stmt);
×
NEW
165
    } else if (auto return_stmt = dynamic_cast<structured_control_flow::Return*>(&node)) {
×
NEW
166
        return this->visit(*return_stmt);
×
167
    }
168

NEW
169
    return false;
×
NEW
170
}
×
171

172

NEW
173
ActualStructuredSDFGVisitor::ActualStructuredSDFGVisitor() {}
×
174

NEW
175
bool ActualStructuredSDFGVisitor::visit(Block& node) { return false; }
×
NEW
176
bool ActualStructuredSDFGVisitor::visit(Sequence& node) {
×
NEW
177
    for (int i = 0; i < node.size(); ++i) {
×
NEW
178
        visit(node.at(i).first);
×
NEW
179
    }
×
180

NEW
181
    return true;
×
182
}
NEW
183
bool ActualStructuredSDFGVisitor::visit(Return& node) { return false; }
×
NEW
184
bool ActualStructuredSDFGVisitor::visit(IfElse& node) {
×
NEW
185
    for (int i = 0; i < node.size(); ++i) {
×
NEW
186
        visit(node.at(i).first);
×
NEW
187
    }
×
188

NEW
189
    return true;
×
NEW
190
}
×
NEW
191
bool ActualStructuredSDFGVisitor::visit(For& node) { return handleStructuredLoop(node); }
×
NEW
192
bool ActualStructuredSDFGVisitor::visit(Map& node) { return handleStructuredLoop(node); }
×
NEW
193
bool ActualStructuredSDFGVisitor::handleStructuredLoop(StructuredLoop& loop) { return visit(loop.root()); }
×
NEW
194
bool ActualStructuredSDFGVisitor::visit(While& node) { return visit(node.root()); }
×
NEW
195
bool ActualStructuredSDFGVisitor::visit(Continue& node) { return false; }
×
NEW
196
bool ActualStructuredSDFGVisitor::visit(Break& node) { return false; }
×
197
} // namespace visitor
198
} // 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

© 2025 Coveralls, Inc