MLIR  20.0.0git
Public Member Functions | List of all members
mlir::WalkStage Class Reference

A utility class to encode the current walk stage for "generic" walkers. More...

#include "mlir/IR/Visitors.h"

Public Member Functions

 WalkStage (Operation *op)
 
bool isBeforeAllRegions () const
 Return true if parent operation is being visited before all regions. More...
 
bool isBeforeRegion (int region) const
 Returns true if parent operation is being visited just before visiting region number region. More...
 
bool isAfterRegion (int region) const
 Returns true if parent operation is being visited just after visiting region number region. More...
 
bool isAfterAllRegions () const
 Return true if parent operation is being visited after all regions. More...
 
void advance ()
 Advance the walk stage. More...
 
int getNextRegion () const
 Returns the next region that will be visited. More...
 

Detailed Description

A utility class to encode the current walk stage for "generic" walkers.

When walking an operation, we can either choose a Pre/Post order walker which invokes the callback on an operation before/after all its attached regions have been visited, or choose a "generic" walker where the callback is invoked on the operation N+1 times where N is the number of regions attached to that operation. The WalkStage class below encodes the current stage of the walk, i.e., which regions have already been visited, and the callback accepts an additional argument for the current stage. Such generic walkers that accept stage-aware callbacks are only applicable when the callback operates on an operation (i.e., not applicable for callbacks on Blocks or Regions).

Definition at line 87 of file Visitors.h.

Constructor & Destructor Documentation

◆ WalkStage()

WalkStage::WalkStage ( Operation op)
explicit

Definition at line 14 of file Visitors.cpp.

Member Function Documentation

◆ advance()

void mlir::WalkStage::advance ( )
inline

Advance the walk stage.

Definition at line 102 of file Visitors.h.

◆ getNextRegion()

int mlir::WalkStage::getNextRegion ( ) const
inline

Returns the next region that will be visited.

Definition at line 104 of file Visitors.h.

◆ isAfterAllRegions()

bool mlir::WalkStage::isAfterAllRegions ( ) const
inline

Return true if parent operation is being visited after all regions.

Definition at line 100 of file Visitors.h.

◆ isAfterRegion()

bool mlir::WalkStage::isAfterRegion ( int  region) const
inline

Returns true if parent operation is being visited just after visiting region number region.

Definition at line 98 of file Visitors.h.

◆ isBeforeAllRegions()

bool mlir::WalkStage::isBeforeAllRegions ( ) const
inline

Return true if parent operation is being visited before all regions.

Definition at line 92 of file Visitors.h.

◆ isBeforeRegion()

bool mlir::WalkStage::isBeforeRegion ( int  region) const
inline

Returns true if parent operation is being visited just before visiting region number region.

Definition at line 95 of file Visitors.h.


The documentation for this class was generated from the following files: