|
Jlm
|
Conditional operator / pattern matching. More...
#include <gamma.hpp>


Classes | |
| struct | EntryVar |
| A variable routed into all gamma regions. More... | |
| struct | ExitVar |
| A variable routed out of all gamma regions as result. More... | |
| struct | MatchVar |
| The match/discriminator variable of this gamma node. More... | |
Public Member Functions | |
| ~GammaNode () noexcept override | |
| const GammaOperation & | GetOperation () const noexcept override |
| rvsdg::Input * | predicate () const noexcept |
| EntryVar | AddEntryVar (rvsdg::Output *origin) |
| Routes a variable into the gamma branches. More... | |
| MatchVar | GetMatchVar () const |
| std::vector< EntryVar > | GetEntryVars () const |
| Gets all entry variables for this gamma. More... | |
| std::variant< MatchVar, EntryVar > | MapInput (const rvsdg::Input &input) const |
| Maps gamma input to its role (match variable or entry variable). More... | |
| std::variant< MatchVar, EntryVar > | MapBranchArgument (const rvsdg::Output &output) const |
| Maps branch subregion entry argument to its role (pattern match or entry variable). More... | |
| ExitVar | AddExitVar (std::vector< rvsdg::Output * > values) |
| Routes per-branch result of gamma to output. More... | |
| std::vector< ExitVar > | GetExitVars () const |
| Gets all exit variables for this gamma. More... | |
| ExitVar | MapOutputExitVar (const rvsdg::Output &output) const |
| Maps gamma output to exit variable description. More... | |
| ExitVar | MapBranchResultExitVar (const rvsdg::Input &input) const |
| Maps gamma region exit result to exit variable description. More... | |
| void | RemoveExitVars (const std::vector< ExitVar > &exitVars) |
| Removes the given exit variables. More... | |
| void | RemoveEntryVars (const std::vector< EntryVar > &entryVars) |
| Removes the given entry variables. More... | |
| void | PruneExitVars () |
| GammaNode * | copy (jlm::rvsdg::Region *region, SubstitutionMap &smap) const override |
| Copy a node with substitutions. More... | |
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 |
| virtual Node * | copy (rvsdg::Region *region, const std::vector< jlm::rvsdg::Output * > &operands) const |
Static Public Member Functions | |
| static GammaNode * | create (jlm::rvsdg::Output *predicate, size_t nalternatives) |
| static GammaNode & | Create (jlm::rvsdg::Output &predicate, size_t numAlternatives, std::vector< std::shared_ptr< const Type >> matchContentTypes) |
| static GammaNode & | Create (jlm::rvsdg::Output &predicate, std::unique_ptr< GammaOperation > op) |
Private Member Functions | |
| GammaNode (rvsdg::Output &predicate, std::unique_ptr< GammaOperation > op) | |
| GammaNode (rvsdg::Output &predicate, size_t nalternatives, std::vector< std::shared_ptr< const Type >> match_content_types) | |
| EntryVar | GetEntryVar (std::size_t index) const |
| Gets entry variable by index. More... | |
Private Attributes | |
| std::unique_ptr< GammaOperation > | Operation_ |
Conditional operator / pattern matching.
Gamma nodes discriminate over a given value and conditionally select one of its subregions. In its simplest form, they correspond to an if/else statement:
More generically, they perform pattern-matching over a finitely- constructed type:
where the "contents" of the match is made available in its corresponding branch. Simple types such as booleans do not have any content and thus produce the content-less UnitType as placeholder for the destructured content – so effectively Gamma then corresponds to:
|
overridedefaultnoexcept |
|
private |
|
private |
| GammaNode::EntryVar jlm::rvsdg::GammaNode::AddEntryVar | ( | rvsdg::Output * | origin | ) |
Routes a variable into the gamma branches.
| origin | Value to be routed in. |
Routes a variable into a gamma region. To access the variable in each branch use EntryVar::branchArgument.
| GammaNode::ExitVar jlm::rvsdg::GammaNode::AddExitVar | ( | std::vector< rvsdg::Output * > | values | ) |
|
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.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
private |
| std::vector< GammaNode::EntryVar > jlm::rvsdg::GammaNode::GetEntryVars | ( | ) | const |
| std::vector< GammaNode::ExitVar > jlm::rvsdg::GammaNode::GetExitVars | ( | ) | const |
| GammaNode::MatchVar jlm::rvsdg::GammaNode::GetMatchVar | ( | ) | const |
|
overridevirtualnoexcept |
Implements jlm::rvsdg::Node.
| std::variant< GammaNode::MatchVar, GammaNode::EntryVar > jlm::rvsdg::GammaNode::MapBranchArgument | ( | const rvsdg::Output & | output | ) | const |
Maps branch subregion entry argument to its role (pattern match or entry variable).
| output | The branch argument to be mapped. |
output must be the entry argument to a subregion of this gamma nade.Maps the subregion entry argument to the variable description corresponding to it (the predicate + pattern matches, or an entry variable into this branch). This allows to trace the value to users in other branches as well as its def site preceding the gamma node:
| GammaNode::ExitVar jlm::rvsdg::GammaNode::MapBranchResultExitVar | ( | const rvsdg::Input & | input | ) | const |
Maps gamma region exit result to exit variable description.
| input | The result to be mapped to be mapped. |
input must be a result of a subregion of this node.Maps the gamma region result to the exit variable description corresponding to it.
| std::variant< GammaNode::MatchVar, GammaNode::EntryVar > jlm::rvsdg::GammaNode::MapInput | ( | const rvsdg::Input & | input | ) | const |
Maps gamma input to its role (match variable or entry variable).
| input | Input to be mapped. |
input must be an input of this nodeMaps the gamma input to the variable description corresponding to it. This is either the "match" or "predicate" of the gamma, or an entry variable for values used inside the region. This allows to trace the value through to users in the gamma subregions.
| GammaNode::ExitVar jlm::rvsdg::GammaNode::MapOutputExitVar | ( | const rvsdg::Output & | output | ) | const |
Maps gamma output to exit variable description.
| output | Output to be mapped. |
output must be an output of this node.Maps the gamma output to the exit variable description corresponding to it. This allows to trace the value through to users in the gamma subregions.
|
inlinenoexcept |
|
inline |
Remove all exit variables where the variables' output is dead.
| void jlm::rvsdg::GammaNode::RemoveEntryVars | ( | const std::vector< EntryVar > & | entryVars | ) |
| void jlm::rvsdg::GammaNode::RemoveExitVars | ( | const std::vector< ExitVar > & | exitVars | ) |
|
private |