docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
while.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
8
9namespace sdfg {
10
11namespace builder {
13}
14
16
37class While : public ControlFlowNode {
39
40private:
41 std::unique_ptr<Sequence> root_;
42
43 While(size_t element_id, const DebugInfo& debug_info, ControlFlowNode* parent);
44
45 static constexpr size_t REQUIRED_ELEMENT_IDS = 2;
46
47public:
48 While(const While& node) = delete;
49 While& operator=(const While&) = delete;
50
51 ElementType type_id() const override {
52 return ElementType::While;
53 }
54
55 static bool classof(const Element& element) {
56 return element.type_id() == ElementType::While;
57 }
58
60
61 void validate(const Function& function) const override;
62
67 const Sequence& root() const;
68
74
80 void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
81 void replace(const symbolic::ExpressionMapping& replacements) override;
82};
83
93class Break : public ControlFlowNode {
95
96private:
97 Break(size_t element_id, const DebugInfo& debug_info, ControlFlowNode* parent);
98
99 static constexpr size_t REQUIRED_ELEMENT_IDS = 1;
100
101public:
102 ElementType type_id() const override {
103 return ElementType::Break;
104 }
105
106 static bool classof(const Element& element) {
107 return element.type_id() == ElementType::Break;
108 }
109
111
112 void validate(const Function& function) const override;
113
114 void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
115 void replace(const symbolic::ExpressionMapping& replacements) override;
116};
117
128class Continue : public ControlFlowNode {
130
131private:
132 Continue(size_t element_id, const DebugInfo& debug_info, ControlFlowNode* parent);
133
134 static constexpr size_t REQUIRED_ELEMENT_IDS = 1;
135
136public:
137 ElementType type_id() const override {
139 }
140
141 static bool classof(const Element& element) {
142 return element.type_id() == ElementType::Continue;
143 }
144
146
147 void validate(const Function& function) const override;
148
149 void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
150 void replace(const symbolic::ExpressionMapping& replacements) override;
151};
152
153} // namespace structured_control_flow
154} // namespace sdfg
Definition element.h:30
Element(size_t element_id, const DebugInfo &debug_info)
size_t element_id() const
const DebugInfo & debug_info() const
virtual ElementType type_id() const =0
Returns the type of the element.
Definition function.h:43
Note: Even though the class references unique_ptr, it will never delete an SDFG it has a reference to...
Definition structured_sdfg_builder.h:44
static bool classof(const Element &element)
Definition while.h:106
void validate(const Function &function) const override
Validates the element.
bool accept(visitor::ActualStructuredSDFGVisitor &visitor) override
void replace(const symbolic::ExpressionMapping &replacements) override
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
ElementType type_id() const override
Returns the type of the element.
Definition while.h:102
void validate(const Function &function) const override
Validates the element.
bool accept(visitor::ActualStructuredSDFGVisitor &visitor) override
ElementType type_id() const override
Returns the type of the element.
Definition while.h:137
void replace(const symbolic::ExpressionMapping &replacements) override
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
static bool classof(const Element &element)
Definition while.h:141
ControlFlowNode(size_t element_id, const DebugInfo &debug_info, ControlFlowNode *parent)
Protected constructor for control flow nodes with parent.
A sequential container of control flow nodes.
Definition sequence.h:52
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
Replace occurrences of an expression in the loop body.
While & operator=(const While &)=delete
ElementType type_id() const override
Returns the type of the element.
Definition while.h:51
void replace(const symbolic::ExpressionMapping &replacements) override
void validate(const Function &function) const override
Validates the element.
While(const While &node)=delete
Sequence & root()
Access the loop body sequence (non-const version).
bool accept(visitor::ActualStructuredSDFGVisitor &visitor) override
const Sequence & root() const
Access the loop body sequence (const version).
static bool classof(const Element &element)
Definition while.h:55
Visitor for Structured SDFG (not a builder).
Definition structured_sdfg_visitor.h:71
SymEngine::RCP< const SymEngine::Basic > Expression
Reference-counted pointer to a symbolic expression (SymEngine Basic).
Definition symbolic.h:83
SymEngine::map_basic_basic ExpressionMapping
Definition symbolic.h:109
Definition function_builder.h:10
Definition language_extension.h:18
Definition control_flow_node.h:16
Definition analysis.h:7
ElementType
Definition element.h:72
@ While
Definition element.h:85
@ Continue
Definition element.h:86
@ Break
Definition element.h:87
Symbolic system for integer-based symbol analysis.