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

Node representing access to a data container in the dataflow graph. More...

#include <sdfg/data_flow/access_node.h>

Inheritance diagram for sdfg::data_flow::AccessNode:
[legend]

Public Member Functions

 AccessNode (const AccessNode &data_node)=delete
AccessNode & operator= (const AccessNode &)=delete
ElementType type_id () const override
 Returns the type of the element.
void validate (const Function &function) const override
 Validate the access node.
const std::string & data () const
 Get the name of the data container.
virtual bool is_constant () const
void data (const std::string data)
 Set the name of the data container.
bool side_effect () const override
 An access node with incoming edges writes the container and therefore has side effects.
virtual std::unique_ptr< DataFlowNode > clone (size_t element_id, const graph::Vertex vertex, DataFlowGraph &parent) const override
 Clone this access node for graph transformations.
void replace (const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
 Replace symbolic expressions in this node.
EdgeRemoveOption can_remove_out_edge (const DataFlowGraph &graph, const Memlet *memlet) const override
 Is the edge in question removable, or will this make the node its an output on invalid?
EdgeRemoveOption can_remove_in_edge (const DataFlowGraph &graph, const Memlet *memlet) const override
Public Member Functions inherited from sdfg::data_flow::DataFlowNode
 DataFlowNode (const DataFlowNode &data_node)=delete
DataFlowNode & operator= (const DataFlowNode &)=delete
graph::Vertex vertex () const
 Get the graph vertex for this node.
const DataFlowGraph & get_parent () const
 Get the parent dataflow graph (const).
DataFlowGraph & get_parent ()
 Get the parent dataflow graph (mutable).
virtual bool update_edge_removed (const std::string &out_conn)
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.
virtual void replace (const symbolic::ExpressionMapping &replacements)

Static Public Member Functions

static bool classof (const Element &element)
static bool identicalBackingData (const AccessNode &src1, const AccessNode &src2)
 Checks if 2 access nodes refer to the same container / ptr Ready for when we identify them by sth more efficient then strings.
static bool has_constant_value (const AccessNode &node, long long constant_number)
 Checks if the access node is constant and matches the provided constant number.
Static Public Member Functions inherited from sdfg::data_flow::DataFlowNode
static bool classof (const Element &element)
 LLVM-style RTTI predicate: true if element is a DataFlowNode.

Protected Member Functions

 AccessNode (size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, DataFlowGraph &parent, const std::string &data)
 Protected constructor for access nodes.
Protected Member Functions inherited from sdfg::data_flow::DataFlowNode
 DataFlowNode (size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, DataFlowGraph &parent)
 Protected constructor for dataflow nodes.

Protected Attributes

std::string data_
 Name of the data container this node accesses.
Protected Attributes inherited from sdfg::Element
size_t element_id_
DebugInfo debug_info_
std::unordered_map< std::string, std::string > metadata_

Friends

class sdfg::builder::SDFGBuilder
class sdfg::builder::StructuredSDFGBuilder

Additional Inherited Members

Static Public Attributes inherited from sdfg::data_flow::DataFlowNode
static constexpr ElementType TypeGroup
 Bitmask of all concrete ElementTypes that are DataFlowNodes.

Detailed Description

Node representing access to a data container in the dataflow graph.

AccessNode provides an interface for reading from or writing to data containers defined in the function. Each access node references a data container by name and can be connected to code nodes via memlets.

Access nodes support:

  • Reference to function data containers
  • Multiple accesses to the same container
  • Validation of data container existence
  • Symbol replacement for container renaming
  • Cloning for graph transformations

Constructor & Destructor Documentation

◆ AccessNode() [1/2]

sdfg::data_flow::AccessNode::AccessNode ( size_t element_id,
const DebugInfo & debug_info,
const graph::Vertex vertex,
DataFlowGraph & parent,
const std::string & data )
protected

Protected constructor for access nodes.

Parameters
element_idUnique element identifier
debug_infoDebug information for this node
vertexGraph vertex for this node
parentParent dataflow graph
dataName of the data container to access

◆ AccessNode() [2/2]

sdfg::data_flow::AccessNode::AccessNode ( const AccessNode & data_node)
delete

Member Function Documentation

◆ can_remove_in_edge()

EdgeRemoveOption sdfg::data_flow::AccessNode::can_remove_in_edge ( const DataFlowGraph & graph,
const Memlet * memlet ) const
overridevirtual

◆ can_remove_out_edge()

EdgeRemoveOption sdfg::data_flow::AccessNode::can_remove_out_edge ( const DataFlowGraph & graph,
const Memlet * memlet ) const
overridevirtual

Is the edge in question removable, or will this make the node its an output on invalid?

Currently, some nodes may require every out connector to have at least 1 connection attached

Returns
NotRemovable, NoDependencies, CustomRemove

[NotRemovable] means only if the entire node can be removed, can the edge be removed [NoDependencies] means, the edge can be removed trivially, the node will work without for the remaining functions [CustomRemove] means, a call to [remove_out_edge] can have the node remove the edge itself and make necessary

Implements sdfg::data_flow::DataFlowNode.

◆ classof()

bool sdfg::data_flow::AccessNode::classof ( const Element & element)
inlinestatic

◆ clone()

virtual std::unique_ptr< DataFlowNode > sdfg::data_flow::AccessNode::clone ( size_t element_id,
const graph::Vertex vertex,
DataFlowGraph & parent ) const
overridevirtual

Clone this access node for graph transformations.

Parameters
element_idNew element identifier for the clone
vertexNew graph vertex for the clone
parentParent graph for the clone
Returns
Unique pointer to the cloned node

Implements sdfg::data_flow::DataFlowNode.

Reimplemented in sdfg::data_flow::ConstantNode.

◆ data() [1/2]

const std::string & sdfg::data_flow::AccessNode::data ( ) const

Get the name of the data container.

Returns
Name of the accessed data container

◆ data() [2/2]

void sdfg::data_flow::AccessNode::data ( const std::string data)

Set the name of the data container.

Parameters
dataNew name for the data container

◆ has_constant_value()

bool sdfg::data_flow::AccessNode::has_constant_value ( const AccessNode & node,
long long constant_number )
static

Checks if the access node is constant and matches the provided constant number.

Returns
true if node equals constant number

◆ identicalBackingData()

bool sdfg::data_flow::AccessNode::identicalBackingData ( const AccessNode & src1,
const AccessNode & src2 )
static

Checks if 2 access nodes refer to the same container / ptr Ready for when we identify them by sth more efficient then strings.

Returns
true if identical

◆ is_constant()

virtual bool sdfg::data_flow::AccessNode::is_constant ( ) const
inlinevirtual

Reimplemented in sdfg::data_flow::ConstantNode.

◆ operator=()

AccessNode & sdfg::data_flow::AccessNode::operator= ( const AccessNode & )
delete

◆ replace()

void sdfg::data_flow::AccessNode::replace ( const symbolic::Expression old_expression,
const symbolic::Expression new_expression )
overridevirtual

Replace symbolic expressions in this node.

Parameters
old_expressionExpression to replace
new_expressionReplacement expression

If both expressions are symbols and old_expression matches the data name, replaces the data name with new_expression.

Implements sdfg::Element.

◆ side_effect()

bool sdfg::data_flow::AccessNode::side_effect ( ) const
nodiscardoverridevirtual

An access node with incoming edges writes the container and therefore has side effects.

Implements sdfg::data_flow::DataFlowNode.

Reimplemented in sdfg::data_flow::ConstantNode.

◆ type_id()

ElementType sdfg::data_flow::AccessNode::type_id ( ) const
inlineoverridevirtual

Returns the type of the element.

Implements sdfg::Element.

Reimplemented in sdfg::data_flow::ConstantNode.

◆ validate()

void sdfg::data_flow::AccessNode::validate ( const Function & function) const
overridevirtual

Validate the access node.

Parameters
functionFunction context for validation
Exceptions
InvalidSDFGExceptionif validation fails

Validates that:

  • The referenced data container exists in the function
  • All outgoing edges have the same memlet type
  • All incoming edges have the same memlet type

Implements sdfg::Element.

Reimplemented in sdfg::data_flow::ConstantNode.

◆ sdfg::builder::SDFGBuilder

friend class sdfg::builder::SDFGBuilder
friend

◆ sdfg::builder::StructuredSDFGBuilder

Member Data Documentation

◆ data_

std::string sdfg::data_flow::AccessNode::data_
protected

Name of the data container this node accesses.


The documentation for this class was generated from the following file: