docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
block.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
10
11namespace sdfg {
12
13namespace builder {
15}
16
18
42class Block : public ControlFlowNode {
44
45private:
46 std::unique_ptr<data_flow::DataFlowGraph> dataflow_;
47
48 Block(size_t element_id, const DebugInfo& debug_info, ControlFlowNode* parent);
49
50 static constexpr size_t REQUIRED_ELEMENT_IDS = 1;
51
52public:
53 Block(const Block& block) = delete;
54 Block& operator=(const Block&) = delete;
55
56 ElementType type_id() const override {
57 return ElementType::Block;
58 }
59
60 static bool classof(const Element& element) {
61 return element.type_id() == ElementType::Block;
62 }
63
65
66 void validate(const Function& function) const override;
67
73
79
85 void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
86 void replace(const symbolic::ExpressionMapping& replacements) override;
87
88 template<typename T>
90 return this->dataflow().is_a_library_node<T>();
91 }
92};
93
94class AssignmentBlock : public ControlFlowNode {
96
97private:
98 control_flow::Assignments assignments_;
99
100 AssignmentBlock(
102 const DebugInfo& debug_info,
103 ControlFlowNode* parent,
105 );
106 AssignmentBlock(ElementId element_id, const DebugInfo& debug_info, ControlFlowNode* parent);
107
108 static constexpr size_t REQUIRED_ELEMENT_IDS = 1;
109
110public:
111 AssignmentBlock(const AssignmentBlock& block) = delete;
112 AssignmentBlock& operator=(const AssignmentBlock&) = delete;
113
114 ElementType type_id() const override {
116 }
117
125
126 static bool classof(const Element& element) {
127 return element.type_id() == ElementType::AssignmentBlock;
128 }
129
131
132 void validate(const Function& function) const override;
133
139
145
150 bool empty() const;
151
156 size_t size() const;
157
163 void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
164 void replace(const symbolic::ExpressionMapping& replacements) override;
165};
166
167} // namespace structured_control_flow
168} // 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
Definition data_flow_graph.h:29
T * is_a_library_node()
Definition data_flow_graph.h:226
bool empty() const
Check if this transition has no assignments.
control_flow::Assignments & assignments()
Access the assignments in this transition (non-const version).
void validate(const Function &function) const override
Validates the element.
static bool classof(const Element &element)
Definition block.h:126
ElementType type_id() const override
Returns the type of the element.
Definition block.h:114
size_t size() const
Get the number of assignments in this transition.
const control_flow::Assignments & assignments() const
Access the assignments in this transition (const version).
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
Replace occurrences of an expression in the dataflow graph.
bool add_if_not_overwritten(const symbolic::Symbol &target, const symbolic::Expression &expr)
Add this assignment, if the symbol in question is not already being written.
AssignmentBlock(const AssignmentBlock &block)=delete
AssignmentBlock & operator=(const AssignmentBlock &)=delete
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
Replace occurrences of an expression in the dataflow graph.
bool accept(visitor::ActualStructuredSDFGVisitor &visitor) override
const data_flow::DataFlowGraph & dataflow() const
Access the dataflow graph (const version).
Block(const Block &block)=delete
T * is_a_library_node()
Definition block.h:89
static bool classof(const Element &element)
Definition block.h:60
ElementType type_id() const override
Returns the type of the element.
Definition block.h:56
Block & operator=(const Block &)=delete
void validate(const Function &function) const override
Validates the element.
void replace(const symbolic::ExpressionMapping &replacements) override
data_flow::DataFlowGraph & dataflow()
Access the dataflow graph (non-const version).
ControlFlowNode(size_t element_id, const DebugInfo &debug_info, ControlFlowNode *parent)
Protected constructor for control flow nodes with parent.
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::RCP< const SymEngine::Symbol > Symbol
Reference-counted pointer to a SymEngine Symbol.
Definition symbolic.h:71
SymEngine::map_basic_basic ExpressionMapping
Definition symbolic.h:109
Definition function_builder.h:10
symbolic::SymbolMap Assignments
Type alias for symbol assignments on interstate edges.
Definition interstate_edge.h:30
Definition language_extension.h:18
Definition control_flow_node.h:16
Definition analysis.h:7
ElementType
Definition element.h:72
@ AssignmentBlock
Definition element.h:83
@ Block
Definition element.h:81
size_t ElementId
Definition element.h:215
Symbolic system for integer-based symbol analysis.