MLIR
17.0.0git
|
This base class exposes generic asm printer hooks, usable across the various derived printers. More...
#include "mlir/IR/OpImplementation.h"
Classes | |
class | Impl |
Public Types | |
template<typename AttrOrType > | |
using | has_print_method = decltype(std::declval< AttrOrType >().print(std::declval< AsmPrinter & >())) |
Trait to check if AttrType provides a print method. More... | |
template<typename AttrOrType > | |
using | detect_has_print_method = llvm::is_detected< has_print_method, AttrOrType > |
Public Member Functions | |
AsmPrinter (Impl &impl) | |
Initialize the printer with the given internal implementation. More... | |
virtual | ~AsmPrinter () |
virtual raw_ostream & | getStream () const |
Return the raw output stream used by this printer. More... | |
virtual void | printFloat (const APFloat &value) |
Print the given floating point value in a stabilized form that can be roundtripped through the IR. More... | |
virtual void | printType (Type type) |
virtual void | printAttribute (Attribute attr) |
template<typename AttrOrType , std::enable_if_t< detect_has_print_method< AttrOrType >::value > * sfinae = nullptr> | |
void | printStrippedAttrOrType (AttrOrType attrOrType) |
Print the provided attribute in the context of an operation custom printer/parser: this will invoke directly the print method on the attribute class and skip the #dialect.mnemonic prefix in most cases. More... | |
template<typename AttrOrType , std::enable_if_t< detect_has_print_method< AttrOrType >::value > * sfinae = nullptr> | |
void | printStrippedAttrOrType (ArrayRef< AttrOrType > attrOrTypes) |
Print the provided array of attributes or types in the context of an operation custom printer/parser: this will invoke directly the print method on the attribute class and skip the #dialect.mnemonic prefix in most cases. More... | |
template<typename AttrOrType , std::enable_if_t<!detect_has_print_method< AttrOrType >::value > * sfinae = nullptr> | |
void | printStrippedAttrOrType (AttrOrType attrOrType) |
SFINAE for printing the provided attribute in the context of an operation custom printer in the case where the attribute does not define a print method. More... | |
virtual void | printAttributeWithoutType (Attribute attr) |
Print the given attribute without its type. More... | |
virtual void | printKeywordOrString (StringRef keyword) |
Print the given string as a keyword, or a quoted and escaped string if it has any special or non-printable characters in it. More... | |
virtual void | printSymbolName (StringRef symbolRef) |
Print the given string as a symbol reference, i.e. More... | |
virtual void | printResourceHandle (const AsmDialectResourceHandle &resource) |
Print a handle to the given dialect resource. More... | |
template<typename TypeRange > | |
void | printOptionalArrowTypeList (TypeRange &&types) |
Print an optional arrow followed by a type list. More... | |
template<typename TypeRange > | |
void | printArrowTypeList (TypeRange &&types) |
template<typename InputRangeT , typename ResultRangeT > | |
void | printFunctionalType (InputRangeT &&inputs, ResultRangeT &&results) |
Print the two given type ranges in a functional form. More... | |
Protected Member Functions | |
AsmPrinter ()=default | |
Initialize the printer with no internal implementation. More... | |
This base class exposes generic asm printer hooks, usable across the various derived printers.
Definition at line 106 of file OpImplementation.h.
using mlir::AsmPrinter::detect_has_print_method = llvm::is_detected<has_print_method, AttrOrType> |
Definition at line 132 of file OpImplementation.h.
using mlir::AsmPrinter::has_print_method = decltype(std::declval<AttrOrType>().print(std::declval<AsmPrinter &>())) |
Trait to check if AttrType
provides a print
method.
Definition at line 129 of file OpImplementation.h.
|
inline |
Initialize the printer with the given internal implementation.
Definition at line 113 of file OpImplementation.h.
|
virtualdefault |
|
protecteddefault |
Initialize the printer with no internal implementation.
In this case, all virtual methods of this class must be overriden.
|
virtual |
Return the raw output stream used by this printer.
Definition at line 2619 of file AsmPrinter.cpp.
Referenced by mlir::detail::DenseArrayAttrImpl< T >::print(), print(), printArrowTypeList(), printFunctionalType(), printFunctionResultList(), mlir::function_interface_impl::printFunctionSignature(), mlir::OpAsmPrinter::printOperands(), mlir::OpState::printOpName(), printStrippedAttrOrType(), and typeOrAttrPrinter().
|
inline |
Definition at line 194 of file OpImplementation.h.
References getStream().
Referenced by printFunctionalType(), and printOptionalArrowTypeList().
|
virtual |
Definition at line 2635 of file AsmPrinter.cpp.
Referenced by mlir::AsmPrinter::Impl::printLocationInternal(), and printTypedInitialValue().
|
virtual |
Print the given attribute without its type.
The corresponding parser must provide a valid type for the attribute.
Definition at line 2650 of file AsmPrinter.cpp.
References mlir::AsmPrinter::Impl::Must.
Referenced by printGlobalMemrefOpTypeAndInitialValue().
|
virtual |
Print the given floating point value in a stabilized form that can be roundtripped through the IR.
Print the given floating point value in a stablized form.
This is the companion to the 'parseFloat' hook on the AsmParser.
Definition at line 2625 of file AsmPrinter.cpp.
References printFloatValue().
|
inline |
Print the two given type ranges in a functional form.
Definition at line 208 of file OpImplementation.h.
References getStream(), and printArrowTypeList().
|
virtual |
Print the given string as a keyword, or a quoted and escaped string if it has any special or non-printable characters in it.
Definition at line 2656 of file AsmPrinter.cpp.
|
inline |
Print an optional arrow followed by a type list.
Definition at line 189 of file OpImplementation.h.
References printArrowTypeList().
Referenced by printNamedStructuredOpResults().
|
virtual |
Print a handle to the given dialect resource.
Definition at line 2666 of file AsmPrinter.cpp.
|
inline |
Print the provided array of attributes or types in the context of an operation custom printer/parser: this will invoke directly the print method on the attribute class and skip the #dialect.mnemonic
prefix in most cases.
Definition at line 154 of file OpImplementation.h.
References getStream(), and printStrippedAttrOrType().
|
inline |
Print the provided attribute in the context of an operation custom printer/parser: this will invoke directly the print method on the attribute class and skip the #dialect.mnemonic
prefix in most cases.
Definition at line 141 of file OpImplementation.h.
References mlir::succeeded().
Referenced by printStrippedAttrOrType().
|
inline |
SFINAE for printing the provided attribute in the context of an operation custom printer in the case where the attribute does not define a print method.
Definition at line 166 of file OpImplementation.h.
|
virtual |
Print the given string as a symbol reference, i.e.
a form representable by a SymbolRefAttr. A symbol reference is represented as a string prefixed with '@'. The reference is surrounded with ""'s and escaped if it has any special or non-printable characters in it.
Definition at line 2661 of file AsmPrinter.cpp.
References printSymbolReference().
Referenced by mlir::function_interface_impl::printFunctionOp().
|
virtual |
Definition at line 2630 of file AsmPrinter.cpp.
Referenced by dispatchPrint(), mlir::function_interface_impl::printFunctionSignature(), printLaunchFuncOperands(), and printTokenOrdering().