MLIR  19.0.0git
Public Member Functions | List of all members
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'. More...
 
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'. More...
 
template<typename T >
bool contains (T from) const
 Checks to see if a mapping for 'from' exists. More...
 
template<typename T >
auto lookupOrNull (T from) const
 Lookup a mapped value within the map. More...
 
template<typename T >
auto lookupOrDefault (T from) const
 Lookup a mapped value within the map. More...
 
template<typename T >
auto lookup (T from) const
 Lookup a mapped value within the map. More...
 
void clear ()
 Clears all mappings held by the mapper. More...
 
const DenseMap< Value, Value > & getValueMap () const
 Return the held value mapping. More...
 
const DenseMap< Block *, Block * > & getBlockMap () const
 Return the held block mapping. More...
 
const DenseMap< Operation *, Operation * > & getOperationMap () const
 Return the held operation mapping. More...
 

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 ( 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(), and mlir::mesh::spmdizeOperation().

◆ erase()

template<typename T >
void mlir::IRMapping::erase ( 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()

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

◆ lookupOrDefault()

template<typename T >
auto mlir::IRMapping::lookupOrDefault ( 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 mlir::Operation::clone(), and processParallelLoop().

◆ lookupOrNull()

template<typename T >
auto mlir::IRMapping::lookupOrNull ( 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(), and lookup().

◆ 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]

void mlir::IRMapping::map ( Value  from,
Value  to 
)
inline

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