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

daisytuner / sdfglib / 15142284085

20 May 2025 03:58PM UTC coverage: 60.528% (-0.02%) from 60.543%
15142284085

push

github

web-flow
Merge pull request #23 from daisytuner/loops

LoopTrees and Instrumentation Strategies

80 of 182 new or added lines in 17 files covered. (43.96%)

11 existing lines in 6 files now uncovered.

7928 of 13098 relevant lines covered (60.53%)

104.16 hits per line

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

90.63
/src/codegen/dispatchers/node_dispatcher.cpp
1
#include "sdfg/codegen/dispatchers/node_dispatcher.h"
2

3
namespace sdfg {
4
namespace codegen {
5

6
NodeDispatcher::NodeDispatcher(LanguageExtension& language_extension, Schedule& schedule,
45✔
7
                               structured_control_flow::ControlFlowNode& node, Instrumentation& instrumentation)
8
    : node_(node),
45✔
9
      language_extension_(language_extension),
45✔
10
      schedule_(schedule),
45✔
11
      instrumentation_(instrumentation){};
90✔
12

13
bool NodeDispatcher::begin_node(PrettyPrinter& stream) {
25✔
14
    auto& sdfg = schedule_.sdfg();
25✔
15

16
    // Declare the transient variables
17
    bool applied = false;
25✔
18
    for (auto& container : sdfg.containers()) {
39✔
19
        if (!sdfg.is_transient(container)) {
14✔
20
            continue;
3✔
21
        }
22

23
        if (schedule_.allocation_lifetime(container) == &node_) {
11✔
24
            if (!applied) {
2✔
25
                applied = true;
2✔
26
                stream << "{" << std::endl;
2✔
27
                stream.setIndent(stream.indent() + 4);
2✔
28
            }
2✔
29
            if (schedule_.allocation_type(container) == AllocationType::DECLARE) {
2✔
30
                std::string val =
31
                    this->language_extension_.declaration(container, sdfg.type(container));
1✔
32
                if (!val.empty()) {
1✔
33
                    stream << val;
1✔
34
                    stream << ";" << std::endl;
1✔
35
                }
1✔
36
            } else {
1✔
37
                std::string val =
38
                    this->language_extension_.allocation(container, sdfg.type(container));
1✔
39
                if (!val.empty()) {
1✔
40
                    stream << val;
1✔
41
                    stream << ";" << std::endl;
1✔
42
                }
1✔
43
            }
1✔
44
        }
2✔
45
    }
46

47
    return applied;
25✔
48
};
×
49

50
void NodeDispatcher::end_node(PrettyPrinter& stream, bool applied) {
25✔
51
    auto& sdfg = schedule_.sdfg();
25✔
52

53
    if (applied) {
25✔
54
        for (auto& container : sdfg.containers()) {
4✔
55
            if (!sdfg.is_transient(container)) {
2✔
56
                continue;
×
57
            }
58
            if (schedule_.allocation_lifetime(container) == &node_) {
2✔
59
                if (schedule_.allocation_type(container) == AllocationType::ALLOCATE) {
2✔
60
                    auto& type = sdfg.type(container);
1✔
61
                    std::string val = this->language_extension_.deallocation(container, type);
1✔
62
                    if (!val.empty()) {
1✔
63
                        stream << val;
1✔
64
                        stream << ";" << std::endl;
1✔
65
                    }
1✔
66
                }
1✔
67
            }
2✔
68
        }
69

70
        stream.setIndent(stream.indent() - 4);
2✔
71
        stream << "}" << std::endl;
2✔
72
    }
2✔
73
};
25✔
74

75
void NodeDispatcher::dispatch(PrettyPrinter& main_stream, PrettyPrinter& globals_stream,
25✔
76
                              PrettyPrinter& library_stream) {
77
    bool applied = begin_node(main_stream);
25✔
78

79
    if (this->instrumentation_.should_instrument(node_)) {
25✔
NEW
80
        this->instrumentation_.begin_instrumentation(node_, main_stream);
×
UNCOV
81
    }
×
82

83
    dispatch_node(main_stream, globals_stream, library_stream);
25✔
84

85
    if (this->instrumentation_.should_instrument(node_)) {
25✔
NEW
86
        this->instrumentation_.end_instrumentation(node_, main_stream);
×
UNCOV
87
    }
×
88

89
    end_node(main_stream, applied);
25✔
90
};
25✔
91

92
}  // namespace codegen
93
}  // 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