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

#include <OperationSupport.h>

Collaboration diagram for mlir::AbstractOperation:
Collaboration graph
[legend]

Public Types

using OperationProperties = uint32_t
 

Public Member Functions

bool hasProperty (OperationProperty property) const
 Returns whether the operation has a particular property. More...
 
template<typename T >
T::Concept * getInterface () const
 
template<template< typename T > class Trait>
bool hasTrait () const
 Returns if the operation has a particular trait. More...
 

Static Public Member Functions

static const AbstractOperationlookup (StringRef opName, MLIRContext *context)
 
template<typename T >
static AbstractOperation get (Dialect &dialect)
 

Public Attributes

const StringRef name
 This is the name of the operation. More...
 
Dialectdialect
 This is the dialect that this operation belongs to. More...
 
bool(&) classof (Operation *op)
 Return true if this "op class" can match against the specified operation. More...
 
ParseResult(&) parseAssembly (OpAsmParser &parser, OperationState &result)
 Use the specified object to parse this ops custom assembly format. More...
 
void(&) printAssembly (Operation *op, OpAsmPrinter &p)
 This hook implements the AsmPrinter for this operation. More...
 
LogicalResult(&) verifyInvariants (Operation *op)
 
LogicalResult(&) foldHook (Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results)
 
void(&) getCanonicalizationPatterns (OwningRewritePatternList &results, MLIRContext *context)
 

Detailed Description

This is a "type erased" representation of a registered operation. This should only be used by things like the AsmPrinter and other things that need to be parameterized by generic operation hooks. Most user code should use the concrete operation types.

Member Typedef Documentation

◆ OperationProperties

Member Function Documentation

◆ get()

template<typename T >
static AbstractOperation mlir::AbstractOperation::get ( Dialect dialect)
inlinestatic

This constructor is used by Dialect objects when they register the list of operations they contain.

◆ getInterface()

template<typename T >
T::Concept* mlir::AbstractOperation::getInterface ( ) const
inline

Returns an instance of the concept object for the given interface if it was registered to this operation, null otherwise. This should not be used directly.

◆ hasProperty()

bool mlir::AbstractOperation::hasProperty ( OperationProperty  property) const
inline

Returns whether the operation has a particular property.

◆ hasTrait()

template<template< typename T > class Trait>
bool mlir::AbstractOperation::hasTrait ( ) const
inline

Returns if the operation has a particular trait.

◆ lookup()

const AbstractOperation * AbstractOperation::lookup ( StringRef  opName,
MLIRContext context 
)
static

Look up the specified operation in the specified MLIRContext and return a pointer to it if present. Otherwise, return a null pointer.

Look up the specified operation in the operation set and return a pointer to it if present. Otherwise, return a null pointer.

Member Data Documentation

◆ classof

bool(&) mlir::AbstractOperation::classof(Operation *op)

Return true if this "op class" can match against the specified operation.

◆ dialect

Dialect& mlir::AbstractOperation::dialect

This is the dialect that this operation belongs to.

◆ foldHook

LogicalResult(&) mlir::AbstractOperation::foldHook(Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results)

This hook implements a generalized folder for this operation. Operations can implement this to provide simplifications rules that are applied by the Builder::createOrFold API and the canonicalization pass.

This is an intentionally limited interface - implementations of this hook can only perform the following changes to the operation:

  1. They can leave the operation alone and without changing the IR, and return failure.
  2. They can mutate the operation in place, without changing anything else in the IR. In this case, return success.
  3. They can return a list of existing values that can be used instead of the operation. In this case, fill in the results list and return success. The caller will remove the operation and use those results instead.

This allows expression of some simple in-place canonicalizations (e.g. "x+0 -> x", "min(x,y,x,z) -> min(x,y,z)", "x+y-x -> y", etc), as well as generalized constant folding.

◆ getCanonicalizationPatterns

void(&) mlir::AbstractOperation::getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context)

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

◆ name

const StringRef mlir::AbstractOperation::name

This is the name of the operation.

◆ parseAssembly

ParseResult(&) mlir::AbstractOperation::parseAssembly(OpAsmParser &parser, OperationState &result)

Use the specified object to parse this ops custom assembly format.

◆ printAssembly

void(&) mlir::AbstractOperation::printAssembly(Operation *op, OpAsmPrinter &p)

This hook implements the AsmPrinter for this operation.

◆ verifyInvariants

LogicalResult(&) mlir::AbstractOperation::verifyInvariants(Operation *op)

This hook implements the verifier for this operation. It should emits an error message and returns failure if a problem is detected, or returns success if everything is ok.


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