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

Node representing a constant literal value in the dataflow graph. More...

#include <sdfg/data_flow/access_node.h>

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

Public Member Functions

 ConstantNode (const ConstantNode &data_node)=delete
ConstantNode & operator= (const ConstantNode &)=delete
ElementType type_id () const override
 Returns the type of the element.
const types::IType & type () const
 Get the type of this constant.
bool side_effect () const override
 An access node with incoming edges writes the container and therefore has side effects.
bool is_constant () const override
void validate (const Function &function) const override
 Validate the constant node.
virtual std::unique_ptr< DataFlowNode > clone (size_t element_id, const graph::Vertex vertex, DataFlowGraph &parent) const override
 Clone this constant node for graph transformations.
Public Member Functions inherited from sdfg::data_flow::AccessNode
 AccessNode (const AccessNode &data_node)=delete
AccessNode & operator= (const AccessNode &)=delete
const std::string & data () const
 Get the name of the data container.
void data (const std::string data)
 Set the name of the data container.
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 Public Member Functions inherited from sdfg::data_flow::AccessNode
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.

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.
Protected Member Functions inherited from sdfg::data_flow::AccessNode
 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 inherited from sdfg::data_flow::AccessNode
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_

Detailed Description

Node representing a constant literal value in the dataflow graph.

ConstantNode is a specialized access node that represents constant literals (e.g., "42", "3.14", "true"). Unlike regular access nodes:

  • Does not reference a function variable
  • Cannot have incoming edges (constants are sources only)
  • Stores its own type information
  • Validates that the literal value matches the declared type

Constants are useful for:

  • Providing literal values to computations
  • Initializing variables
  • Specifying algorithm parameters

Constructor & Destructor Documentation

◆ ConstantNode()

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

Member Function Documentation

◆ classof()

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

◆ clone()

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

Clone this constant 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

Reimplemented from sdfg::data_flow::AccessNode.

◆ is_constant()

bool sdfg::data_flow::ConstantNode::is_constant ( ) const
inlineoverridevirtual

Reimplemented from sdfg::data_flow::AccessNode.

◆ operator=()

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

◆ side_effect()

bool sdfg::data_flow::ConstantNode::side_effect ( ) const
inlinenodiscardoverridevirtual

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

Reimplemented from sdfg::data_flow::AccessNode.

◆ type()

const types::IType & sdfg::data_flow::ConstantNode::type ( ) const

Get the type of this constant.

Returns
Type of the constant value

◆ type_id()

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

Returns the type of the element.

Reimplemented from sdfg::data_flow::AccessNode.

◆ validate()

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

Validate the constant node.

Parameters
functionFunction context for validation
Exceptions
InvalidSDFGExceptionif validation fails

Validates that:

  • The data name does not conflict with function variables
  • The node has no incoming edges
  • For integer/boolean types, the literal is a valid number

Reimplemented from sdfg::data_flow::AccessNode.

◆ sdfg::builder::SDFGBuilder

friend class sdfg::builder::SDFGBuilder
friend

◆ sdfg::builder::StructuredSDFGBuilder


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