MLIR 22.0.0git
mlir::query::matcher::internal Namespace Reference

Classes

struct  ArgTypeTraits
struct  ArgTypeTraits< bool >
struct  ArgTypeTraits< const T & >
struct  ArgTypeTraits< DynMatcher >
struct  ArgTypeTraits< int64_t >
struct  ArgTypeTraits< llvm::StringRef >
class  Diagnostics
class  FixedArgCountMatcherDescriptor
class  MatcherDescriptor
class  Parser
struct  SourceLocation
struct  SourceRange
class  VariadicOperatorMatcherDescriptor

Enumerations

enum class  ErrorType {
  None , ParserChainedExprInvalidArg , ParserChainedExprNoCloseParen , ParserChainedExprNoOpenParen ,
  ParserFailedToBuildMatcher , ParserInvalidToken , ParserMalformedChainedExpr , ParserNoCloseParen ,
  ParserNoCode , ParserNoComma , ParserNoOpenParen , ParserNotAMatcher ,
  ParserOverloadedType , ParserStringError , ParserTrailingCode , RegistryMatcherNotFound ,
  RegistryNotBindable , RegistryValueNotFound , RegistryWrongArgCount , RegistryWrongArgType
}

Functions

void addError (Diagnostics *error, SourceRange range, ErrorType errorType, std::initializer_list< llvm::Twine > errorTexts)
bool checkArgCount (SourceRange nameRange, size_t expectedArgCount, llvm::ArrayRef< ParserValue > args, Diagnostics *error)
template<typename ArgType, size_t Index>
bool checkArgTypeAtIndex (llvm::StringRef matcherName, llvm::ArrayRef< ParserValue > args, Diagnostics *error)
template<typename ReturnType, typename... ArgTypes, size_t... Is>
static VariantMatcher matcherMarshallFixedImpl (void(*matcherFunc)(), llvm::StringRef matcherName, SourceRange nameRange, llvm::ArrayRef< ParserValue > args, Diagnostics *error, std::index_sequence< Is... >)
template<typename ReturnType, typename... ArgTypes>
static VariantMatcher matcherMarshallFixed (void(*matcherFunc)(), llvm::StringRef matcherName, SourceRange nameRange, llvm::ArrayRef< ParserValue > args, Diagnostics *error)
template<typename ReturnType, typename... ArgTypes>
std::unique_ptr< MatcherDescriptormakeMatcherAutoMarshall (ReturnType(*matcherFunc)(ArgTypes...), llvm::StringRef matcherName)
template<unsigned MinCount, unsigned MaxCount>
std::unique_ptr< MatcherDescriptormakeMatcherAutoMarshall (VariadicOperatorMatcherFunc< MinCount, MaxCount > func, StringRef matcherName)
bool allOfVariadicOperator (Operation *op, SetVector< Operation * > *matchedOps, ArrayRef< DynMatcher > innerMatchers)
bool anyOfVariadicOperator (Operation *op, SetVector< Operation * > *matchedOps, ArrayRef< DynMatcher > innerMatchers)
static llvm::StringRef errorTypeToFormatString (ErrorType type)
static void formatErrorString (llvm::StringRef formatString, llvm::ArrayRef< std::string > args, llvm::raw_ostream &os)
static void maybeAddLineAndColumn (SourceRange range, llvm::raw_ostream &os)

Variables

const VariadicOperatorMatcherFunc< 1, std::numeric_limits< unsigned >::max()> anyOf = {DynMatcher::AnyOf}
const VariadicOperatorMatcherFunc< 1, std::numeric_limits< unsigned >::max()> allOf = {DynMatcher::AllOf}

Enumeration Type Documentation

◆ ErrorType

Enumerator
None 
ParserChainedExprInvalidArg 
ParserChainedExprNoCloseParen 
ParserChainedExprNoOpenParen 
ParserFailedToBuildMatcher 
ParserInvalidToken 
ParserMalformedChainedExpr 
ParserNoCloseParen 
ParserNoCode 
ParserNoComma 
ParserNoOpenParen 
ParserNotAMatcher 
ParserOverloadedType 
ParserStringError 
ParserTrailingCode 
RegistryMatcherNotFound 
RegistryNotBindable 
RegistryValueNotFound 
RegistryWrongArgCount 
RegistryWrongArgType 

Definition at line 36 of file ErrorBuilder.h.

Function Documentation

◆ addError()

void mlir::query::matcher::internal::addError ( Diagnostics * error,
SourceRange range,
ErrorType errorType,
std::initializer_list< llvm::Twine > errorTexts )

◆ allOfVariadicOperator()

bool mlir::query::matcher::internal::allOfVariadicOperator ( Operation * op,
SetVector< Operation * > * matchedOps,
ArrayRef< DynMatcher > innerMatchers )

Definition at line 15 of file MatchersInternal.cpp.

◆ anyOfVariadicOperator()

bool mlir::query::matcher::internal::anyOfVariadicOperator ( Operation * op,
SetVector< Operation * > * matchedOps,
ArrayRef< DynMatcher > innerMatchers )

Definition at line 23 of file MatchersInternal.cpp.

◆ checkArgCount()

bool mlir::query::matcher::internal::checkArgCount ( SourceRange nameRange,
size_t expectedArgCount,
llvm::ArrayRef< ParserValue > args,
Diagnostics * error )
inline

Definition at line 210 of file Marshallers.h.

References addError(), and RegistryWrongArgCount.

Referenced by matcherMarshallFixedImpl().

◆ checkArgTypeAtIndex()

template<typename ArgType, size_t Index>
bool mlir::query::matcher::internal::checkArgTypeAtIndex ( llvm::StringRef matcherName,
llvm::ArrayRef< ParserValue > args,
Diagnostics * error )
inline

Definition at line 223 of file Marshallers.h.

References addError(), and RegistryWrongArgType.

Referenced by matcherMarshallFixedImpl().

◆ errorTypeToFormatString()

◆ formatErrorString()

void mlir::query::matcher::internal::formatErrorString ( llvm::StringRef formatString,
llvm::ArrayRef< std::string > args,
llvm::raw_ostream & os )
static

Definition at line 79 of file Diagnostics.cpp.

◆ makeMatcherAutoMarshall() [1/2]

template<typename ReturnType, typename... ArgTypes>
std::unique_ptr< MatcherDescriptor > mlir::query::matcher::internal::makeMatcherAutoMarshall ( ReturnType(* matcherFunc )(ArgTypes...),
llvm::StringRef matcherName )

Definition at line 271 of file Marshallers.h.

References matcherMarshallFixed().

Referenced by mlir::query::matcher::Registry::registerMatcher().

◆ makeMatcherAutoMarshall() [2/2]

template<unsigned MinCount, unsigned MaxCount>
std::unique_ptr< MatcherDescriptor > mlir::query::matcher::internal::makeMatcherAutoMarshall ( VariadicOperatorMatcherFunc< MinCount, MaxCount > func,
StringRef matcherName )

Definition at line 283 of file Marshallers.h.

◆ matcherMarshallFixed()

template<typename ReturnType, typename... ArgTypes>
VariantMatcher mlir::query::matcher::internal::matcherMarshallFixed ( void(* matcherFunc )(),
llvm::StringRef matcherName,
SourceRange nameRange,
llvm::ArrayRef< ParserValue > args,
Diagnostics * error )
static

Definition at line 260 of file Marshallers.h.

References matcherMarshallFixedImpl().

Referenced by makeMatcherAutoMarshall().

◆ matcherMarshallFixedImpl()

template<typename ReturnType, typename... ArgTypes, size_t... Is>
VariantMatcher mlir::query::matcher::internal::matcherMarshallFixedImpl ( void(* matcherFunc )(),
llvm::StringRef matcherName,
SourceRange nameRange,
llvm::ArrayRef< ParserValue > args,
Diagnostics * error,
std::index_sequence< Is... >  )
static

◆ maybeAddLineAndColumn()

void mlir::query::matcher::internal::maybeAddLineAndColumn ( SourceRange range,
llvm::raw_ostream & os )
static

Variable Documentation

◆ allOf

const VariadicOperatorMatcherFunc<1, std::numeric_limits<unsigned>::max()> mlir::query::matcher::internal::allOf = {DynMatcher::AllOf}

Definition at line 222 of file MatchersInternal.h.

◆ anyOf

const VariadicOperatorMatcherFunc<1, std::numeric_limits<unsigned>::max()> mlir::query::matcher::internal::anyOf = {DynMatcher::AnyOf}

Definition at line 220 of file MatchersInternal.h.