MLIR  20.0.0git
Typedefs | Functions
ControlFlowInterfaces.cpp File Reference
#include <utility>
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "llvm/ADT/SmallPtrSet.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. More...
 

Functions

static InFlightDiagnosticprintRegionEdgeName (InFlightDiagnostic &diag, RegionBranchPoint sourceNo, RegionBranchPoint succRegionNo)
 
static LogicalResult verifyTypesAlongAllEdges (Operation *op, RegionBranchPoint sourcePoint, function_ref< FailureOr< TypeRange >(RegionBranchPoint)> getInputsTypesForRegion)
 Verify that types match along all region control flow edges originating from sourcePoint. More...
 
static bool traverseRegionGraph (Region *begin, StopConditionFn stopConditionFn)
 Traverse the region graph starting at begin. More...
 
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). More...
 

Typedef Documentation

◆ StopConditionFn

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 226 of file ControlFlowInterfaces.cpp.

Function Documentation

◆ isRegionReachable()

static bool isRegionReachable ( Region begin,
Region r 
)
static

Return true if region r is reachable from region begin according to the RegionBranchOpInterface (by taking a branch).

Definition at line 265 of file ControlFlowInterfaces.cpp.

◆ printRegionEdgeName()

static InFlightDiagnostic& printRegionEdgeName ( InFlightDiagnostic diag,
RegionBranchPoint  sourceNo,
RegionBranchPoint  succRegionNo 
)
static

◆ traverseRegionGraph()

static bool traverseRegionGraph ( Region begin,
StopConditionFn  stopConditionFn 
)
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 232 of file ControlFlowInterfaces.cpp.

References mlir::Operation::getNumRegions(), mlir::Region::getParentOp(), and mlir::Region::getRegionNumber().

◆ verifyTypesAlongAllEdges()

static LogicalResult verifyTypesAlongAllEdges ( Operation op,
RegionBranchPoint  sourcePoint,
function_ref< FailureOr< TypeRange >(RegionBranchPoint)>  getInputsTypesForRegion 
)
static

Verify that types match along all region control flow edges originating from sourcePoint.

getInputsTypesForRegion is a function that returns the types of the inputs that flow to a successor region.

Definition at line 108 of file ControlFlowInterfaces.cpp.

References diag(), mlir::Operation::emitOpError(), mlir::detail::enumerate(), and printRegionEdgeName().

Referenced by mlir::detail::verifyTypesAlongControlFlowEdges().