MLIR 22.0.0git
mlir::IRMapping Class Reference

This is a utility class for mapping one set of IR entities to another. More...

#include "mlir/IR/IRMapping.h"

Public Member Functions

void map (Value from, Value to)
 Inserts a new mapping for 'from' to 'to'.
void map (Block *from, Block *to)
void map (Operation *from, Operation *to)
template<typename S, typename T, std::enable_if_t<!std::is_assignable_v< Value, S > &&!std::is_assignable_v< Block *, S > &&!std::is_assignable_v< Operation *, S > > * = nullptr>
void map (S &&from, T &&to)
template<typename T>
void erase (T from)
 Erases a mapping for 'from'.
template<typename T>
bool contains (T from) const
 Checks to see if a mapping for 'from' exists.
template<typename T>
auto lookupOrNull (T from) const
 Lookup a mapped value within the map.
template<typename T>
auto lookupOrDefault (T from) const
 Lookup a mapped value within the map.
template<typename T>
auto lookup (T from) const
 Lookup a mapped value within the map.
void clear ()
 Clears all mappings held by the mapper.
const DenseMap< Value, Value > & getValueMap () const
 Return the held value mapping.
const DenseMap< Block *, Block * > & getBlockMap () const
 Return the held block mapping.
const DenseMap< Operation *, Operation * > & getOperationMap () const
 Return the held operation mapping.

Detailed Description

This is a utility class for mapping one set of IR entities to another.

New mappings can be inserted via 'map'. Existing mappings can be found via the 'lookup*' functions. There are three variants that differ only in return value when an existing is not found for the provided key: SSA values, blocks, and operations. 'lookupOrNull' returns nullptr where as 'lookupOrDefault' will return the lookup key.

Definition at line 26 of file IRMapping.h.

Member Function Documentation

◆ clear()

void mlir::IRMapping::clear ( )
inline

Clears all mappings held by the mapper.

Definition at line 79 of file IRMapping.h.

Referenced by addExecuteResults(), and hoistAffineIfOp().

◆ contains()

template<typename T>
bool mlir::IRMapping::contains ( T from) const
inline

Checks to see if a mapping for 'from' exists.

Definition at line 51 of file IRMapping.h.

Referenced by mlir::Region::cloneInto(), mlir::generateUnrolledLoop(), and mlir::shard::partitionOperation().

◆ erase()

template<typename T>
void mlir::IRMapping::erase ( T from)
inline

Erases a mapping for 'from'.

Definition at line 45 of file IRMapping.h.

◆ getBlockMap()

const DenseMap< Block *, Block * > & mlir::IRMapping::getBlockMap ( ) const
inline

Return the held block mapping.

Definition at line 85 of file IRMapping.h.

◆ getOperationMap()

const DenseMap< Operation *, Operation * > & mlir::IRMapping::getOperationMap ( ) const
inline

Return the held operation mapping.

Definition at line 88 of file IRMapping.h.

◆ getValueMap()

const DenseMap< Value, Value > & mlir::IRMapping::getValueMap ( ) const
inline

Return the held value mapping.

Definition at line 82 of file IRMapping.h.

◆ lookup()

◆ lookupOrDefault()

template<typename T>
auto mlir::IRMapping::lookupOrDefault ( T from) const
inline

Lookup a mapped value within the map.

If a mapping for the provided value does not exist then return the provided value.

Definition at line 65 of file IRMapping.h.

Referenced by buildPackingLoopNestImpl(), mlir::Operation::clone(), mlir::fuseIndependentSiblingForLoops(), generateFusedElementwiseOpRegion(), mlir::generateUnrolledLoop(), haveNoReadsAfterWriteExceptSameIndex(), inlinePayload(), inlineRegionAndEmitStore(), processParallelLoop(), and vectorizeUniform().

◆ lookupOrNull()

template<typename T>
auto mlir::IRMapping::lookupOrNull ( T from) const
inline

Lookup a mapped value within the map.

If a mapping for the provided value does not exist then return nullptr.

Definition at line 58 of file IRMapping.h.

Referenced by mlir::affine::fuseLoops(), lookup(), remapInlinedOperands(), and vectorizeOperand().

◆ map() [1/4]

void mlir::IRMapping::map ( Block * from,
Block * to )
inline

Definition at line 31 of file IRMapping.h.

◆ map() [2/4]

void mlir::IRMapping::map ( Operation * from,
Operation * to )
inline

Definition at line 32 of file IRMapping.h.

◆ map() [3/4]

template<typename S, typename T, std::enable_if_t<!std::is_assignable_v< Value, S > &&!std::is_assignable_v< Block *, S > &&!std::is_assignable_v< Operation *, S > > * = nullptr>
void mlir::IRMapping::map ( S && from,
T && to )
inline

Definition at line 38 of file IRMapping.h.

References map().

◆ map() [4/4]


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