MLIR  20.0.0git
Public Member Functions | Static Public Member Functions | Friends | List of all members
mlir::affine::NestedMatch Class Reference

An NestedPattern captures nested patterns in the IR. More...

#include "mlir/Dialect/Affine/Analysis/NestedMatcher.h"

Public Member Functions

 NestedMatch (const NestedMatch &)=default
 
NestedMatchoperator= (const NestedMatch &)=default
 
 operator bool ()
 
OperationgetMatchedOperation () const
 
ArrayRef< NestedMatchgetMatchedChildren ()
 

Static Public Member Functions

static NestedMatch build (Operation *operation, ArrayRef< NestedMatch > nestedMatches)
 

Friends

class NestedPattern
 
class NestedPatternContext
 

Detailed Description

An NestedPattern captures nested patterns in the IR.

It is used in conjunction with a scoped NestedPatternContext which is an llvm::BumpPtrAllocator that handles memory allocations efficiently and avoids ownership issues.

In order to use NestedPatterns, first create a scoped context. When the context goes out of scope, everything is freed. This design simplifies the API by avoiding references to the context and makes it clear that references to matchers must not escape.

Example: { NestedPatternContext context; auto gemmLike = Doall(Doall(Red(LoadStores()))); auto matches = gemmLike.match(f); // do work on matches } // everything is freed

Nested abstraction for matching results. Provides access to the nested Operation* captured by a Matcher.

A NestedMatch contains an Operation* and the children NestedMatch and is thus cheap to copy. NestedMatch is stored in a scoped bumper allocator whose lifetime is managed by an RAII NestedPatternContext.

Definition at line 47 of file NestedMatcher.h.

Constructor & Destructor Documentation

◆ NestedMatch()

mlir::affine::NestedMatch::NestedMatch ( const NestedMatch )
default

Member Function Documentation

◆ build()

NestedMatch NestedMatch::build ( Operation operation,
ArrayRef< NestedMatch nestedMatches 
)
static

Definition at line 27 of file NestedMatcher.cpp.

◆ getMatchedChildren()

ArrayRef<NestedMatch> mlir::affine::NestedMatch::getMatchedChildren ( )
inline

Definition at line 57 of file NestedMatcher.h.

Referenced by getMatchedAffineLoopsRec().

◆ getMatchedOperation()

Operation* mlir::affine::NestedMatch::getMatchedOperation ( ) const
inline

Definition at line 56 of file NestedMatcher.h.

Referenced by getMatchedAffineLoopsRec().

◆ operator bool()

mlir::affine::NestedMatch::operator bool ( )
inlineexplicit

Definition at line 54 of file NestedMatcher.h.

◆ operator=()

NestedMatch& mlir::affine::NestedMatch::operator= ( const NestedMatch )
default

Friends And Related Function Documentation

◆ NestedPattern

friend class NestedPattern
friend

Definition at line 60 of file NestedMatcher.h.

◆ NestedPatternContext

Definition at line 61 of file NestedMatcher.h.


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