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

daisytuner / sdfglib / 15519619127

08 Jun 2025 02:47PM UTC coverage: 61.731% (+0.08%) from 61.652%
15519619127

push

github

web-flow
Merge pull request #66 from daisytuner/libnodes-serialization

Adds custom serialization for library nodes

37 of 56 new or added lines in 6 files covered. (66.07%)

2 existing lines in 2 files now uncovered.

7259 of 11759 relevant lines covered (61.73%)

123.38 hits per line

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

91.67
/src/codegen/dispatchers/node_dispatcher_registry.cpp
1
#include "sdfg/codegen/dispatchers/node_dispatcher_registry.h"
2

3
#include "sdfg/codegen/dispatchers/block_dispatcher.h"
4
#include "sdfg/codegen/dispatchers/for_dispatcher.h"
5
#include "sdfg/codegen/dispatchers/if_else_dispatcher.h"
6
#include "sdfg/codegen/dispatchers/map_dispatcher.h"
7
#include "sdfg/codegen/dispatchers/sequence_dispatcher.h"
8
#include "sdfg/codegen/dispatchers/while_dispatcher.h"
9

10
namespace sdfg {
11
namespace codegen {
12

13
std::unique_ptr<NodeDispatcher> create_dispatcher(LanguageExtension& language_extension,
24✔
14
                                                  StructuredSDFG& sdfg,
15
                                                  structured_control_flow::ControlFlowNode& node,
16
                                                  Instrumentation& instrumentation) {
17
    auto dispatcher = NodeDispatcherRegistry::instance().get_dispatcher(typeid(node));
24✔
18
    if (dispatcher) {
24✔
19
        return dispatcher(language_extension, sdfg, node, instrumentation);
24✔
20
    }
21

22
    throw std::runtime_error("Unsupported control flow node: " + std::string(typeid(node).name()));
×
23
};
24✔
24

25
void register_default_dispatchers() {
2✔
26
    /* Control flow dispatchers */
27
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
28
        typeid(structured_control_flow::Block),
2✔
29
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
6✔
30
           structured_control_flow::ControlFlowNode& node, Instrumentation& instrumentation) {
31
            return std::make_unique<BlockDispatcher>(
4✔
32
                language_extension, sdfg, static_cast<structured_control_flow::Block&>(node),
4✔
33
                instrumentation);
4✔
34
        });
35
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
36
        typeid(structured_control_flow::Sequence),
2✔
37
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
16✔
38
           structured_control_flow::ControlFlowNode& node, Instrumentation& instrumentation) {
39
            return std::make_unique<SequenceDispatcher>(
14✔
40
                language_extension, sdfg, static_cast<structured_control_flow::Sequence&>(node),
14✔
41
                instrumentation);
14✔
42
        });
43
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
44
        typeid(structured_control_flow::IfElse),
2✔
45
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
3✔
46
           structured_control_flow::ControlFlowNode& node, Instrumentation& instrumentation) {
47
            return std::make_unique<IfElseDispatcher>(
1✔
48
                language_extension, sdfg, static_cast<structured_control_flow::IfElse&>(node),
1✔
49
                instrumentation);
1✔
50
        });
51
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
52
        typeid(structured_control_flow::While),
2✔
53
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
3✔
54
           structured_control_flow::ControlFlowNode& node, Instrumentation& instrumentation) {
55
            return std::make_unique<WhileDispatcher>(
1✔
56
                language_extension, sdfg, static_cast<structured_control_flow::While&>(node),
1✔
57
                instrumentation);
1✔
58
        });
59
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
60
        typeid(structured_control_flow::For),
2✔
61
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
3✔
62
           structured_control_flow::ControlFlowNode& node, Instrumentation& instrumentation) {
63
            return std::make_unique<ForDispatcher>(language_extension, sdfg,
2✔
64
                                                   static_cast<structured_control_flow::For&>(node),
1✔
65
                                                   instrumentation);
1✔
66
        });
67
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
68
        typeid(structured_control_flow::Map),
2✔
69
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
2✔
70
           structured_control_flow::ControlFlowNode& node, Instrumentation& instrumentation) {
71
            return std::make_unique<MapDispatcher>(language_extension, sdfg,
×
72
                                                   static_cast<structured_control_flow::Map&>(node),
×
73
                                                   instrumentation);
×
74
        });
75
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
76
        typeid(structured_control_flow::Return),
2✔
77
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
3✔
78
           structured_control_flow::ControlFlowNode& node, Instrumentation& instrumentation) {
79
            return std::make_unique<ReturnDispatcher>(
1✔
80
                language_extension, sdfg, static_cast<structured_control_flow::Return&>(node),
1✔
81
                instrumentation);
1✔
82
        });
83
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
84
        typeid(structured_control_flow::Break),
2✔
85
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
3✔
86
           structured_control_flow::ControlFlowNode& node, Instrumentation& instrumentation) {
87
            return std::make_unique<BreakDispatcher>(
1✔
88
                language_extension, sdfg, static_cast<structured_control_flow::Break&>(node),
1✔
89
                instrumentation);
1✔
90
        });
91
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
92
        typeid(structured_control_flow::Continue),
2✔
93
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
3✔
94
           structured_control_flow::ControlFlowNode& node, Instrumentation& instrumentation) {
95
            return std::make_unique<ContinueDispatcher>(
1✔
96
                language_extension, sdfg, static_cast<structured_control_flow::Continue&>(node),
1✔
97
                instrumentation);
1✔
98
        });
99

100
    /* Map dispatchers */
101
    MapDispatcherRegistry::instance().register_map_dispatcher(
4✔
102
        structured_control_flow::ScheduleType_Sequential.value(),
2✔
103
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
3✔
104
           structured_control_flow::Map& node, Instrumentation& instrumentation) {
105
            return std::make_unique<SequentialMapDispatcher>(language_extension, sdfg, node,
2✔
106
                                                             instrumentation);
1✔
107
        });
108
    MapDispatcherRegistry::instance().register_map_dispatcher(
4✔
109
        structured_control_flow::ScheduleType_CPU_Parallel.value(),
2✔
110
        [](LanguageExtension& language_extension, StructuredSDFG& sdfg,
2✔
111
           structured_control_flow::Map& node, Instrumentation& instrumentation) {
NEW
112
            return std::make_unique<CPUParallelMapDispatcher>(language_extension, sdfg, node,
×
NEW
113
                                                              instrumentation);
×
114
        });
115
}
2✔
116

117
}  // namespace codegen
118
}  // 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