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

daisytuner / sdfglib / 15956279794

29 Jun 2025 02:35PM UTC coverage: 64.84% (-0.3%) from 65.154%
15956279794

push

github

web-flow
Merge pull request #118 from daisytuner/symbol-promotion

Improves symbolic analysis for loops

16 of 183 new or added lines in 6 files covered. (8.74%)

6 existing lines in 2 files now uncovered.

8577 of 13228 relevant lines covered (64.84%)

143.99 hits per line

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

82.5
/src/analysis/scope_analysis.cpp
1
#include "sdfg/analysis/scope_analysis.h"
2

3
namespace sdfg {
4
namespace analysis {
5

6
ScopeAnalysis::ScopeAnalysis(StructuredSDFG& sdfg) : Analysis(sdfg) {}
635✔
7

8
void ScopeAnalysis::run(structured_control_flow::ControlFlowNode* current,
3,532✔
9
                        structured_control_flow::ControlFlowNode* parent_scope) {
10
    if (dynamic_cast<structured_control_flow::Block*>(current)) {
3,532✔
11
        this->scope_tree_[current] = parent_scope;
868✔
12
    } else if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(current)) {
3,532✔
13
        this->scope_tree_[current] = parent_scope;
1,669✔
14
        for (size_t i = 0; i < sequence_stmt->size(); i++) {
3,538✔
15
            this->run(&sequence_stmt->at(i).first, current);
1,869✔
16
        }
1,869✔
17
    } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(current)) {
2,664✔
18
        this->scope_tree_[current] = parent_scope;
57✔
19
        for (size_t i = 0; i < if_else_stmt->size(); i++) {
153✔
20
            this->run(&if_else_stmt->at(i).first, current);
96✔
21
        }
96✔
22
    } else if (auto while_stmt = dynamic_cast<structured_control_flow::While*>(current)) {
995✔
23
        this->scope_tree_[current] = parent_scope;
29✔
24
        this->run(&while_stmt->root(), current);
29✔
25
    } else if (auto for_stmt = dynamic_cast<structured_control_flow::StructuredLoop*>(current)) {
938✔
26
        this->scope_tree_[current] = parent_scope;
903✔
27
        this->run(&for_stmt->root(), current);
903✔
28
    } else if (dynamic_cast<structured_control_flow::Break*>(current)) {
909✔
29
        this->scope_tree_[current] = parent_scope;
×
30
    } else if (dynamic_cast<structured_control_flow::Continue*>(current)) {
6✔
31
        this->scope_tree_[current] = parent_scope;
6✔
32
    } else if (dynamic_cast<structured_control_flow::Return*>(current)) {
6✔
33
        this->scope_tree_[current] = parent_scope;
×
34
    } else {
×
35
        throw std::runtime_error("Unsupported control flow node type");
×
36
    }
37
}
3,532✔
38

39
void ScopeAnalysis::run(AnalysisManager& analysis_manager) {
635✔
40
    this->scope_tree_.clear();
635✔
41
    this->run(&this->sdfg_.root(), nullptr);
635✔
42
}
635✔
43

44
const std::unordered_map<const structured_control_flow::ControlFlowNode*,
45
                         structured_control_flow::ControlFlowNode*>&
46
ScopeAnalysis::scope_tree() const {
×
47
    return this->scope_tree_;
×
48
}
49

50
structured_control_flow::ControlFlowNode* ScopeAnalysis::parent_scope(
2,049✔
51
    const structured_control_flow::ControlFlowNode* scope) const {
52
    if (this->scope_tree_.find(scope) == this->scope_tree_.end()) {
2,049✔
NEW
53
        return nullptr;
×
54
    }
55
    return this->scope_tree_.at(scope);
2,049✔
56
}
2,049✔
57

58
}  // namespace analysis
59
}  // 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