7 #ifndef JLM_RVSDG_GAMMA_HPP
8 #define JLM_RVSDG_GAMMA_HPP
31 size_t numAlternatives,
32 std::vector<std::shared_ptr<const Type>> matchContentTypes) noexcept
44 [[nodiscard]] std::string
47 [[nodiscard]] std::unique_ptr<Operation>
48 copy()
const override;
56 [[nodiscard]] std::shared_ptr<const Type>
108 size_t nalternatives,
109 std::vector<std::shared_ptr<const
Type>> match_content_types);
169 size_t numAlternatives,
170 std::vector<std::shared_ptr<const Type>> matchContentTypes)
205 std::vector<EntryVar>
225 std::variant<MatchVar, EntryVar>
245 std::variant<MatchVar, EntryVar>
481 std::optional<rvsdg::Output *>
Conditional operator / pattern matching.
void RemoveEntryVars(const std::vector< EntryVar > &entryVars)
Removes the given entry variables.
const GammaOperation & GetOperation() const noexcept override
ExitVar MapOutputExitVar(const rvsdg::Output &output) const
Maps gamma output to exit variable description.
const rvsdg::Input & mapBranchArgumentToInput(const rvsdg::Output &output) const
Maps branch subregion entry argument to its corresponding gamma input.
std::unique_ptr< GammaOperation > Operation_
std::variant< MatchVar, EntryVar > MapInput(const rvsdg::Input &input) const
Maps gamma input to its role (match variable or entry variable).
static GammaNode & Create(jlm::rvsdg::Output &predicate, size_t numAlternatives, std::vector< std::shared_ptr< const Type >> matchContentTypes)
GammaNode * copy(jlm::rvsdg::Region *region, SubstitutionMap &smap) const override
Copy a node with substitutions.
EntryVar AddEntryVar(rvsdg::Output *origin)
Routes a variable into the gamma branches.
EntryVar GetEntryVar(std::size_t index) const
Gets entry variable by index.
std::vector< Output * > GetOutputsWhere(const F &match)
Gets all gamma outputs that match the condition defined by match.
GammaNode(rvsdg::Output &predicate, std::unique_ptr< GammaOperation > op)
static GammaNode & Create(jlm::rvsdg::Output &predicate, std::unique_ptr< GammaOperation > op)
std::variant< MatchVar, EntryVar > MapBranchArgument(const rvsdg::Output &output) const
Maps branch subregion entry argument to its role (pattern match or entry variable).
std::vector< ExitVar > GetExitVars() const
Gets all exit variables for this gamma.
const Output & mapBranchResultToOutput(const Input &input) const
Maps branch subregion exit result to its corresponding gamma output.
std::vector< EntryVar > GetEntryVars() const
Gets all entry variables for this gamma.
static GammaNode * create(jlm::rvsdg::Output *predicate, size_t nalternatives)
void RemoveExitVars(const std::vector< Output * > &gammaOutputs)
Removes the exit variables corresponding to the given gammaOutputs.
ExitVar MapBranchResultExitVar(const rvsdg::Input &input) const
Maps gamma region exit result to exit variable description.
rvsdg::Input * predicate() const noexcept
~GammaNode() noexcept override
ExitVar AddExitVar(const std::vector< rvsdg::Output * > &values)
Routes per-branch result of gamma to output.
MatchVar GetMatchVar() const
std::shared_ptr< const Type > GetMatchContentType(std::size_t alternative) const
Returns the type of pattern matching content produced in a branch.
std::unique_ptr< Operation > copy() const override
GammaOperation(size_t numAlternatives, std::vector< std::shared_ptr< const Type >> matchContentTypes) noexcept
GammaOperation(size_t numAlternatives) noexcept
bool operator==(const Operation &other) const noexcept override
std::vector< std::shared_ptr< const Type > > MatchContentTypes_
std::string debug_string() const override
~GammaOperation() noexcept override
size_t nalternatives() const noexcept
OutputIteratorRange Outputs() noexcept
rvsdg::Region * region() const noexcept
bool IsDead() const noexcept
Represent acyclic RVSDG subgraphs.
StructuralOutput * output(size_t index) const noexcept
StructuralInput * input(size_t index) const noexcept
bool ReduceGammaControlConstant(Node &node)
bool ReduceGammaWithStaticallyKnownPredicate(Node &node)
static std::vector< jlm::rvsdg::Output * > outputs(const Node *node)
std::optional< rvsdg::Output * > GetGammaInvariantOrigin(const GammaNode &gamma, const GammaNode::ExitVar &exitvar)
Determines whether a gamma exit var is path-invariant.
bool ReduceGammaInvariantVariables(Node &node)
A variable routed into all gamma regions.
rvsdg::Input * input
Variable at entry point (input to gamma node).
std::vector< rvsdg::Output * > branchArgument
Variable inside each of the branch regions (argument per subregion).
A variable routed out of all gamma regions as result.
rvsdg::Output * output
Output of gamma.
std::vector< rvsdg::Input * > branchResult
Variable exit points (results per subregion).
The match/discriminator variable of this gamma node.
rvsdg::Input * input
The variable matched over (i.e. the "selector" of the gamma branch).
std::vector< rvsdg::Output * > matchContent
The content of the match per branch.