docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
return.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace sdfg {
6
7namespace builder {
9}
10
12
32class Return : public ControlFlowNode {
34
35private:
36 std::string data_;
37 std::unique_ptr<types::IType> type_;
38
39 Return(size_t element_id, const DebugInfo& debug_info, ControlFlowNode* parent, const std::string& data);
40
41 Return(
42 size_t element_id,
43 const DebugInfo& debug_info,
44 ControlFlowNode* parent,
45 const std::string& constant,
46 const types::IType& type
47 );
48
49 static constexpr size_t REQUIRED_ELEMENT_IDS = 1;
50
51public:
52 Return(const Return& Return) = delete;
53 Return& operator=(const Return&) = delete;
54
55 ElementType type_id() const override {
57 }
58
59 static bool classof(const Element& element) {
60 return element.type_id() == ElementType::Return;
61 }
62
64
69 const std::string& data() const;
70
75 const types::IType& type() const;
76
81 bool is_data() const;
82
87 bool is_constant() const;
88
89 void validate(const Function& function) const override;
90
96 void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
97 using Element::replace;
98};
99
100} // namespace structured_control_flow
101} // namespace sdfg
Definition element.h:30
virtual void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression)=0
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
ControlFlowNode(size_t element_id, const DebugInfo &debug_info, ControlFlowNode *parent)
Protected constructor for control flow nodes with parent.
bool is_constant() const
Check if this return statement returns a constant value.
Return(const Return &Return)=delete
const types::IType & type() const
Get the return type.
Return & operator=(const Return &)=delete
ElementType type_id() const override
Returns the type of the element.
Definition return.h:55
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
Replace occurrences of an expression (no-op for return nodes).
const std::string & data() const
Get the data or constant value being returned.
bool is_data() const
Check if this return statement returns a data container.
static bool classof(const Element &element)
Definition return.h:59
bool accept(visitor::ActualStructuredSDFGVisitor &visitor) override
void validate(const Function &function) const override
Validates the element.
Abstract base interface for all types in the sdfglib type system.
Definition type.h:625
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
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
@ Return
Definition element.h:80