MLIR  18.0.0git
Public Member Functions | List of all members
mlir::ParserConfig Class Reference

This class represents a configuration for the MLIR assembly parser. More...

#include "mlir/IR/AsmState.h"

Public Member Functions

 ParserConfig (MLIRContext *context, bool verifyAfterParse=true, FallbackAsmResourceMap *fallbackResourceMap=nullptr)
 Construct a parser configuration with the given context. More...
 
MLIRContextgetContext () const
 Return the MLIRContext to be used when parsing. More...
 
bool shouldVerifyAfterParse () const
 Returns if the parser should verify the IR after parsing. More...
 
BytecodeReaderConfiggetBytecodeReaderConfig () const
 Returns the parsing configurations associated to the bytecode read. More...
 
AsmResourceParsergetResourceParser (StringRef name) const
 Return the resource parser registered to the given name, or nullptr if no parser with name is registered. More...
 
void attachResourceParser (std::unique_ptr< AsmResourceParser > parser)
 Attach the given resource parser. More...
 
template<typename CallableT >
std::enable_if_t< std::is_convertible< CallableT, function_ref< LogicalResult(AsmParsedResourceEntry &)> >::value > attachResourceParser (StringRef name, CallableT &&parserFn)
 Attach the given callable resource parser with the given name. More...
 

Detailed Description

This class represents a configuration for the MLIR assembly parser.

It contains all of the necessary state to parse a MLIR source file.

Definition at line 460 of file AsmState.h.

Constructor & Destructor Documentation

◆ ParserConfig()

mlir::ParserConfig::ParserConfig ( MLIRContext context,
bool  verifyAfterParse = true,
FallbackAsmResourceMap fallbackResourceMap = nullptr 
)
inline

Construct a parser configuration with the given context.

verifyAfterParse indicates if the IR should be verified after parsing. fallbackResourceMap is an optional fallback handler that can be used to parse external resources not explicitly handled by another parser.

Definition at line 466 of file AsmState.h.

Member Function Documentation

◆ attachResourceParser() [1/2]

void mlir::ParserConfig::attachResourceParser ( std::unique_ptr< AsmResourceParser parser)
inline

Attach the given resource parser.

Definition at line 496 of file AsmState.h.

Referenced by mlir::PassReproducerOptions::attachResourceParser(), and attachResourceParser().

◆ attachResourceParser() [2/2]

template<typename CallableT >
std::enable_if_t<std::is_convertible< CallableT, function_ref<LogicalResult(AsmParsedResourceEntry &)> >::value> mlir::ParserConfig::attachResourceParser ( StringRef  name,
CallableT &&  parserFn 
)
inline

Attach the given callable resource parser with the given name.

Definition at line 508 of file AsmState.h.

References attachResourceParser(), and mlir::AsmResourceParser::fromCallable().

◆ getBytecodeReaderConfig()

BytecodeReaderConfig& mlir::ParserConfig::getBytecodeReaderConfig ( ) const
inline

Returns the parsing configurations associated to the bytecode read.

Definition at line 480 of file AsmState.h.

◆ getContext()

MLIRContext* mlir::ParserConfig::getContext ( ) const
inline

◆ getResourceParser()

AsmResourceParser* mlir::ParserConfig::getResourceParser ( StringRef  name) const
inline

Return the resource parser registered to the given name, or nullptr if no parser with name is registered.

Definition at line 486 of file AsmState.h.

References mlir::FallbackAsmResourceMap::getParserFor().

◆ shouldVerifyAfterParse()

bool mlir::ParserConfig::shouldVerifyAfterParse ( ) const
inline

Returns if the parser should verify the IR after parsing.

Definition at line 477 of file AsmState.h.


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