|
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... | |
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. | |
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 | ( | const 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 |
|
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.
Gets all gamma outputs that match the condition defined by match.
| F | A type supporting function call operator: bool operator(const Output&) |
| match | Defines the condition of the outputs to return. |
| 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 node.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:
| const rvsdg::Input & jlm::rvsdg::GammaNode::mapBranchArgumentToInput | ( | const rvsdg::Output & | output | ) | const |
Maps branch subregion entry argument to its corresponding gamma input.
| output | The branch argument to be mapped. |
output must be the entry argument to a subregion of this gamma node.This function is a more direct alternative to calling MapBranchArgument(x).input for situations when the sibling branch arguments are not needed.
Maps branch subregion entry argument to its corresponding gamma input.
| output | The branch argument to be mapped. |
output must be the entry argument to a subregion of this gamma node.This function is a more direct alternative to calling MapBranchArgument(x).input for situations when the sibling branch arguments are not needed.
| 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.
Maps branch subregion exit result to its corresponding gamma output.
| input | The branch result to be mapped. |
input must be the exit result to a subregion of this gamma node. Maps branch subregion exit result to its corresponding gamma output.
| input | The branch result to be mapped. |
input must be the exit result to a subregion of this gamma node. | 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.
Removes the exit variables corresponding to the given gammaOutputs.
| gammaOutputs | The outputs indicating the corresponding exit variables. |
|
private |