MLIR 24.0.0git
mlir::SymbolUserMap Class Reference

This class represents a map of symbols to users, and provides efficient implementations of symbol queries related to users; such as collecting the users of a symbol, replacing all uses, etc. More...

#include "mlir/IR/SymbolTable.h"

Public Member Functions

 SymbolUserMap (SymbolTableCollection &symbolTable, Operation *symbolTableOp)
 Build a user map for all of the symbols defined in regions nested under 'symbolTableOp'.
ArrayRef< Operation * > getUsers (Operation *symbol) const
 Return the users of the provided symbol operation within this map's scope.
bool areAllUsesVisible (Operation *symbol) const
 Return true if all uses of the symbol within the IR are within this scope.
bool useEmpty (Operation *symbol) const
 Return true if the given symbol has no uses within this map's scope.
void replaceAllUsesWith (Operation *symbol, StringAttr newSymbolName)
 Replace all uses of the symbol within this map's scope with newSymbolName.

Detailed Description

This class represents a map of symbols to users, and provides efficient implementations of symbol queries related to users; such as collecting the users of a symbol, replacing all uses, etc.

Definition at line 403 of file SymbolTable.h.

Constructor & Destructor Documentation

◆ SymbolUserMap()

SymbolUserMap::SymbolUserMap ( SymbolTableCollection & symbolTable,
Operation * symbolTableOp )

Build a user map for all of the symbols defined in regions nested under 'symbolTableOp'.

A reference to the provided symbol table collection is kept by the user map to ensure efficient lookups, thus the lifetime should extend beyond that of this map.

Definition at line 1050 of file SymbolTable.cpp.

References mlir::Operation::getBlock(), mlir::Region::getOps(), mlir::Operation::getRegion(), mlir::SymbolTable::getSymbolUses(), and mlir::SymbolTable::walkSymbolTables().

Member Function Documentation

◆ areAllUsesVisible()

bool SymbolUserMap::areAllUsesVisible ( Operation * symbol) const

Return true if all uses of the symbol within the IR are within this scope.

The symbol must belong to this map's scope.

Definition at line 1078 of file SymbolTable.cpp.

◆ getUsers()

ArrayRef< Operation * > mlir::SymbolUserMap::getUsers ( Operation * symbol) const
inline

Return the users of the provided symbol operation within this map's scope.

Definition at line 412 of file SymbolTable.h.

◆ replaceAllUsesWith()

void SymbolUserMap::replaceAllUsesWith ( Operation * symbol,
StringAttr newSymbolName )

Replace all uses of the symbol within this map's scope with newSymbolName.

Definition at line 1085 of file SymbolTable.cpp.

References mlir::Operation::getParentOp(), and mlir::SymbolTable::replaceAllSymbolUses().

◆ useEmpty()

bool mlir::SymbolUserMap::useEmpty ( Operation * symbol) const
inline

Return true if the given symbol has no uses within this map's scope.

Definition at line 423 of file SymbolTable.h.


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