|
MLIR 24.0.0git
|
Public Types | |
| enum class | AttrTypeElision { Never , May , Must } |
| This enum describes the different kinds of elision for the type of an attribute when printing it. More... | |
Public Member Functions | |
| Impl (raw_ostream &os, AsmStateImpl &state) | |
| Impl (Impl &other) | |
| raw_ostream & | getStream () |
| Returns the output stream of the printer. | |
| void | printNewline () |
| Print a newline and indent the printer to the start of the current operation/attribute/type. | |
| void | increaseIndent () |
| Increase indentation. | |
| void | decreaseIndent () |
| Decrease indentation. | |
| template<typename Container, typename UnaryFunctor> | |
| void | interleaveComma (const Container &c, UnaryFunctor eachFn) const |
| void | printAttribute (Attribute attr, AttrTypeElision typeElision=AttrTypeElision::Never) |
| Print the given attribute or an alias. | |
| void | printAttributeImpl (Attribute attr, AttrTypeElision typeElision=AttrTypeElision::Never) |
| Print the given attribute without considering an alias. | |
| void | printNamedAttribute (NamedAttribute attr) |
| LogicalResult | printAlias (Attribute attr) |
| Print the alias for the given attribute, return failure if no alias could be printed. | |
| void | printType (Type type) |
| Print the given type or an alias. | |
| void | printTypeImpl (Type type) |
| Print the given type. | |
| LogicalResult | printAlias (Type type) |
| Print the alias for the given type, return failure if no alias could be printed. | |
| void | printLocation (LocationAttr loc, bool allowAlias=false) |
| Print the given location to the stream. | |
| void | printResourceHandle (const AsmDialectResourceHandle &resource) |
| Print a reference to the given resource that is owned by the given dialect. | |
| void | printAffineMap (AffineMap map) |
| void | printAffineExpr (AffineExpr expr, function_ref< void(unsigned, bool)> printValueName=nullptr) |
| void | printAffineConstraint (AffineExpr expr, bool isEq) |
| void | printIntegerSet (IntegerSet set) |
| LogicalResult | pushCyclicPrinting (const void *opaquePointer) |
| void | popCyclicPrinting () |
| void | printDimensionList (ArrayRef< int64_t > shape) |
Protected Types | |
| enum class | BindingStrength { Weak , Strong } |
| This enum is used to represent the binding strength of the enclosing context that an AffineExprStorage is being printed in, so we can intelligently produce parens. More... | |
Protected Member Functions | |
| void | printOptionalAttrDict (ArrayRef< NamedAttribute > attrs, ArrayRef< StringRef > elidedAttrs={}, bool withKeyword=false) |
| void | printTrailingLocation (Location loc, bool allowAlias=true) |
| void | printLocationInternal (LocationAttr loc, bool pretty=false, bool isTopLevel=false) |
| void | printDenseElementsAttr (DenseElementsAttr attr, bool allowHex) |
| Print a dense elements attribute. | |
| void | printDenseStringElementsAttr (DenseStringElementsAttr attr) |
| Print a dense string elements attribute. | |
| void | printDenseTypedElementsAttr (DenseTypedElementsAttr attr, bool allowHex) |
| Print a dense elements attribute in the literal-first syntax. | |
| void | printTypeFirstDenseElementsAttr (DenseElementsAttr attr, DenseElementType denseEltType) |
| Print a dense elements attribute using the type-first syntax and the DenseElementTypeInterface, which provides the attribute printer for each element. | |
| void | printDenseArrayAttr (DenseArrayAttr attr) |
| Print a dense array attribute. | |
| void | printDialectAttribute (Attribute attr) |
| void | printDialectType (Type type) |
| void | printEscapedString (StringRef str) |
| Print an escaped string, wrapped with "". | |
| void | printHexString (StringRef str) |
| Print a hex string, wrapped with "". | |
| void | printHexString (ArrayRef< char > data) |
| void | printAffineExprInternal (AffineExpr expr, BindingStrength enclosingTightness, function_ref< void(unsigned, bool)> printValueName=nullptr) |
Protected Attributes | |
| raw_ostream & | os |
| The output stream for the printer. | |
| AsmStateImpl & | state |
| An underlying assembly printer state. | |
| OpPrintingFlags | printerFlags |
| A set of flags to control the printer's behavior. | |
| NewLineCounter | newLine |
| A tracker for the number of new lines emitted during printing. | |
| unsigned | currentIndent = 0 |
| This is the current indentation level for nested structures. | |
Static Protected Attributes | |
| static const unsigned | indentWidth = 2 |
| The number of spaces used as an indent. | |
Definition at line 438 of file AsmPrinter.cpp.
|
strong |
This enum describes the different kinds of elision for the type of an attribute when printing it.
Definition at line 468 of file AsmPrinter.cpp.
|
strongprotected |
This enum is used to represent the binding strength of the enclosing context that an AffineExprStorage is being printed in, so we can intelligently produce parens.
| Enumerator | |
|---|---|
| Weak | |
| Strong | |
Definition at line 562 of file AsmPrinter.cpp.
| AsmPrinter::Impl::Impl | ( | raw_ostream & | os, |
| AsmStateImpl & | state ) |
Definition at line 2188 of file AsmPrinter.cpp.
References os, printerFlags, and state.
Referenced by Impl(), printDialectAttribute(), and printDialectType().
|
inlineexplicit |
Definition at line 441 of file AsmPrinter.cpp.
|
inline |
Decrease indentation.
Definition at line 459 of file AsmPrinter.cpp.
References currentIndent, and indentWidth.
|
inline |
Returns the output stream of the printer.
Definition at line 444 of file AsmPrinter.cpp.
References os.
Referenced by printDenseArrayAttr().
|
inline |
Increase indentation.
Definition at line 456 of file AsmPrinter.cpp.
References currentIndent, and indentWidth.
|
inline |
Definition at line 462 of file AsmPrinter.cpp.
References os.
Referenced by printAffineMap(), printAttributeImpl(), printLocationInternal(), printOptionalAttrDict(), and printTypeImpl().
| void AsmPrinter::Impl::popCyclicPrinting | ( | ) |
Definition at line 3076 of file AsmPrinter.cpp.
References state.
| void AsmPrinter::Impl::printAffineConstraint | ( | AffineExpr | expr, |
| bool | isEq ) |
Definition at line 3322 of file AsmPrinter.cpp.
References os, printAffineExprInternal(), and Weak.
Referenced by printIntegerSet().
| void AsmPrinter::Impl::printAffineExpr | ( | AffineExpr | expr, |
| function_ref< void(unsigned, bool)> | printValueName = nullptr ) |
Definition at line 3181 of file AsmPrinter.cpp.
References printAffineExprInternal(), and Weak.
Referenced by mlir::AffineExpr::print().
|
protected |
Definition at line 3186 of file AsmPrinter.cpp.
References mlir::Add, mlir::CeilDiv, mlir::Constant, mlir::DimId, mlir::FloorDiv, mlir::AffineExpr::getKind(), mlir::Mod, mlir::Mul, os, printAffineExprInternal(), Strong, mlir::SymbolId, and Weak.
Referenced by printAffineConstraint(), printAffineExpr(), and printAffineExprInternal().
Definition at line 3327 of file AsmPrinter.cpp.
References mlir::AffineMap::getNumDims(), mlir::AffineMap::getNumSymbols(), mlir::AffineMap::getResults(), interleaveComma(), and os.
Referenced by mlir::AffineMap::print().
| LogicalResult AsmPrinter::Impl::printAlias | ( | Attribute | attr | ) |
Print the alias for the given attribute, return failure if no alias could be printed.
Definition at line 2444 of file AsmPrinter.cpp.
Referenced by mlir::Attribute::printStripped().
| LogicalResult AsmPrinter::Impl::printAlias | ( | Type | type | ) |
Print the alias for the given type, return failure if no alias could be printed.
Definition at line 2448 of file AsmPrinter.cpp.
| void AsmPrinter::Impl::printAttribute | ( | Attribute | attr, |
| AttrTypeElision | typeElision = AttrTypeElision::Never ) |
Print the given attribute or an alias.
Definition at line 2452 of file AsmPrinter.cpp.
References os, mlir::AsmPrinter::printAlias(), and printAttributeImpl().
Referenced by mlir::Attribute::print().
| void AsmPrinter::Impl::printAttributeImpl | ( | Attribute | attr, |
| AttrTypeElision | typeElision = AttrTypeElision::Never ) |
Print the given attribute without considering an alias.
Definition at line 2464 of file AsmPrinter.cpp.
References mlir::Attribute::getDialect(), mlir::DistinctAttr::getReferencedAttr(), indices, interleaveComma(), mlir::Type::isSignlessInteger(), mlir::Type::isUnsignedInteger(), May, Must, os, mlir::AsmPrinter::printAttribute(), printDenseArrayAttr(), printDenseElementsAttr(), printDenseStringElementsAttr(), printDenseTypedElementsAttr(), printDialectAttribute(), printDialectSymbol(), printElidedElementsAttr(), printerFlags, printEscapedString(), printFloatValue(), printLocation(), mlir::AsmPrinter::printResourceHandle(), printSymbolReference(), mlir::AsmPrinter::printType(), printTypeFirstDenseElementsAttr(), and state.
Referenced by printAttribute().
|
protected |
Print a dense array attribute.
Definition at line 2796 of file AsmPrinter.cpp.
References getFloatSemantics(), mlir::Type::getIntOrFloatBitWidth(), mlir::AsmPrinter::getStream(), getStream(), mlir::Type::isInteger(), mlir::Type::isIntOrIndex(), printDenseIntElement(), and printFloatValue().
Referenced by printAttributeImpl().
|
protected |
Print a dense elements attribute.
If 'allowHex' is true, a hex string is used instead of individual elements when the elements attr is large.
Definition at line 2687 of file AsmPrinter.cpp.
References printDenseStringElementsAttr(), and printDenseTypedElementsAttr().
Referenced by printAttributeImpl().
|
protected |
Print a dense string elements attribute.
Definition at line 2768 of file AsmPrinter.cpp.
References os, printDenseElementsAttrImpl(), and printEscapedString().
Referenced by printAttributeImpl(), and printDenseElementsAttr().
|
protected |
Print a dense elements attribute in the literal-first syntax.
If 'allowHex' is true, a hex string is used instead of individual elements when the elements attr is large.
Definition at line 2696 of file AsmPrinter.cpp.
References os, printDenseElementsAttrImpl(), printerFlags, and printHexString().
Referenced by printAttributeImpl(), and printDenseElementsAttr().
Definition at line 3017 of file AsmPrinter.cpp.
References currentIndent, mlir::Attribute::getDialect(), Impl(), newLine, os, printDialectSymbol(), and state.
Referenced by printAttributeImpl().
Definition at line 3038 of file AsmPrinter.cpp.
References currentIndent, mlir::Type::getDialect(), Impl(), newLine, os, printDialectSymbol(), and state.
Referenced by printTypeImpl().
Definition at line 3078 of file AsmPrinter.cpp.
References os, and mlir::detail::printDimensionList().
|
protected |
Print an escaped string, wrapped with "".
Definition at line 3059 of file AsmPrinter.cpp.
References os.
Referenced by printAttributeImpl(), printDenseStringElementsAttr(), and printLocationInternal().
Definition at line 3068 of file AsmPrinter.cpp.
References printHexString().
|
protected |
Print a hex string, wrapped with "".
Definition at line 3065 of file AsmPrinter.cpp.
References os.
Referenced by printDenseTypedElementsAttr(), and printHexString().
| void AsmPrinter::Impl::printIntegerSet | ( | IntegerSet | set | ) |
Definition at line 3353 of file AsmPrinter.cpp.
References mlir::IntegerSet::getConstraint(), mlir::IntegerSet::getNumConstraints(), mlir::IntegerSet::getNumDims(), mlir::IntegerSet::getNumSymbols(), mlir::IntegerSet::isEq(), os, and printAffineConstraint().
Referenced by mlir::IntegerSet::print().
| void AsmPrinter::Impl::printLocation | ( | LocationAttr | loc, |
| bool | allowAlias = false ) |
Print the given location to the stream.
If allowAlias is true, this allows for the internal location to use an attribute alias.
Definition at line 2343 of file AsmPrinter.cpp.
References os, mlir::AsmPrinter::printAlias(), printerFlags, and printLocationInternal().
Referenced by printAttributeImpl(), and printTrailingLocation().
|
protected |
Definition at line 2200 of file AsmPrinter.cpp.
References interleaveComma(), newLine, os, mlir::AsmPrinter::printAttribute(), printEscapedString(), printLocationInternal(), and state.
Referenced by printLocation(), and printLocationInternal().
| void AsmPrinter::Impl::printNamedAttribute | ( | NamedAttribute | attr | ) |
Definition at line 3005 of file AsmPrinter.cpp.
References mlir::NamedAttribute::getName(), mlir::NamedAttribute::getValue(), os, mlir::AsmPrinter::printAttribute(), and mlir::AsmPrinter::printKeywordOrString().
|
inline |
Print a newline and indent the printer to the start of the current operation/attribute/type.
Note: For attributes and types this method should only be used in custom dialects. Usage in MLIR dialects is disallowed.
Definition at line 450 of file AsmPrinter.cpp.
References currentIndent, newLine, and os.
|
protected |
Definition at line 2972 of file AsmPrinter.cpp.
References mlir::NamedAttribute::getName(), interleaveComma(), os, and mlir::AsmPrinter::printNamedAttribute().
| void AsmPrinter::Impl::printResourceHandle | ( | const AsmDialectResourceHandle & | resource | ) |
Print a reference to the given resource that is owned by the given dialect.
Definition at line 2437 of file AsmPrinter.cpp.
References mlir::AsmDialectResourceHandle::getDialect(), os, mlir::AsmPrinter::printKeywordOrString(), and state.
Definition at line 2191 of file AsmPrinter.cpp.
References os, printerFlags, and printLocation().
Print the given type or an alias.
Definition at line 2821 of file AsmPrinter.cpp.
References os, mlir::AsmPrinter::printAlias(), and printTypeImpl().
Referenced by mlir::Type::print().
|
protected |
Print a dense elements attribute using the type-first syntax and the DenseElementTypeInterface, which provides the attribute printer for each element.
Definition at line 2775 of file AsmPrinter.cpp.
References mlir::DenseElementsAttr::getRawData(), mlir::DenseElementsAttr::getType(), mlir::DenseElementsAttr::isSplat(), os, printDenseElementsAttrImpl(), and mlir::AsmPrinter::printType().
Referenced by printAttributeImpl().
Print the given type.
Definition at line 2833 of file AsmPrinter.cpp.
References interleaveComma(), May, os, mlir::AsmPrinter::printAttribute(), printDialectSymbol(), printDialectType(), mlir::AsmPrinter::printDimensionList(), and mlir::AsmPrinter::printType().
Referenced by printType().
| LogicalResult AsmPrinter::Impl::pushCyclicPrinting | ( | const void * | opaquePointer | ) |
Definition at line 3072 of file AsmPrinter.cpp.
References state.
|
protected |
This is the current indentation level for nested structures.
Definition at line 586 of file AsmPrinter.cpp.
Referenced by decreaseIndent(), increaseIndent(), printDialectAttribute(), printDialectType(), and printNewline().
|
staticprotected |
The number of spaces used as an indent.
Definition at line 583 of file AsmPrinter.cpp.
Referenced by decreaseIndent(), and increaseIndent().
|
protected |
A tracker for the number of new lines emitted during printing.
Definition at line 580 of file AsmPrinter.cpp.
Referenced by printDialectAttribute(), printDialectType(), printLocationInternal(), and printNewline().
|
protected |
The output stream for the printer.
Definition at line 571 of file AsmPrinter.cpp.
Referenced by getStream(), Impl(), Impl(), interleaveComma(), printAffineConstraint(), printAffineExprInternal(), printAffineMap(), printAlias(), printAlias(), printAttribute(), printAttributeImpl(), printDenseStringElementsAttr(), printDenseTypedElementsAttr(), printDialectAttribute(), printDialectType(), printDimensionList(), printEscapedString(), printHexString(), printIntegerSet(), printLocation(), printLocationInternal(), printNamedAttribute(), printNewline(), printOptionalAttrDict(), printResourceHandle(), printTrailingLocation(), printType(), printTypeFirstDenseElementsAttr(), and printTypeImpl().
|
protected |
A set of flags to control the printer's behavior.
Definition at line 577 of file AsmPrinter.cpp.
Referenced by Impl(), printAttributeImpl(), printDenseTypedElementsAttr(), printLocation(), and printTrailingLocation().
|
protected |
An underlying assembly printer state.
Definition at line 574 of file AsmPrinter.cpp.
Referenced by Impl(), Impl(), popCyclicPrinting(), printAlias(), printAlias(), printAttributeImpl(), printDialectAttribute(), printDialectType(), printLocationInternal(), printResourceHandle(), and pushCyclicPrinting().