|
MLIR 22.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 | printDenseIntOrFPElementsAttr (DenseIntOrFPElementsAttr attr, bool allowHex) |
| Print a dense elements attribute. | |
| 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 413 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 443 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 531 of file AsmPrinter.cpp.
| AsmPrinter::Impl::Impl | ( | raw_ostream & | os, |
| AsmStateImpl & | state ) |
Definition at line 2141 of file AsmPrinter.cpp.
References os, printerFlags, and state.
Referenced by Impl(), printDialectAttribute(), and printDialectType().
|
inlineexplicit |
Definition at line 416 of file AsmPrinter.cpp.
|
inline |
Decrease indentation.
Definition at line 434 of file AsmPrinter.cpp.
References currentIndent, and indentWidth.
|
inline |
Returns the output stream of the printer.
Definition at line 419 of file AsmPrinter.cpp.
References os.
Referenced by printDenseArrayAttr().
|
inline |
Increase indentation.
Definition at line 431 of file AsmPrinter.cpp.
References currentIndent, and indentWidth.
|
inline |
Definition at line 437 of file AsmPrinter.cpp.
References os.
Referenced by printAffineMap(), printAttributeImpl(), printLocationInternal(), printOptionalAttrDict(), and printTypeImpl().
| void AsmPrinter::Impl::popCyclicPrinting | ( | ) |
Definition at line 2985 of file AsmPrinter.cpp.
References state.
| void AsmPrinter::Impl::printAffineConstraint | ( | AffineExpr | expr, |
| bool | isEq ) |
Definition at line 3228 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 3090 of file AsmPrinter.cpp.
References printAffineExprInternal(), and Weak.
Referenced by mlir::AffineExpr::print().
|
protected |
Definition at line 3095 of file AsmPrinter.cpp.
References mlir::Add, mlir::CeilDiv, mlir::Constant, mlir::DimId, mlir::FloorDiv, mlir::AffineExpr::getKind(), mlir::Mod, mlir::Mul, os, printAffineExprInternal(), rhs, Strong, mlir::SymbolId, and Weak.
Referenced by printAffineConstraint(), printAffineExpr(), and printAffineExprInternal().
Definition at line 3233 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 2396 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 2400 of file AsmPrinter.cpp.
| void AsmPrinter::Impl::printAttribute | ( | Attribute | attr, |
| AttrTypeElision | typeElision = AttrTypeElision::Never ) |
Print the given attribute or an alias.
Definition at line 2404 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 2416 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(), printDenseIntOrFPElementsAttr(), printDenseStringElementsAttr(), printDialectAttribute(), printDialectSymbol(), printElidedElementsAttr(), printerFlags, printEscapedString(), printFloatValue(), printLocation(), mlir::AsmPrinter::printResourceHandle(), printSymbolReference(), mlir::AsmPrinter::printType(), and state.
Referenced by printAttribute().
|
protected |
Print a dense array attribute.
Definition at line 2708 of file AsmPrinter.cpp.
References 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 2629 of file AsmPrinter.cpp.
References printDenseIntOrFPElementsAttr(), and printDenseStringElementsAttr().
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 2638 of file AsmPrinter.cpp.
References os, printDenseElementsAttrImpl(), printerFlags, and printHexString().
Referenced by printAttributeImpl(), and printDenseElementsAttr().
|
protected |
Print a dense string elements attribute.
Definition at line 2701 of file AsmPrinter.cpp.
References os, printDenseElementsAttrImpl(), and printEscapedString().
Referenced by printAttributeImpl(), and printDenseElementsAttr().
Definition at line 2926 of file AsmPrinter.cpp.
References currentIndent, mlir::Attribute::getDialect(), Impl(), newLine, os, printDialectSymbol(), and state.
Referenced by printAttributeImpl().
Definition at line 2947 of file AsmPrinter.cpp.
References currentIndent, mlir::Type::getDialect(), Impl(), newLine, os, printDialectSymbol(), and state.
Referenced by printTypeImpl().
Definition at line 2987 of file AsmPrinter.cpp.
References os, and mlir::detail::printDimensionList().
|
protected |
Print an escaped string, wrapped with "".
Definition at line 2968 of file AsmPrinter.cpp.
References os.
Referenced by printAttributeImpl(), printDenseStringElementsAttr(), and printLocationInternal().
Definition at line 2977 of file AsmPrinter.cpp.
References printHexString().
|
protected |
Print a hex string, wrapped with "".
Definition at line 2974 of file AsmPrinter.cpp.
References os.
Referenced by printDenseIntOrFPElementsAttr(), and printHexString().
| void AsmPrinter::Impl::printIntegerSet | ( | IntegerSet | set | ) |
Definition at line 3259 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 2295 of file AsmPrinter.cpp.
References os, mlir::AsmPrinter::printAlias(), printerFlags, and printLocationInternal().
Referenced by printAttributeImpl(), and printTrailingLocation().
|
protected |
Definition at line 2153 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 2914 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 425 of file AsmPrinter.cpp.
References currentIndent, newLine, and os.
|
protected |
Definition at line 2881 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 2389 of file AsmPrinter.cpp.
References mlir::AsmDialectResourceHandle::getDialect(), os, mlir::AsmPrinter::printKeywordOrString(), and state.
Definition at line 2144 of file AsmPrinter.cpp.
References os, printerFlags, and printLocation().
Print the given type or an alias.
Definition at line 2733 of file AsmPrinter.cpp.
References os, mlir::AsmPrinter::printAlias(), and printTypeImpl().
Referenced by mlir::Type::print().
Print the given type.
Definition at line 2745 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 2981 of file AsmPrinter.cpp.
References state.
|
protected |
This is the current indentation level for nested structures.
Definition at line 555 of file AsmPrinter.cpp.
Referenced by decreaseIndent(), increaseIndent(), printDialectAttribute(), printDialectType(), and printNewline().
|
staticprotected |
The number of spaces used as an indent.
Definition at line 552 of file AsmPrinter.cpp.
Referenced by decreaseIndent(), and increaseIndent().
|
protected |
A tracker for the number of new lines emitted during printing.
Definition at line 549 of file AsmPrinter.cpp.
Referenced by printDialectAttribute(), printDialectType(), printLocationInternal(), and printNewline().
|
protected |
The output stream for the printer.
Definition at line 540 of file AsmPrinter.cpp.
Referenced by getStream(), Impl(), Impl(), interleaveComma(), printAffineConstraint(), printAffineExprInternal(), printAffineMap(), printAlias(), printAlias(), printAttribute(), printAttributeImpl(), printDenseIntOrFPElementsAttr(), printDenseStringElementsAttr(), printDialectAttribute(), printDialectType(), printDimensionList(), printEscapedString(), printHexString(), printIntegerSet(), printLocation(), printLocationInternal(), printNamedAttribute(), printNewline(), printOptionalAttrDict(), printResourceHandle(), printTrailingLocation(), printType(), and printTypeImpl().
|
protected |
A set of flags to control the printer's behavior.
Definition at line 546 of file AsmPrinter.cpp.
Referenced by Impl(), printAttributeImpl(), printDenseIntOrFPElementsAttr(), printLocation(), and printTrailingLocation().
|
protected |
An underlying assembly printer state.
Definition at line 543 of file AsmPrinter.cpp.
Referenced by Impl(), Impl(), popCyclicPrinting(), printAlias(), printAlias(), printAttributeImpl(), printDialectAttribute(), printDialectType(), printLocationInternal(), printResourceHandle(), and pushCyclicPrinting().