MLIR  19.0.0git
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
mlir::AsmPrinter::Impl Class Reference

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. More...
 
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. More...
 
void printAttributeImpl (Attribute attr, AttrTypeElision typeElision=AttrTypeElision::Never)
 Print the given attribute without considering an alias. More...
 
LogicalResult printAlias (Attribute attr)
 Print the alias for the given attribute, return failure if no alias could be printed. More...
 
void printType (Type type)
 Print the given type or an alias. More...
 
void printTypeImpl (Type type)
 Print the given type. More...
 
LogicalResult printAlias (Type type)
 Print the alias for the given type, return failure if no alias could be printed. More...
 
void printLocation (LocationAttr loc, bool allowAlias=false)
 Print the given location to the stream. More...
 
void printResourceHandle (const AsmDialectResourceHandle &resource)
 Print a reference to the given resource that is owned by the given dialect. More...
 
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 printNamedAttribute (NamedAttribute attr)
 
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. More...
 
void printDenseStringElementsAttr (DenseStringElementsAttr attr)
 Print a dense string elements attribute. More...
 
void printDenseIntOrFPElementsAttr (DenseIntOrFPElementsAttr attr, bool allowHex)
 Print a dense elements attribute. More...
 
void printDenseArrayAttr (DenseArrayAttr attr)
 Print a dense array attribute. More...
 
void printDialectAttribute (Attribute attr)
 
void printDialectType (Type type)
 
void printEscapedString (StringRef str)
 Print an escaped string, wrapped with "". More...
 
void printHexString (StringRef str)
 Print a hex string, wrapped with "". More...
 
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. More...
 
AsmStateImplstate
 An underlying assembly printer state. More...
 
OpPrintingFlags printerFlags
 A set of flags to control the printer's behavior. More...
 
NewLineCounter newLine
 A tracker for the number of new lines emitted during printing. More...
 

Detailed Description

Definition at line 376 of file AsmPrinter.cpp.

Member Enumeration Documentation

◆ AttrTypeElision

This enum describes the different kinds of elision for the type of an attribute when printing it.

Enumerator
Never 

The type must not be elided,.

May 

The type may be elided when it matches the default used in the parser (for example i64 is the default for integer attributes).

Must 

The type must be elided.

Definition at line 391 of file AsmPrinter.cpp.

◆ BindingStrength

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 479 of file AsmPrinter.cpp.

Constructor & Destructor Documentation

◆ Impl() [1/2]

AsmPrinter::Impl::Impl ( raw_ostream &  os,
AsmStateImpl state 
)

Definition at line 1959 of file AsmPrinter.cpp.

◆ Impl() [2/2]

mlir::AsmPrinter::Impl::Impl ( Impl other)
inlineexplicit

Definition at line 379 of file AsmPrinter.cpp.

Member Function Documentation

◆ getStream()

raw_ostream& mlir::AsmPrinter::Impl::getStream ( )
inline

Returns the output stream of the printer.

Definition at line 382 of file AsmPrinter.cpp.

References os.

◆ interleaveComma()

template<typename Container , typename UnaryFunctor >
void mlir::AsmPrinter::Impl::interleaveComma ( const Container &  c,
UnaryFunctor  eachFn 
) const
inline

Definition at line 385 of file AsmPrinter.cpp.

References os.

◆ popCyclicPrinting()

void AsmPrinter::Impl::popCyclicPrinting ( )

Definition at line 2751 of file AsmPrinter.cpp.

◆ printAffineConstraint()

void AsmPrinter::Impl::printAffineConstraint ( AffineExpr  expr,
bool  isEq 
)

Definition at line 2974 of file AsmPrinter.cpp.

◆ printAffineExpr()

void AsmPrinter::Impl::printAffineExpr ( AffineExpr  expr,
function_ref< void(unsigned, bool)>  printValueName = nullptr 
)

Definition at line 2836 of file AsmPrinter.cpp.

◆ printAffineExprInternal()

void AsmPrinter::Impl::printAffineExprInternal ( AffineExpr  expr,
BindingStrength  enclosingTightness,
function_ref< void(unsigned, bool)>  printValueName = nullptr 
)
protected

◆ printAffineMap()

void AsmPrinter::Impl::printAffineMap ( AffineMap  map)

◆ printAlias() [1/2]

LogicalResult AsmPrinter::Impl::printAlias ( Attribute  attr)

Print the alias for the given attribute, return failure if no alias could be printed.

Definition at line 2196 of file AsmPrinter.cpp.

◆ printAlias() [2/2]

LogicalResult AsmPrinter::Impl::printAlias ( Type  type)

Print the alias for the given type, return failure if no alias could be printed.

Definition at line 2200 of file AsmPrinter.cpp.

◆ printAttribute()

void AsmPrinter::Impl::printAttribute ( Attribute  attr,
AttrTypeElision  typeElision = AttrTypeElision::Never 
)

Print the given attribute or an alias.

Definition at line 2204 of file AsmPrinter.cpp.

◆ printAttributeImpl()

void AsmPrinter::Impl::printAttributeImpl ( Attribute  attr,
AttrTypeElision  typeElision = AttrTypeElision::Never 
)

Print the given attribute without considering an alias.

Definition at line 2217 of file AsmPrinter.cpp.

◆ printDenseArrayAttr()

void AsmPrinter::Impl::printDenseArrayAttr ( DenseArrayAttr  attr)
protected

Print a dense array attribute.

Definition at line 2507 of file AsmPrinter.cpp.

◆ printDenseElementsAttr()

void AsmPrinter::Impl::printDenseElementsAttr ( DenseElementsAttr  attr,
bool  allowHex 
)
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 2428 of file AsmPrinter.cpp.

◆ printDenseIntOrFPElementsAttr()

void AsmPrinter::Impl::printDenseIntOrFPElementsAttr ( DenseIntOrFPElementsAttr  attr,
bool  allowHex 
)
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 2437 of file AsmPrinter.cpp.

◆ printDenseStringElementsAttr()

void AsmPrinter::Impl::printDenseStringElementsAttr ( DenseStringElementsAttr  attr)
protected

Print a dense string elements attribute.

Definition at line 2500 of file AsmPrinter.cpp.

◆ printDialectAttribute()

void AsmPrinter::Impl::printDialectAttribute ( Attribute  attr)
protected

Definition at line 2706 of file AsmPrinter.cpp.

◆ printDialectType()

void AsmPrinter::Impl::printDialectType ( Type  type)
protected

Definition at line 2720 of file AsmPrinter.cpp.

◆ printDimensionList()

void AsmPrinter::Impl::printDimensionList ( ArrayRef< int64_t >  shape)

Definition at line 2753 of file AsmPrinter.cpp.

References mlir::detail::printDimensionList().

◆ printEscapedString()

void AsmPrinter::Impl::printEscapedString ( StringRef  str)
protected

Print an escaped string, wrapped with "".

Definition at line 2734 of file AsmPrinter.cpp.

◆ printHexString() [1/2]

void AsmPrinter::Impl::printHexString ( ArrayRef< char >  data)
protected

Definition at line 2743 of file AsmPrinter.cpp.

◆ printHexString() [2/2]

void AsmPrinter::Impl::printHexString ( StringRef  str)
protected

Print a hex string, wrapped with "".

Definition at line 2740 of file AsmPrinter.cpp.

◆ printIntegerSet()

void AsmPrinter::Impl::printIntegerSet ( IntegerSet  set)

◆ printLocation()

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 2095 of file AsmPrinter.cpp.

References mlir::failed(), mlir::AsmPrinter::printAlias(), and mlir::OpPrintingFlags::shouldPrintDebugInfoPrettyForm().

◆ printLocationInternal()

void AsmPrinter::Impl::printLocationInternal ( LocationAttr  loc,
bool  pretty = false,
bool  isTopLevel = false 
)
protected

Definition at line 1971 of file AsmPrinter.cpp.

References mlir::succeeded().

◆ printNamedAttribute()

void AsmPrinter::Impl::printNamedAttribute ( NamedAttribute  attr)
protected

Definition at line 2694 of file AsmPrinter.cpp.

◆ printOptionalAttrDict()

void AsmPrinter::Impl::printOptionalAttrDict ( ArrayRef< NamedAttribute attrs,
ArrayRef< StringRef >  elidedAttrs = {},
bool  withKeyword = false 
)
protected

Definition at line 2661 of file AsmPrinter.cpp.

◆ printResourceHandle()

void AsmPrinter::Impl::printResourceHandle ( const AsmDialectResourceHandle resource)

Print a reference to the given resource that is owned by the given dialect.

Definition at line 2105 of file AsmPrinter.cpp.

References mlir::OpAsmDialectInterface::getResourceKey().

◆ printTrailingLocation()

void AsmPrinter::Impl::printTrailingLocation ( Location  loc,
bool  allowAlias = true 
)
protected

Definition at line 1962 of file AsmPrinter.cpp.

References mlir::OpPrintingFlags::shouldPrintDebugInfo().

◆ printType()

void AsmPrinter::Impl::printType ( Type  type)

Print the given type or an alias.

Definition at line 2532 of file AsmPrinter.cpp.

◆ printTypeImpl()

void AsmPrinter::Impl::printTypeImpl ( Type  type)

Print the given type.

Definition at line 2544 of file AsmPrinter.cpp.

◆ pushCyclicPrinting()

LogicalResult AsmPrinter::Impl::pushCyclicPrinting ( const void *  opaquePointer)

Definition at line 2747 of file AsmPrinter.cpp.

Member Data Documentation

◆ newLine

NewLineCounter mlir::AsmPrinter::Impl::newLine
protected

A tracker for the number of new lines emitted during printing.

Definition at line 497 of file AsmPrinter.cpp.

◆ os

raw_ostream& mlir::AsmPrinter::Impl::os
protected

The output stream for the printer.

Definition at line 488 of file AsmPrinter.cpp.

Referenced by getStream(), and interleaveComma().

◆ printerFlags

OpPrintingFlags mlir::AsmPrinter::Impl::printerFlags
protected

A set of flags to control the printer's behavior.

Definition at line 494 of file AsmPrinter.cpp.

◆ state

AsmStateImpl& mlir::AsmPrinter::Impl::state
protected

An underlying assembly printer state.

Definition at line 491 of file AsmPrinter.cpp.


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