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

daisytuner / sdfglib / 20764569418

06 Jan 2026 10:50PM UTC coverage: 62.168% (+21.4%) from 40.764%
20764569418

push

github

web-flow
Merge pull request #433 from daisytuner/clang-coverage

updates clang coverage flags

14988 of 24109 relevant lines covered (62.17%)

88.57 hits per line

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

70.05
/src/data_flow/tasklet.cpp
1
#include "sdfg/data_flow/tasklet.h"
2

3
#include "sdfg/data_flow/data_flow_graph.h"
4
#include "sdfg/symbolic/symbolic.h"
5

6
namespace sdfg {
7
namespace data_flow {
8

9
Tasklet::Tasklet(
10
    size_t element_id,
11
    const DebugInfo& debug_info,
12
    const graph::Vertex vertex,
13
    DataFlowGraph& parent,
14
    const TaskletCode code,
15
    const std::string& output,
16
    const std::vector<std::string>& inputs
17
)
18
    : CodeNode(element_id, debug_info, vertex, parent, {output}, inputs), code_(code) {};
534✔
19

20
void Tasklet::validate(const Function& function) const {
272✔
21
    auto& graph = this->get_parent();
272✔
22

23
    // Validate: inputs match arity
24
    if (arity(this->code_) != this->inputs_.size()) {
272✔
25
        throw InvalidSDFGException(
×
26
            "Tasklet (Code: " + std::to_string(this->code_) + "): Invalid number of inputs. Expected " +
×
27
            std::to_string(arity(this->code_)) + ", got " + std::to_string(this->inputs_.size())
×
28
        );
×
29
    }
×
30

31
    // Validate: inputs match type of operation
32
    for (auto& iedge : graph.in_edges(*this)) {
405✔
33
        auto& input_type = iedge.result_type(function);
405✔
34
        if (is_integer(this->code_) && !types::is_integer(input_type.primitive_type())) {
405✔
35
            throw InvalidSDFGException(
×
36
                "Tasklet (Code: " + std::to_string(this->code_) + "): Integer operation with non-integer input type"
×
37
            );
×
38
        }
×
39
        if (is_floating_point(this->code_) && !types::is_floating_point(input_type.primitive_type())) {
405✔
40
            throw InvalidSDFGException(
×
41
                "Tasklet (Code: " + std::to_string(this->code_) + "): Floating point operation with integer input type"
×
42
            );
×
43
        }
×
44
    }
405✔
45

46
    // Validate: Graph - No two access nodes for same data
47
    std::unordered_map<std::string, const AccessNode*> input_names;
272✔
48
    for (auto& iedge : graph.in_edges(*this)) {
405✔
49
        if (dynamic_cast<const ConstantNode*>(&iedge.src()) != nullptr) {
405✔
50
            continue;
104✔
51
        }
104✔
52
        auto& src = static_cast<const AccessNode&>(iedge.src());
301✔
53
        if (input_names.find(src.data()) != input_names.end()) {
301✔
54
            if (input_names.at(src.data()) != &src) {
4✔
55
                throw InvalidSDFGException(
×
56
                    "Tasklet (Code: " + std::to_string(this->code_) +
×
57
                    "): Two access nodes with the same data as iedge: " + src.data()
×
58
                );
×
59
            }
×
60
        } else {
297✔
61
            input_names.insert({src.data(), &src});
297✔
62
        }
297✔
63
    }
301✔
64
}
272✔
65

66
TaskletCode Tasklet::code() const { return this->code_; };
335✔
67

68

69
bool Tasklet::is_assign() const { return this->code_ == TaskletCode::assign; }
54✔
70

71
bool Tasklet::is_trivial(const Function& function) const {
1✔
72
    if (!this->is_assign()) {
1✔
73
        return false;
×
74
    }
×
75

76
    auto& graph = this->get_parent();
1✔
77
    auto& iedge = *graph.in_edges(*this).begin();
1✔
78
    auto& oedge = *graph.out_edges(*this).begin();
1✔
79
    auto& input_type = iedge.result_type(function);
1✔
80
    auto& output_type = oedge.result_type(function);
1✔
81

82
    return input_type.primitive_type() == output_type.primitive_type();
1✔
83
}
1✔
84

85
bool Tasklet::is_cast(const Function& function) const {
10✔
86
    if (!this->is_assign()) {
10✔
87
        return false;
×
88
    }
×
89

90
    auto& graph = this->get_parent();
10✔
91
    auto& iedge = *graph.in_edges(*this).begin();
10✔
92
    auto& oedge = *graph.out_edges(*this).begin();
10✔
93
    auto& input_type = iedge.result_type(function);
10✔
94
    auto& output_type = oedge.result_type(function);
10✔
95

96
    return input_type.primitive_type() != output_type.primitive_type();
10✔
97
}
10✔
98

99
bool Tasklet::is_zext(const Function& function) const {
13✔
100
    if (!this->is_assign()) {
13✔
101
        return false;
×
102
    }
×
103

104
    auto& graph = this->get_parent();
13✔
105
    auto& iedge = *graph.in_edges(*this).begin();
13✔
106
    auto& oedge = *graph.out_edges(*this).begin();
13✔
107
    auto& input_type = iedge.result_type(function);
13✔
108
    auto& output_type = oedge.result_type(function);
13✔
109

110
    if (!types::is_unsigned(input_type.primitive_type()) || !types::is_unsigned(output_type.primitive_type())) {
13✔
111
        return false;
7✔
112
    }
7✔
113
    if (types::bit_width(output_type.primitive_type()) <= types::bit_width(input_type.primitive_type())) {
6✔
114
        return false;
3✔
115
    }
3✔
116

117
    return true;
3✔
118
}
6✔
119

120
bool Tasklet::is_sext(const Function& function) const {
1✔
121
    if (!this->is_assign()) {
1✔
122
        return false;
×
123
    }
×
124

125
    auto& graph = this->get_parent();
1✔
126
    auto& iedge = *graph.in_edges(*this).begin();
1✔
127
    auto& oedge = *graph.out_edges(*this).begin();
1✔
128
    auto& input_type = iedge.result_type(function);
1✔
129
    auto& output_type = oedge.result_type(function);
1✔
130

131
    if (types::is_unsigned(input_type.primitive_type()) || types::is_unsigned(output_type.primitive_type())) {
1✔
132
        return false;
×
133
    }
×
134
    if (types::bit_width(output_type.primitive_type()) <= types::bit_width(input_type.primitive_type())) {
1✔
135
        return false;
×
136
    }
×
137

138
    return true;
1✔
139
}
1✔
140

141
bool Tasklet::is_trunc(const Function& function) const {
13✔
142
    if (!this->is_assign()) {
13✔
143
        return false;
×
144
    }
×
145

146
    auto& graph = this->get_parent();
13✔
147
    auto& iedge = *graph.in_edges(*this).begin();
13✔
148
    auto& oedge = *graph.out_edges(*this).begin();
13✔
149
    auto& input_type = iedge.result_type(function);
13✔
150
    auto& output_type = oedge.result_type(function);
13✔
151

152
    if (!types::is_integer(input_type.primitive_type()) || !types::is_integer(output_type.primitive_type())) {
13✔
153
        return false;
1✔
154
    }
1✔
155
    if (types::is_unsigned(input_type.primitive_type()) != types::is_unsigned(output_type.primitive_type())) {
12✔
156
        return false;
2✔
157
    }
2✔
158
    if (types::bit_width(output_type.primitive_type()) >= types::bit_width(input_type.primitive_type())) {
10✔
159
        return false;
7✔
160
    }
7✔
161

162
    return true;
3✔
163
}
10✔
164

165
bool Tasklet::is_fptoui(const Function& function) const {
1✔
166
    if (!this->is_assign()) {
1✔
167
        return false;
×
168
    }
×
169

170
    auto& graph = this->get_parent();
1✔
171
    auto& iedge = *graph.in_edges(*this).begin();
1✔
172
    auto& oedge = *graph.out_edges(*this).begin();
1✔
173
    auto& input_type = iedge.result_type(function);
1✔
174
    auto& output_type = oedge.result_type(function);
1✔
175

176
    if (!types::is_floating_point(input_type.primitive_type()) || !types::is_unsigned(output_type.primitive_type())) {
1✔
177
        return false;
×
178
    }
×
179

180
    return true;
1✔
181
}
1✔
182

183
bool Tasklet::is_fptosi(const Function& function) const {
1✔
184
    if (!this->is_assign()) {
1✔
185
        return false;
×
186
    }
×
187

188
    auto& graph = this->get_parent();
1✔
189
    auto& iedge = *graph.in_edges(*this).begin();
1✔
190
    auto& oedge = *graph.out_edges(*this).begin();
1✔
191
    auto& input_type = iedge.result_type(function);
1✔
192
    auto& output_type = oedge.result_type(function);
1✔
193

194
    if (!types::is_floating_point(input_type.primitive_type()) || !types::is_signed(output_type.primitive_type())) {
1✔
195
        return false;
×
196
    }
×
197

198
    return true;
1✔
199
}
1✔
200

201
bool Tasklet::is_uitofp(const Function& function) const {
1✔
202
    if (!this->is_assign()) {
1✔
203
        return false;
×
204
    }
×
205

206
    auto& graph = this->get_parent();
1✔
207
    auto& iedge = *graph.in_edges(*this).begin();
1✔
208
    auto& oedge = *graph.out_edges(*this).begin();
1✔
209
    auto& input_type = iedge.result_type(function);
1✔
210
    auto& output_type = oedge.result_type(function);
1✔
211

212
    if (!types::is_unsigned(input_type.primitive_type()) || !types::is_floating_point(output_type.primitive_type())) {
1✔
213
        return false;
×
214
    }
×
215

216
    return true;
1✔
217
}
1✔
218

219
bool Tasklet::is_sitofp(const Function& function) const {
1✔
220
    if (!this->is_assign()) {
1✔
221
        return false;
×
222
    }
×
223

224
    auto& graph = this->get_parent();
1✔
225
    auto& iedge = *graph.in_edges(*this).begin();
1✔
226
    auto& oedge = *graph.out_edges(*this).begin();
1✔
227
    auto& input_type = iedge.result_type(function);
1✔
228
    auto& output_type = oedge.result_type(function);
1✔
229

230
    if (!types::is_signed(input_type.primitive_type()) || !types::is_floating_point(output_type.primitive_type())) {
1✔
231
        return false;
×
232
    }
×
233

234
    return true;
1✔
235
}
1✔
236

237
bool Tasklet::is_fpext(const Function& function) const {
1✔
238
    if (!this->is_assign()) {
1✔
239
        return false;
×
240
    }
×
241

242
    auto& graph = this->get_parent();
1✔
243
    auto& iedge = *graph.in_edges(*this).begin();
1✔
244
    auto& oedge = *graph.out_edges(*this).begin();
1✔
245
    auto& input_type = iedge.result_type(function);
1✔
246
    auto& output_type = oedge.result_type(function);
1✔
247

248
    if (!types::is_floating_point(input_type.primitive_type()) ||
1✔
249
        !types::is_floating_point(output_type.primitive_type())) {
1✔
250
        return false;
×
251
    }
×
252
    if (types::bit_width(output_type.primitive_type()) <= types::bit_width(input_type.primitive_type())) {
1✔
253
        return false;
×
254
    }
×
255

256
    return true;
1✔
257
}
1✔
258

259
bool Tasklet::is_fptrunc(const Function& function) const {
1✔
260
    if (!this->is_assign()) {
1✔
261
        return false;
×
262
    }
×
263

264
    auto& graph = this->get_parent();
1✔
265
    auto& iedge = *graph.in_edges(*this).begin();
1✔
266
    auto& oedge = *graph.out_edges(*this).begin();
1✔
267
    auto& input_type = iedge.result_type(function);
1✔
268
    auto& output_type = oedge.result_type(function);
1✔
269

270
    if (!types::is_floating_point(input_type.primitive_type()) ||
1✔
271
        !types::is_floating_point(output_type.primitive_type())) {
1✔
272
        return false;
×
273
    }
×
274
    if (types::bit_width(output_type.primitive_type()) >= types::bit_width(input_type.primitive_type())) {
1✔
275
        return false;
×
276
    }
×
277

278
    return true;
1✔
279
}
1✔
280

281
const std::string& Tasklet::output() const { return this->outputs_[0]; };
54✔
282

283
std::unique_ptr<DataFlowNode> Tasklet::clone(size_t element_id, const graph::Vertex vertex, DataFlowGraph& parent)
284
    const {
×
285
    return std::unique_ptr<Tasklet>(
×
286
        new Tasklet(element_id, this->debug_info_, vertex, parent, this->code_, this->outputs_.at(0), this->inputs_)
×
287
    );
×
288
};
×
289

290
void Tasklet::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {};
2✔
291

292
} // namespace data_flow
293
} // 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