MLIR  20.0.0git
Public Member Functions | List of all members
mlir::AttrTypeReplacer Class Reference

This is an attribute/type replacer that is naively cached. More...

#include "mlir/IR/AttrTypeSubElements.h"

+ Inheritance diagram for mlir::AttrTypeReplacer:

Public Member Functions

Attribute replace (Attribute attr)
 
Type replace (Type type)
 
- Public Member Functions inherited from mlir::detail::AttrTypeReplacerBase< AttrTypeReplacer >
void replaceElementsIn (Operation *op, bool replaceAttrs=true, bool replaceLocs=false, bool replaceTypes=false)
 Replace the elements within the given operation. More...
 
void recursivelyReplaceElementsIn (Operation *op, bool replaceAttrs=true, bool replaceLocs=false, bool replaceTypes=false)
 Replace the elements within the given operation, and all nested operations. More...
 
void addReplacement (ReplaceFn< Attribute > fn)
 Register a replacement function for mapping a given attribute or type. More...
 
void addReplacement (ReplaceFn< Type > fn)
 
std::enable_if_t<!std::is_same_v< T, BaseT >||!std::is_convertible_v< ResultT, ReplaceFnResult< BaseT > > > addReplacement (FnT &&callback)
 Register a replacement function that doesn't match the default signature, either because it uses a derived parameter type, or it uses a simplified result type. More...
 

Additional Inherited Members

- Public Types inherited from mlir::detail::AttrTypeReplacerBase< AttrTypeReplacer >
using ReplaceFnResult = std::optional< std::pair< T, WalkResult > >
 A replacement mapping function, which returns either std::nullopt (to signal the element wasn't handled), or a pair of the replacement element and a WalkResult. More...
 
using ReplaceFn = std::function< ReplaceFnResult< T >(T)>
 
- Protected Member Functions inherited from mlir::detail::AttrTypeReplacerBase< AttrTypeReplacer >
Attribute replaceBase (Attribute attr)
 Invokes the registered replacement functions from most recently registered to least recently registered until a successful replacement is returned. More...
 
Type replaceBase (Type type)
 

Detailed Description

This is an attribute/type replacer that is naively cached.

It is best used when the replacer logic is guaranteed to not contain cycles. Otherwise, any re-occurrence of an in-progress element will be skipped.

Definition at line 235 of file AttrTypeSubElements.h.

Member Function Documentation

◆ replace() [1/2]

Attribute AttrTypeReplacer::replace ( Attribute  attr)

Definition at line 251 of file AttrTypeSubElements.cpp.

Referenced by mlir::Attribute::replace(), and mlir::Type::replace().

◆ replace() [2/2]

Type AttrTypeReplacer::replace ( Type  type)

Definition at line 255 of file AttrTypeSubElements.cpp.


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