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

daisytuner / sdfglib / 15133758385

20 May 2025 09:19AM UTC coverage: 60.543% (-3.0%) from 63.542%
15133758385

push

github

web-flow
Merge pull request #22 from daisytuner/normalization

Removes normalization passes

7922 of 13085 relevant lines covered (60.54%)

104.24 hits per line

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

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

3
namespace sdfg {
4
namespace visitor {
5

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

10
bool StructuredSDFGVisitor::visit() {
13✔
11
    if (this->accept(builder_.subject().root(), builder_.subject().root())) {
13✔
12
        return true;
2✔
13
    }
14
    return this->visit(builder_.subject().root());
11✔
15
}
13✔
16

17
bool StructuredSDFGVisitor::visit(structured_control_flow::Sequence& parent) {
17✔
18
    std::list<structured_control_flow::ControlFlowNode*> queue;
17✔
19
    for (size_t i = 0; i < parent.size(); i++) {
38✔
20
        queue.push_back(&parent.at(i).first);
21✔
21
    }
21✔
22
    while (!queue.empty()) {
28✔
23
        auto current = queue.front();
21✔
24
        queue.pop_front();
21✔
25

26
        if (auto block_stmt = dynamic_cast<structured_control_flow::Block*>(current)) {
21✔
27
            if (this->accept(parent, *block_stmt)) {
4✔
28
                return true;
1✔
29
            }
30
        } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(current)) {
20✔
31
            if (this->accept(parent, *sequence_stmt)) {
1✔
32
                return true;
×
33
            }
34

35
            if (this->visit(*sequence_stmt)) {
1✔
36
                return true;
×
37
            }
38
        } else if (auto return_stmt = dynamic_cast<structured_control_flow::Return*>(current)) {
17✔
39
            if (this->accept(parent, *return_stmt)) {
2✔
40
                return true;
1✔
41
            }
42
        } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(current)) {
15✔
43
            if (this->accept(parent, *if_else_stmt)) {
2✔
44
                return true;
1✔
45
            }
46

47
            for (size_t i = 0; i < if_else_stmt->size(); i++) {
1✔
48
                if (this->visit(if_else_stmt->at(i).first)) {
×
49
                    return true;
×
50
                }
51
            }
×
52
        } else if (auto for_stmt = dynamic_cast<structured_control_flow::For*>(current)) {
13✔
53
            if (this->accept(parent, *for_stmt)) {
2✔
54
                return true;
1✔
55
            }
56

57
            if (this->visit(for_stmt->root())) {
1✔
58
                return true;
×
59
            }
60
        } else if (auto while_stmt = dynamic_cast<structured_control_flow::While*>(current)) {
11✔
61
            if (this->accept(parent, *while_stmt)) {
4✔
62
                return true;
1✔
63
            }
64

65
            if (this->visit(while_stmt->root())) {
3✔
66
                return true;
2✔
67
            }
68
        } else if (auto continue_stmt = dynamic_cast<structured_control_flow::Continue*>(current)) {
7✔
69
            if (this->accept(parent, *continue_stmt)) {
2✔
70
                return true;
1✔
71
            }
72
        } else if (auto break_stmt = dynamic_cast<structured_control_flow::Break*>(current)) {
5✔
73
            if (this->accept(parent, *break_stmt)) {
2✔
74
                return true;
1✔
75
            }
76
        } else if (auto kern_stmt = dynamic_cast<structured_control_flow::Kernel*>(current)) {
3✔
77
            if (this->accept(parent, *kern_stmt)) {
2✔
78
                return true;
1✔
79
            }
80

81
            if (this->visit(kern_stmt->root())) {
1✔
82
                return true;
×
83
            }
84
        }
1✔
85
    }
86

87
    return false;
7✔
88
};
17✔
89

90
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& parent,
3✔
91
                                   structured_control_flow::Block& node) {
92
    return false;
3✔
93
};
94

95
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& parent,
2✔
96
                                   structured_control_flow::Sequence& node) {
97
    return false;
2✔
98
};
99

100
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& parent,
1✔
101
                                   structured_control_flow::Return& node) {
102
    return false;
1✔
103
};
104

105
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& parent,
1✔
106
                                   structured_control_flow::IfElse& node) {
107
    return false;
1✔
108
};
109

110
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& parent,
1✔
111
                                   structured_control_flow::While& node) {
112
    return false;
1✔
113
};
114

115
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& parent,
1✔
116
                                   structured_control_flow::Continue& node) {
117
    return false;
1✔
118
};
119

120
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& parent,
1✔
121
                                   structured_control_flow::Break& node) {
122
    return false;
1✔
123
};
124

125
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& parent,
1✔
126
                                   structured_control_flow::For& node) {
127
    return false;
1✔
128
};
129

130
bool StructuredSDFGVisitor::accept(structured_control_flow::Sequence& parent,
1✔
131
                                   structured_control_flow::Kernel& node) {
132
    return false;
1✔
133
};
134

135
}  // namespace visitor
136
}  // 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