docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
sdfg::structured_control_flow::Return Class Reference

Represents a return statement that exits the function with a value. More...

#include <sdfg/structured_control_flow/return.h>

Inheritance diagram for sdfg::structured_control_flow::Return:
[legend]

Public Member Functions

 Return (const Return &Return)=delete
Return & operator= (const Return &)=delete
ElementType type_id () const override
 Returns the type of the element.
bool accept (visitor::ActualStructuredSDFGVisitor &visitor) override
const std::string & data () const
 Get the data or constant value being returned.
const types::IType & type () const
 Get the return type.
bool is_data () const
 Check if this return statement returns a data container.
bool is_constant () const
 Check if this return statement returns a constant value.
void validate (const Function &function) const override
 Validates the element.
void replace (const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
 Replace occurrences of an expression (no-op for return nodes).
virtual void replace (const symbolic::ExpressionMapping &replacements)
Public Member Functions inherited from sdfg::structured_control_flow::ControlFlowNode
virtual ~ControlFlowNode ()=default
ControlFlowNode * get_parent ()
const ControlFlowNode * get_parent () const
 ControlFlowNode (const ControlFlowNode &node)=delete
ControlFlowNode & operator= (const ControlFlowNode &)=delete
Public Member Functions inherited from sdfg::Element
 Element (size_t element_id, const DebugInfo &debug_info)
virtual ~Element ()=default
size_t element_id () const
const DebugInfo & debug_info () const
void set_debug_info (const DebugInfo &debug_info)
void add_metadata (const std::string &key, const std::string &value)
void remove_metadata (const std::string &key)
const std::string & metadata (const std::string &key) const
const std::string * metadata_if_exists (const std::string &key) const
const std::unordered_map< std::string, std::string > & metadata () const
std::string_view element_type () const
 Returns the type of the element as a human-readable string.

Static Public Member Functions

static bool classof (const Element &element)
Static Public Member Functions inherited from sdfg::structured_control_flow::ControlFlowNode
static bool classof (const Element &element)
 LLVM-style RTTI predicate: true if element is a ControlFlowNode.
static std::vector< ControlFlowNode * > parent_chain (ControlFlowNode &child)

Friends

class sdfg::builder::StructuredSDFGBuilder

Additional Inherited Members

Static Public Attributes inherited from sdfg::structured_control_flow::ControlFlowNode
static constexpr ElementType TypeGroup
 Bitmask of all concrete ElementTypes that are ControlFlowNodes.
Protected Member Functions inherited from sdfg::structured_control_flow::ControlFlowNode
 ControlFlowNode (size_t element_id, const DebugInfo &debug_info, ControlFlowNode *parent)
 Protected constructor for control flow nodes with parent.
Protected Attributes inherited from sdfg::structured_control_flow::ControlFlowNode
ControlFlowNode * parent_
Protected Attributes inherited from sdfg::Element
size_t element_id_
DebugInfo debug_info_
std::unordered_map< std::string, std::string > metadata_

Detailed Description

Represents a return statement that exits the function with a value.

A Return node represents a function return statement in a StructuredSDFG. It can return either:

  • A data container (variable): References a container name in the SDFG
  • A constant value: A literal value with an explicit type

The return type must match the function's declared return type. Functions with non-void return types typically have Return nodes as the final statement in control flow paths.

Examples:

  • return x; - Returns the value of container "x" (data return)
  • return 42; - Returns constant integer 42 (constant return)
  • return 3.14; - Returns constant float 3.14 (constant return)
See also
StructuredSDFG

Constructor & Destructor Documentation

◆ Return()

sdfg::structured_control_flow::Return::Return ( const Return & Return)
delete

Member Function Documentation

◆ accept()

bool sdfg::structured_control_flow::Return::accept ( visitor::ActualStructuredSDFGVisitor & visitor)
overridevirtual

◆ classof()

bool sdfg::structured_control_flow::Return::classof ( const Element & element)
inlinestatic

◆ data()

const std::string & sdfg::structured_control_flow::Return::data ( ) const

Get the data or constant value being returned.

Returns
Container name (for data returns) or constant value string (for constant returns)

◆ is_constant()

bool sdfg::structured_control_flow::Return::is_constant ( ) const

Check if this return statement returns a constant value.

Returns
true if returning a constant, false if returning a container

◆ is_data()

bool sdfg::structured_control_flow::Return::is_data ( ) const

Check if this return statement returns a data container.

Returns
true if returning a container, false if returning a constant

◆ operator=()

Return & sdfg::structured_control_flow::Return::operator= ( const Return & )
delete

◆ replace() [1/2]

void sdfg::structured_control_flow::Return::replace ( const symbolic::Expression old_expression,
const symbolic::Expression new_expression )
overridevirtual

Replace occurrences of an expression (no-op for return nodes).

Parameters
old_expressionExpression to replace
new_expressionExpression to replace with

Implements sdfg::Element.

◆ replace() [2/2]

virtual void sdfg::Element::replace ( const symbolic::ExpressionMapping & replacements)
virtual

Reimplemented from sdfg::Element.

◆ type()

const types::IType & sdfg::structured_control_flow::Return::type ( ) const

Get the return type.

Returns
Reference to the type of the returned value

◆ type_id()

ElementType sdfg::structured_control_flow::Return::type_id ( ) const
inlineoverridevirtual

Returns the type of the element.

Implements sdfg::Element.

◆ validate()

void sdfg::structured_control_flow::Return::validate ( const Function & function) const
overridevirtual

Validates the element.

Exceptions
InvalidSDFGExceptionif the element is invalid

Implements sdfg::Element.

◆ sdfg::builder::StructuredSDFGBuilder


The documentation for this class was generated from the following file:
  • sdfg/include/sdfg/structured_control_flow/return.h