My Project
Public Member Functions | Static Public Member Functions | Friends | List of all members
mlir::NestedMatch Class Reference

#include <NestedMatcher.h>

Public Member Functions

 NestedMatch (const NestedMatch &)=default
 
NestedMatchoperator= (const NestedMatch &)=default
 
 operator bool ()
 
OperationgetMatchedOperation ()
 
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.

Constructor & Destructor Documentation

◆ NestedMatch()

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

Member Function Documentation

◆ build()

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

◆ getMatchedChildren()

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

◆ getMatchedOperation()

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

◆ operator bool()

mlir::NestedMatch::operator bool ( )
inlineexplicit

◆ operator=()

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

Friends And Related Function Documentation

◆ NestedPattern

friend class NestedPattern
friend

◆ NestedPatternContext

friend class NestedPatternContext
friend

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