Jlm
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
jlm::rvsdg::DeltaNode Class Referencefinal

Delta node. More...

#include <delta.hpp>

Inheritance diagram for jlm::rvsdg::DeltaNode:
Inheritance graph
[legend]
Collaboration diagram for jlm::rvsdg::DeltaNode:
Collaboration graph
[legend]

Classes

struct  ContextVar
 Bound context variable. More...
 

Public Member Functions

 ~DeltaNode () noexcept override
 
ContextVar AddContextVar (jlm::rvsdg::Output &origin)
 Adds a context/free variable to the delta node. More...
 
ContextVar MapInputContextVar (const rvsdg::Input &input) const noexcept
 Maps input to context variable. More...
 
ContextVar MapBinderContextVar (const rvsdg::Output &output) const noexcept
 Maps bound variable reference to context variable. More...
 
std::vector< ContextVarGetContextVars () const noexcept
 Gets all bound context variables. More...
 
rvsdg::Regionsubregion () const noexcept
 
const DeltaOperationGetOperation () const noexcept override
 
const std::shared_ptr< const rvsdg::Type > & Type () const noexcept
 
bool constant () const noexcept
 
template<typename F >
size_t RemoveDeltaInputsWhere (const F &match)
 
size_t PruneDeltaInputs ()
 
rvsdg::Outputoutput () const noexcept
 
rvsdg::Inputresult () const noexcept
 
DeltaNodecopy (rvsdg::Region *region, const std::vector< jlm::rvsdg::Output * > &operands) const override
 
DeltaNodecopy (rvsdg::Region *region, rvsdg::SubstitutionMap &smap) const override
 Copy a node with substitutions. More...
 
rvsdg::Outputfinalize (rvsdg::Output *result)
 
- Public Member Functions inherited from jlm::rvsdg::StructuralNode
 ~StructuralNode () noexcept override
 
std::string DebugString () const override
 
size_t nsubregions () const noexcept
 
rvsdg::Regionsubregion (size_t index) const noexcept
 
SubregionIteratorRange Subregions ()
 
SubregionConstIteratorRange Subregions () const
 
StructuralInputinput (size_t index) const noexcept
 
StructuralOutputoutput (size_t index) const noexcept
 
- Public Member Functions inherited from jlm::rvsdg::Node
virtual ~Node ()
 
 Node (Region *region)
 
Id GetNodeId () const noexcept
 
size_t ninputs () const noexcept
 
NodeInputinput (size_t index) const noexcept
 
InputIteratorRange Inputs () noexcept
 
InputConstIteratorRange Inputs () const noexcept
 
size_t noutputs () const noexcept
 
NodeOutputoutput (size_t index) const noexcept
 
OutputIteratorRange Outputs () noexcept
 
OutputConstIteratorRange Outputs () const noexcept
 
bool IsDead () const noexcept
 Determines whether the node is dead. More...
 
std::size_t numSuccessors () const noexcept
 
size_t RemoveInputs (const util::HashSet< size_t > &indices)
 
size_t RemoveOutputs (const util::HashSet< size_t > &indices)
 
Graphgraph () const noexcept
 
rvsdg::Regionregion () const noexcept
 

Static Public Member Functions

static DeltaNodeCreate (rvsdg::Region *parent, std::unique_ptr< DeltaOperation > op)
 

Private Member Functions

 DeltaNode (rvsdg::Region *parent, std::unique_ptr< DeltaOperation > op)
 

Private Attributes

std::unique_ptr< DeltaOperationOperation_
 

Additional Inherited Members

- Public Types inherited from jlm::rvsdg::Node
using Id = uint64_t
 
using InputIteratorRange = util::IteratorRange< Input::Iterator >
 
using InputConstIteratorRange = util::IteratorRange< Input::ConstIterator >
 
using OutputIteratorRange = util::IteratorRange< Output::Iterator >
 
using OutputConstIteratorRange = util::IteratorRange< Output::ConstIterator >
 
typedef util::IntrusiveListAccessor< Node, &Node::region_node_list_anchor_region_node_list_accessor
 
typedef util::IntrusiveListAccessor< Node, &Node::region_top_node_list_anchor_region_top_node_list_accessor
 
typedef util::IntrusiveListAccessor< Node, &Node::region_bottom_node_list_anchor_region_bottom_node_list_accessor
 
- Protected Member Functions inherited from jlm::rvsdg::StructuralNode
 StructuralNode (rvsdg::Region *region, size_t nsubregions)
 
StructuralInputaddInput (std::unique_ptr< StructuralInput > input, bool notifyRegion)
 
StructuralOutputaddOutput (std::unique_ptr< StructuralOutput > input)
 
- Protected Member Functions inherited from jlm::rvsdg::Node
NodeInputaddInput (std::unique_ptr< NodeInput > input, bool notifyRegion)
 
NodeOutputaddOutput (std::unique_ptr< NodeOutput > output)
 

Detailed Description

Delta node.

A delta node represents a global variable in the RVSDG. Its creation requires the invocation of two functions: Create() and finalize(). First, a delta node is created by invoking Create(). The delta's dependencies can then be added using the AddContextVar() method, and the body of the delta node can be created. Finally, the delta node can be finalized by invoking finalize().

The following snippet illustrates the creation of delta nodes:

auto delta = DeltaNode::create(...);
...
auto cv1 = delta->AddContextVar(...);
auto cv2 = delta->AddContextVar(...);
...
// generate delta body
...
auto output = delta->finalize(...);
rvsdg::Output & output() const noexcept
Definition: delta.cpp:110

Definition at line 128 of file delta.hpp.

Constructor & Destructor Documentation

◆ ~DeltaNode()

jlm::rvsdg::DeltaNode::~DeltaNode ( )
overridedefaultnoexcept

◆ DeltaNode()

jlm::rvsdg::DeltaNode::DeltaNode ( rvsdg::Region parent,
std::unique_ptr< DeltaOperation op 
)
inlineprivate

Definition at line 134 of file delta.hpp.

Member Function Documentation

◆ AddContextVar()

DeltaNode::ContextVar jlm::rvsdg::DeltaNode::AddContextVar ( jlm::rvsdg::Output origin)

Adds a context/free variable to the delta node.

Parameters
originThe value to be bound into the delta node.
Precondition
origin must be from the same region as the delta node.
Returns
The context variable argument of the delta abstraction.

Definition at line 16 of file delta.cpp.

◆ constant()

bool jlm::rvsdg::DeltaNode::constant ( ) const
inlinenoexcept

Definition at line 249 of file delta.hpp.

◆ copy() [1/2]

DeltaNode * jlm::rvsdg::DeltaNode::copy ( rvsdg::Region region,
const std::vector< jlm::rvsdg::Output * > &  operands 
) const
overridevirtual

Reimplemented from jlm::rvsdg::Node.

Definition at line 77 of file delta.cpp.

◆ copy() [2/2]

DeltaNode * jlm::rvsdg::DeltaNode::copy ( rvsdg::Region region,
rvsdg::SubstitutionMap smap 
) const
overridevirtual

Copy a node with substitutions.

Parameters
regionTarget region to create node in
smapOperand substitutions
Returns
Copied node

Create a new node that is semantically equivalent to an existing node. The newly created node will use the same operands as the existing node unless there is a substitution registered for a particular operand.

The given substitution map is updated so that all outputs of the original node will be substituted by corresponding outputs of the newly created node in subsequent copy operations.

Implements jlm::rvsdg::Node.

Definition at line 83 of file delta.cpp.

◆ Create()

static DeltaNode* jlm::rvsdg::DeltaNode::Create ( rvsdg::Region parent,
std::unique_ptr< DeltaOperation op 
)
inlinestatic

Creates a delta node in the region parent with the detail information given in the operation struct.

After the invocation of Create(), the delta node has no inputs or outputs. Free variables can be added to the delta node using AddContextVar(). The generation of the node can be finished using the finalize() method.

Parameters
parentThe region where the delta node is created.
opThe delta node operation
Returns
A delta node without inputs or outputs.

Definition at line 313 of file delta.hpp.

◆ finalize()

rvsdg::Output & jlm::rvsdg::DeltaNode::finalize ( rvsdg::Output result)

Finalizes the creation of a delta node.

Parameters
resultThe result values of the delta expression, originating from the delta region.
Returns
The output of the delta node.

Definition at line 122 of file delta.cpp.

◆ GetContextVars()

std::vector< DeltaNode::ContextVar > jlm::rvsdg::DeltaNode::GetContextVars ( ) const
noexcept

Gets all bound context variables.

Returns
The context variable descriptions.

Returns all context variable descriptions.

Definition at line 39 of file delta.cpp.

◆ GetOperation()

const DeltaOperation & jlm::rvsdg::DeltaNode::GetOperation ( ) const
overridevirtualnoexcept

Implements jlm::rvsdg::Node.

Definition at line 71 of file delta.cpp.

◆ MapBinderContextVar()

DeltaNode::ContextVar jlm::rvsdg::DeltaNode::MapBinderContextVar ( const rvsdg::Output output) const
noexcept

Maps bound variable reference to context variable.

Parameters
outputRegion argument to delta subregion
Returns
The context variable description corresponding to the argument
Precondition
output must be an argument to the subregion of this node

Returns the context variable description corresponding to this bound variable reference in the delta node region.

Definition at line 32 of file delta.cpp.

◆ MapInputContextVar()

DeltaNode::ContextVar jlm::rvsdg::DeltaNode::MapInputContextVar ( const rvsdg::Input input) const
noexcept

Maps input to context variable.

Parameters
inputInput to the delta node.
Returns
The context variable description corresponding to the input.
Precondition
input must be input to this node.

Returns the context variable description corresponding to this input of the delta node. All inputs to the delta node are by definition bound context variables that are accessible in the subregion through the corresponding argument.

Definition at line 25 of file delta.cpp.

◆ output()

rvsdg::Output & jlm::rvsdg::DeltaNode::output ( ) const
noexcept

Definition at line 110 of file delta.cpp.

◆ PruneDeltaInputs()

size_t jlm::rvsdg::DeltaNode::PruneDeltaInputs ( )
inline

Remove all dead inputs.

Returns
The number of removed inputs.
See also
RemoveDeltaInputsWhere()

Definition at line 277 of file delta.hpp.

◆ RemoveDeltaInputsWhere()

template<typename F >
size_t jlm::rvsdg::DeltaNode::RemoveDeltaInputsWhere ( const F &  match)

Remove delta inputs and their respective arguments.

An input must match the condition specified by match and its argument must be dead.

Template Parameters
FA type that supports the function call operator: bool operator(const cvinput&)
Parameters
matchDefines the condition of the elements to remove.
Returns
The number of removed inputs.
See also
cvargument::IsDead()

Definition at line 334 of file delta.hpp.

◆ result()

rvsdg::Input & jlm::rvsdg::DeltaNode::result ( ) const
noexcept

Definition at line 116 of file delta.cpp.

◆ subregion()

rvsdg::Region* jlm::rvsdg::DeltaNode::subregion ( ) const
inlinenoexcept

Definition at line 234 of file delta.hpp.

◆ Type()

const std::shared_ptr<const rvsdg::Type>& jlm::rvsdg::DeltaNode::Type ( ) const
inlinenoexcept

Definition at line 243 of file delta.hpp.

Member Data Documentation

◆ Operation_

std::unique_ptr<DeltaOperation> jlm::rvsdg::DeltaNode::Operation_
private

Definition at line 329 of file delta.hpp.


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