|
Jlm
|
Lambda node. More...
#include <lambda.hpp>


Classes | |
| struct | ArgumentVar |
| Formal argument variable. More... | |
| struct | ContextVar |
| Bound context variable. More... | |
Public Member Functions | |
| ~LambdaNode () override | |
| std::vector< rvsdg::Output * > | GetFunctionArguments () const |
| std::vector< rvsdg::Input * > | GetFunctionResults () const |
| rvsdg::Region * | subregion () const noexcept |
| LambdaOperation & | GetOperation () const noexcept override |
| ContextVar | AddContextVar (jlm::rvsdg::Output &origin) |
| Adds a context/free variable to the lambda node. More... | |
| ContextVar | MapInputContextVar (const rvsdg::Input &input) const noexcept |
| Maps input to context variable. More... | |
| std::optional< ContextVar > | MapBinderContextVar (const rvsdg::Output &output) const noexcept |
| Maps bound variable reference to context variable. More... | |
| std::vector< ContextVar > | GetContextVars () const noexcept |
| Gets all bound context variables. More... | |
| std::variant< ArgumentVar, ContextVar > | MapArgument (const rvsdg::Output &output) const |
| Maps region argument to its disposition (formal argument or context var). More... | |
| template<typename F > | |
| size_t | RemoveLambdaInputsWhere (const F &match) |
| size_t | PruneLambdaInputs () |
| rvsdg::Output * | output () const noexcept |
| LambdaNode * | copy (rvsdg::Region *region, const std::vector< jlm::rvsdg::Output * > &operands) const override |
| LambdaNode * | copy (rvsdg::Region *region, rvsdg::SubstitutionMap &smap) const override |
| Copy a node with substitutions. More... | |
| rvsdg::Output * | finalize (const std::vector< jlm::rvsdg::Output * > &results) |
Public Member Functions inherited from jlm::rvsdg::StructuralNode | |
| ~StructuralNode () noexcept override | |
| std::string | DebugString () const override |
| size_t | nsubregions () const noexcept |
| rvsdg::Region * | subregion (size_t index) const noexcept |
| SubregionIteratorRange | Subregions () |
| SubregionConstIteratorRange | Subregions () const |
| StructuralInput * | input (size_t index) const noexcept |
| StructuralOutput * | output (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 |
| NodeInput * | input (size_t index) const noexcept |
| InputIteratorRange | Inputs () noexcept |
| InputConstIteratorRange | Inputs () const noexcept |
| size_t | noutputs () const noexcept |
| NodeOutput * | output (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) |
| Graph * | graph () const noexcept |
| rvsdg::Region * | region () const noexcept |
Static Public Member Functions | |
| static LambdaNode * | Create (rvsdg::Region &parent, std::unique_ptr< LambdaOperation > operation) |
Private Member Functions | |
| LambdaNode (rvsdg::Region &parent, std::unique_ptr< LambdaOperation > op) | |
Private Attributes | |
| std::unique_ptr< LambdaOperation > | Operation_ |
Friends | |
| class | LambdaBuilder |
Lambda node.
A lambda node represents a lambda expression in the RVSDG. Its creation requires the invocation of two functions: Create() and finalize(). First, a node with only the function arguments is created by invoking Create(). The free variables of the lambda expression can then be added to the lambda node using the AddContextVar() method, and the body of the lambda node can be created. Finally, the lambda node can be finalized by invoking finalize().
The following snippet illustrates the creation of lambda nodes:
Definition at line 82 of file lambda.hpp.
|
overridedefault |
|
private |
Definition at line 40 of file lambda.cpp.
| LambdaNode::ContextVar jlm::rvsdg::LambdaNode::AddContextVar | ( | jlm::rvsdg::Output & | origin | ) |
Adds a context/free variable to the lambda node.
| origin | The value to be bound into the lambda node. |
origin must be from the same region as the lambda node.Definition at line 131 of file lambda.cpp.
|
overridevirtual |
Reimplemented from jlm::rvsdg::Node.
Definition at line 182 of file lambda.cpp.
|
overridevirtual |
Copy a node with substitutions.
| region | Target region to create node in |
| smap | Operand substitutions |
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 188 of file lambda.cpp.
|
static |
Creates a lambda node in the region parent with the function type type and name name. After the invocation of Create(), the lambda node only features the function arguments. Free variables can be added to the function node using AddContextVar(). The generation of the node can be finished using the finalize() method.
| parent | The region where the lambda node is created. |
| operation | Operational details for lambda node (including function signature). |
Definition at line 140 of file lambda.cpp.
| rvsdg::Output * jlm::rvsdg::LambdaNode::finalize | ( | const std::vector< jlm::rvsdg::Output * > & | results | ) |
Finalizes the creation of a lambda node.
| results | The result values of the lambda expression, originating from the lambda region. |
Definition at line 146 of file lambda.cpp.
|
noexcept |
Gets all bound context variables.
Returns all context variable descriptions.
Definition at line 119 of file lambda.cpp.
| std::vector< rvsdg::Output * > jlm::rvsdg::LambdaNode::GetFunctionArguments | ( | ) | const |
Definition at line 57 of file lambda.cpp.
| std::vector< rvsdg::Input * > jlm::rvsdg::LambdaNode::GetFunctionResults | ( | ) | const |
Definition at line 69 of file lambda.cpp.
|
overridevirtualnoexcept |
Implements jlm::rvsdg::Node.
Definition at line 51 of file lambda.cpp.
| std::variant< LambdaNode::ArgumentVar, LambdaNode::ContextVar > jlm::rvsdg::LambdaNode::MapArgument | ( | const rvsdg::Output & | output | ) | const |
Maps region argument to its disposition (formal argument or context var).
output must be an argument to the subregion of this node. Definition at line 104 of file lambda.cpp.
|
noexcept |
Maps bound variable reference to context variable.
| output | Region argument to lambda subregion |
output must be an argument to the subregion of this nodeReturns the context variable description corresponding to this bound variable reference in the lambda node region. Note that some arguments of the region are formal call arguments and do not have an associated context variable description.
Definition at line 88 of file lambda.cpp.
|
noexcept |
Maps input to context variable.
| input | Input to the lambda node. |
input must be input to this node.Returns the context variable description corresponding to this input of the lambda node. All inputs to the lambda node are by definition bound context variables that are accessible in the subregion through the corresponding argument.
Definition at line 80 of file lambda.cpp.
|
noexcept |
Definition at line 176 of file lambda.cpp.
|
inline |
Remove all dead inputs.
Definition at line 245 of file lambda.hpp.
| size_t jlm::rvsdg::LambdaNode::RemoveLambdaInputsWhere | ( | const F & | match | ) |
Remove lambda inputs and their respective arguments.
An input must match the condition specified by match and its argument must be dead.
| F | A type that supports the function call operator: bool operator(const rvsdg::input&) |
| match | Defines the condition of the elements to remove. |
Definition at line 296 of file lambda.hpp.
|
inlinenoexcept |
Definition at line 138 of file lambda.hpp.
|
friend |
Definition at line 291 of file lambda.hpp.
|
private |
Definition at line 289 of file lambda.hpp.