|
MLIR 23.0.0git
|
#include <map>#include <utility>#include "mlir/IR/BuiltinTypes.h"#include "mlir/IR/Matchers.h"#include "mlir/IR/Operation.h"#include "mlir/IR/PatternMatch.h"#include "mlir/Interfaces/ControlFlowInterfaces.h"#include "llvm/ADT/EquivalenceClasses.h"#include "llvm/Support/DebugLog.h"#include "mlir/Interfaces/ControlFlowInterfaces.cpp.inc"Go to the source code of this file.
Typedefs | |
| using | StopConditionFn = function_ref<bool(Region *, ArrayRef<bool> visited)> |
| Stop condition for traverseRegionGraph. | |
Functions | |
| static LogicalResult | verifyWeights (Operation *op, llvm::ArrayRef< int32_t > weights, std::size_t expectedWeightsNum, llvm::StringRef weightAnchorName, llvm::StringRef weightRefName) |
| static bool | traverseRegionGraph (Region *begin, StopConditionFn stopConditionFn) |
| Traverse the region graph starting at begin. | |
| static bool | isRegionReachable (Region *begin, Region *r) |
| Return true if region r is reachable from region begin according to the RegionBranchOpInterface (by taking a branch). | |
| static MutableArrayRef< OpOperand > | operandsToOpOperands (OperandRange &operands) |
| static void | getSuccessorOperandInputMapping (RegionBranchOpInterface branchOp, RegionBranchSuccessorMapping &mapping, RegionBranchPoint src) |
| static RegionBranchInverseSuccessorMapping | invertRegionBranchSuccessorMapping (const RegionBranchSuccessorMapping &operandToInputs) |
| static bool | isDefinedBefore (Operation *regionBranchOp, Value a, Value b) |
| Return "true" if a can be used in lieu of b, where b is a region successor input and a is a "reachable value" of b. | |
| static LogicalResult | computeReachableValuesFromSuccessorInput (llvm::SmallDenseSet< Value > &result, Value value, const RegionBranchInverseSuccessorMapping &inputToOperands, std::optional< unsigned > maxReachableValues=std::nullopt) |
| Compute all non-successor-input values that a successor input could have based on the given successor input to successor operand mapping. | |
| using StopConditionFn = function_ref<bool(Region *, ArrayRef<bool> visited)> |
Stop condition for traverseRegionGraph.
The traversal is interrupted if this function returns "true" for a successor region. The first parameter is the successor region. The second parameter indicates all already visited regions.
Definition at line 228 of file ControlFlowInterfaces.cpp.
|
static |
Compute all non-successor-input values that a successor input could have based on the given successor input to successor operand mapping.
Starting with the given value, trace back all predecessor values (i.e., preceding successor operands) and add them to the set of reachable values. If the successor operand is again a successor input, do not add it to the result set, but instead continue the traversal.
If maxReachableValues is set, the traversal is aborted early and failure is returned as soon as the number of reachable values exceeds the limit. Otherwise, success is returned and the result set contains all reachable values.
Example 1: r = scf.if ... { scf.yield a : ... } else { scf.yield b : ... } reachableValues(r) = {a, b}
Example 2: r = scf.for ... iter_args(arg0 = %0) -> ... { scf.yield arg0 : ... } reachableValues(arg0) = {%0} reachableValues(r) = {%0}
Example 3: r = scf.for ... iter_args(arg0 = %0) -> ... { ... scf.yield %1 : ... } reachableValues(arg0) = {%0, %1} reachableValues(r) = {%0, %1}
Definition at line 666 of file ControlFlowInterfaces.cpp.
References mlir::IROperand< DerivedT, IRValueT >::get(), result, and success().
|
static |
Definition at line 470 of file ControlFlowInterfaces.cpp.
References operandsToOpOperands().
|
static |
Definition at line 497 of file ControlFlowInterfaces.cpp.
Return "true" if a can be used in lieu of b, where b is a region successor input and a is a "reachable value" of b.
Reachable values are successor operand values that are (maybe transitively) forwarded to b.
Definition at line 585 of file ControlFlowInterfaces.cpp.
References b, mlir::Region::getParentOp(), and mlir::Value::getParentRegion().
Return true if region r is reachable from region begin according to the RegionBranchOpInterface (by taking a branch).
Definition at line 309 of file ControlFlowInterfaces.cpp.
References mlir::Region::getParentOp(), and traverseRegionGraph().
|
static |
Definition at line 465 of file ControlFlowInterfaces.cpp.
|
static |
Traverse the region graph starting at begin.
The traversal is interrupted if stopCondition evaluates to "true" for a successor region. In that case, this function returns "true". Otherwise, if the traversal was not interrupted, this function returns "false".
Definition at line 234 of file ControlFlowInterfaces.cpp.
References mlir::Region::getParentOp(), and mlir::Region::getRegionNumber().
Referenced by isRegionReachable().
|
static |
Definition at line 118 of file ControlFlowInterfaces.cpp.
References mlir::Operation::emitError(), and success().
Referenced by mlir::detail::verifyBranchWeights(), and mlir::detail::verifyRegionBranchWeights().