My Project
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
mlir::OpState Class Reference

#include <OpDefinition.h>

Inheritance diagram for mlir::OpState:
Inheritance graph
[legend]

Public Types

using dialect_attr_iterator = Operation::dialect_attr_iterator
 A utility iterator that filters out non-dialect attributes. More...
 
using dialect_attr_range = Operation::dialect_attr_range
 

Public Member Functions

 operator bool ()
 Ops are pointer-like, so we allow implicit conversion to bool. More...
 
 operator Operation * () const
 This implicitly converts to Operation*. More...
 
OperationgetOperation ()
 Return the operation that this refers to. More...
 
OperationgetParentOp ()
 
template<typename OpTy >
OpTy getParentOfType ()
 Return the closest surrounding parent operation that is of type 'OpTy'. More...
 
MLIRContextgetContext ()
 Return the context this operation belongs to. More...
 
void print (raw_ostream &os, OpPrintingFlags flags=llvm::None)
 Print the operation to the given stream. More...
 
void dump ()
 Dump this operation. More...
 
Location getLoc ()
 The source location the operation was defined or derived from. More...
 
void setLoc (Location loc)
 
ArrayRef< NamedAttributegetAttrs ()
 Return all of the attributes on this operation. More...
 
dialect_attr_range getDialectAttrs ()
 Return a range corresponding to the dialect attributes for this operation. More...
 
dialect_attr_iterator dialect_attr_begin ()
 
dialect_attr_iterator dialect_attr_end ()
 
Attribute getAttr (StringRef name)
 Return an attribute with the specified name. More...
 
template<typename AttrClass >
AttrClass getAttrOfType (StringRef name)
 If the operation has an attribute of the specified type, return it. More...
 
void setAttr (Identifier name, Attribute value)
 
void setAttr (StringRef name, Attribute value)
 
void setAttrs (ArrayRef< NamedAttribute > attributes)
 Set the attributes held by this operation. More...
 
void setAttrs (NamedAttributeList newAttrs)
 
template<typename DialectAttrs >
void setDialectAttrs (DialectAttrs &&attrs)
 Set the dialect attributes for this operation, and preserve all dependent. More...
 
NamedAttributeList::RemoveResult removeAttr (Identifier name)
 
NamedAttributeList::RemoveResult removeAttr (StringRef name)
 
bool use_empty ()
 Return true if there are no users of any results of this operation. More...
 
void erase ()
 Remove this operation from its parent block and delete it. More...
 
InFlightDiagnostic emitOpError (const Twine &message={})
 
InFlightDiagnostic emitError (const Twine &message={})
 
InFlightDiagnostic emitWarning (const Twine &message={})
 
InFlightDiagnostic emitRemark (const Twine &message={})
 
template<typename FnT , typename RetT = detail::walkResultType<FnT>>
RetT walk (FnT &&callback)
 

Static Public Member Functions

static void getCanonicalizationPatterns (OwningRewritePatternList &results, MLIRContext *context)
 

Protected Member Functions

LogicalResult verify ()
 
void print (OpAsmPrinter &p)
 
 OpState (Operation *state)
 

Static Protected Member Functions

static ParseResult parse (OpAsmParser &parser, OperationState &result)
 

Detailed Description

This is the concrete base class that holds the operation pointer and has non-generic methods that only depend on State (to avoid having them instantiated on template types that don't affect them.

This also has the fallback implementations of customization hooks for when they aren't customized.

Member Typedef Documentation

◆ dialect_attr_iterator

A utility iterator that filters out non-dialect attributes.

◆ dialect_attr_range

Constructor & Destructor Documentation

◆ OpState()

mlir::OpState::OpState ( Operation state)
inlineexplicitprotected

Mutability management is handled by the OpWrapper/OpConstWrapper classes, so we can cast it away here.

Member Function Documentation

◆ dialect_attr_begin()

dialect_attr_iterator mlir::OpState::dialect_attr_begin ( )
inline

◆ dialect_attr_end()

dialect_attr_iterator mlir::OpState::dialect_attr_end ( )
inline

◆ dump()

void mlir::OpState::dump ( )
inline

Dump this operation.

◆ emitError()

InFlightDiagnostic OpState::emitError ( const Twine &  message = {})

Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers that may be listening.

◆ emitOpError()

InFlightDiagnostic OpState::emitOpError ( const Twine &  message = {})

Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers.

◆ emitRemark()

InFlightDiagnostic OpState::emitRemark ( const Twine &  message = {})

Emit a remark about this operation, reporting up to any diagnostic handlers that may be listening.

◆ emitWarning()

InFlightDiagnostic OpState::emitWarning ( const Twine &  message = {})

Emit a warning about this operation, reporting up to any diagnostic handlers that may be listening.

◆ erase()

void mlir::OpState::erase ( )
inline

Remove this operation from its parent block and delete it.

◆ getAttr()

Attribute mlir::OpState::getAttr ( StringRef  name)
inline

Return an attribute with the specified name.

◆ getAttrOfType()

template<typename AttrClass >
AttrClass mlir::OpState::getAttrOfType ( StringRef  name)
inline

If the operation has an attribute of the specified type, return it.

◆ getAttrs()

ArrayRef<NamedAttribute> mlir::OpState::getAttrs ( )
inline

Return all of the attributes on this operation.

◆ getCanonicalizationPatterns()

static void mlir::OpState::getCanonicalizationPatterns ( OwningRewritePatternList results,
MLIRContext context 
)
inlinestatic

This hook returns any canonicalization pattern rewrites that the operation supports, for use by the canonicalization pass.

◆ getContext()

MLIRContext* mlir::OpState::getContext ( )
inline

Return the context this operation belongs to.

◆ getDialectAttrs()

dialect_attr_range mlir::OpState::getDialectAttrs ( )
inline

Return a range corresponding to the dialect attributes for this operation.

◆ getLoc()

Location mlir::OpState::getLoc ( )
inline

The source location the operation was defined or derived from.

◆ getOperation()

Operation* mlir::OpState::getOperation ( )
inline

Return the operation that this refers to.

◆ getParentOfType()

template<typename OpTy >
OpTy mlir::OpState::getParentOfType ( )
inline

Return the closest surrounding parent operation that is of type 'OpTy'.

◆ getParentOp()

Operation* mlir::OpState::getParentOp ( )
inline

Returns the closest surrounding operation that contains this operation or nullptr if this is a top-level operation.

◆ operator bool()

mlir::OpState::operator bool ( )
inline

Ops are pointer-like, so we allow implicit conversion to bool.

◆ operator Operation *()

mlir::OpState::operator Operation * ( ) const
inline

This implicitly converts to Operation*.

◆ parse()

ParseResult OpState::parse ( OpAsmParser parser,
OperationState result 
)
staticprotected

Unless overridden, the custom assembly form of an op is always rejected. Op implementations should implement this to return failure. On success, they should fill in result with the fields to use.

◆ print() [1/2]

void mlir::OpState::print ( raw_ostream &  os,
OpPrintingFlags  flags = llvm::None 
)
inline

Print the operation to the given stream.

◆ print() [2/2]

void OpState::print ( OpAsmPrinter p)
protected

◆ removeAttr() [1/2]

NamedAttributeList::RemoveResult mlir::OpState::removeAttr ( Identifier  name)
inline

Remove the attribute with the specified name if it exists. The return value indicates whether the attribute was present or not.

◆ removeAttr() [2/2]

NamedAttributeList::RemoveResult mlir::OpState::removeAttr ( StringRef  name)
inline

◆ setAttr() [1/2]

void mlir::OpState::setAttr ( Identifier  name,
Attribute  value 
)
inline

If the an attribute exists with the specified name, change it to the new value. Otherwise, add a new attribute with the specified name/value.

◆ setAttr() [2/2]

void mlir::OpState::setAttr ( StringRef  name,
Attribute  value 
)
inline

◆ setAttrs() [1/2]

void mlir::OpState::setAttrs ( ArrayRef< NamedAttribute attributes)
inline

Set the attributes held by this operation.

◆ setAttrs() [2/2]

void mlir::OpState::setAttrs ( NamedAttributeList  newAttrs)
inline

◆ setDialectAttrs()

template<typename DialectAttrs >
void mlir::OpState::setDialectAttrs ( DialectAttrs &&  attrs)
inline

Set the dialect attributes for this operation, and preserve all dependent.

◆ setLoc()

void mlir::OpState::setLoc ( Location  loc)
inline

◆ use_empty()

bool mlir::OpState::use_empty ( )
inline

Return true if there are no users of any results of this operation.

◆ verify()

LogicalResult mlir::OpState::verify ( )
inlineprotected

If the concrete type didn't implement a custom verifier hook, just fall back to this one which accepts everything.

◆ walk()

template<typename FnT , typename RetT = detail::walkResultType<FnT>>
RetT mlir::OpState::walk ( FnT &&  callback)
inline

Walk the operation in postorder, calling the callback for each nested operation(including this one). See Operation::walk for more details.


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