|
MLIR 24.0.0git
|
#include "mlir/IR/SymbolTable.h"#include "mlir/IR/Builders.h"#include "mlir/IR/OpImplementation.h"#include "llvm/ADT/SetVector.h"#include "llvm/ADT/SmallString.h"#include <optional>#include "mlir/IR/SymbolInterfaces.cpp.inc"#include "mlir/IR/SymbolInterfacesAttrInterface.cpp.inc"Go to the source code of this file.
Functions | |
| static bool | isPotentiallyUnknownSymbolTable (Operation *op) |
| Return true if the given operation is unknown and may potentially define a symbol table. | |
| static StringAttr | getNameIfSymbol (Operation *op) |
| Returns the string name of the given symbol, or null if this is not a symbol. | |
| static LogicalResult | collectValidReferencesFor (Operation *symbol, StringAttr symbolName, Operation *within, SmallVectorImpl< SymbolRefAttr > &results) |
| Computes the nested symbol reference attribute for the symbol 'symbolName' that are usable within the symbol table operations from 'symbol' as far up to the given operation 'within', where 'within' is an ancestor of 'symbol'. | |
| static std::optional< WalkResult > | walkSymbolTable (MutableArrayRef< Region > regions, function_ref< std::optional< WalkResult >(Operation *)> callback) |
| Walk all of the operations within the given set of regions, without traversing into any nested symbol tables. | |
| static std::optional< WalkResult > | walkSymbolTable (Operation *op, function_ref< std::optional< WalkResult >(Operation *)> callback) |
| Walk all of the operations nested under, and including, the given operation, without traversing into any nested symbol tables. | |
| static LogicalResult | lookupSymbolInImpl (Operation *symbolTableOp, SymbolRefAttr symbol, SmallVectorImpl< Operation * > &symbols, function_ref< Operation *(Operation *, StringAttr)> lookupSymbolFn) |
| Internal implementation of lookupSymbolIn that allows for specialized implementations of the lookup function. | |
| static WalkResult | walkSymbolRefs (Operation *op, function_ref< WalkResult(SymbolTable::SymbolUse)> callback) |
| Walk all of the symbol references within the given operation, invoking the provided callback for each found use. | |
| static std::optional< WalkResult > | walkSymbolUses (MutableArrayRef< Region > regions, function_ref< WalkResult(SymbolTable::SymbolUse)> callback) |
| Walk all of the uses, for any symbol, that are nested within the given regions, invoking the provided callback for each. | |
| static std::optional< WalkResult > | walkSymbolUses (Operation *from, function_ref< WalkResult(SymbolTable::SymbolUse)> callback) |
| Walk all of the uses, for any symbol, that are nested within the given operation 'from', invoking the provided callback for each. | |
| static SmallVector< SymbolScope, 2 > | collectSymbolScopes (Operation *symbol, Operation *limit) |
| Collect all of the symbol scopes from 'symbol' to (inclusive) 'limit'. | |
| static SmallVector< SymbolScope, 2 > | collectSymbolScopes (Operation *symbol, Region *limit) |
| static SmallVector< SymbolScope, 1 > | collectSymbolScopes (StringAttr symbol, Region *limit) |
| static SmallVector< SymbolScope, 1 > | collectSymbolScopes (StringAttr symbol, Operation *limit) |
| static bool | isReferencePrefixOf (SymbolRefAttr subRef, SymbolRefAttr ref) |
| Returns true if the given reference 'SubRef' is a sub reference of the reference 'ref', i.e. | |
| template<typename FromT> | |
| static std::optional< SymbolTable::UseRange > | getSymbolUsesImpl (FromT from) |
| The implementation of SymbolTable::getSymbolUses below. | |
| template<typename SymbolT, typename IRUnitT> | |
| static std::optional< SymbolTable::UseRange > | getSymbolUsesImpl (SymbolT symbol, IRUnitT *limit) |
| The implementation of SymbolTable::getSymbolUses below. | |
| template<typename SymbolT, typename IRUnitT> | |
| static bool | symbolKnownUseEmptyImpl (SymbolT symbol, IRUnitT *limit) |
| The implementation of SymbolTable::symbolKnownUseEmpty below. | |
| static SymbolRefAttr | generateNewRefAttr (SymbolRefAttr oldAttr, FlatSymbolRefAttr newLeafAttr) |
| Generates a new symbol reference attribute with a new leaf reference. | |
| template<typename SymbolT, typename IRUnitT> | |
| static LogicalResult | replaceAllSymbolUsesImpl (SymbolT symbol, StringAttr newSymbol, IRUnitT *limit) |
| The implementation of SymbolTable::replaceAllSymbolUses below. | |
|
static |
Collect all of the symbol scopes from 'symbol' to (inclusive) 'limit'.
Definition at line 647 of file SymbolTable.cpp.
References collectValidReferencesFor(), mlir::SymbolTable::getNearestSymbolTable(), mlir::Operation::getParentOp(), mlir::Operation::getRegion(), mlir::SymbolTable::getSymbolName(), and mlir::Operation::hasTrait().
Referenced by collectSymbolScopes(), getSymbolUsesImpl(), replaceAllSymbolUsesImpl(), and symbolKnownUseEmptyImpl().
|
static |
Definition at line 707 of file SymbolTable.cpp.
References collectSymbolScopes(), and mlir::Region::getParentOp().
|
static |
Definition at line 722 of file SymbolTable.cpp.
References mlir::Operation::getRegions().
|
static |
Definition at line 717 of file SymbolTable.cpp.
|
static |
Computes the nested symbol reference attribute for the symbol 'symbolName' that are usable within the symbol table operations from 'symbol' as far up to the given operation 'within', where 'within' is an ancestor of 'symbol'.
Returns success if all references up to 'within' could be computed.
Definition at line 38 of file SymbolTable.cpp.
References mlir::FlatSymbolRefAttr::get(), getNameIfSymbol(), mlir::Operation::getParentOp(), mlir::Operation::hasTrait(), mlir::Operation::isAncestor(), and success().
Referenced by collectSymbolScopes().
|
static |
Generates a new symbol reference attribute with a new leaf reference.
Definition at line 861 of file SymbolTable.cpp.
Referenced by replaceAllSymbolUsesImpl().
|
static |
Returns the string name of the given symbol, or null if this is not a symbol.
Definition at line 26 of file SymbolTable.cpp.
Referenced by collectValidReferencesFor(), mlir::SymbolTable::lookupSymbolIn(), mlir::SymbolTable::remove(), mlir::SymbolTable::rename(), mlir::SymbolTable::renameToUnique(), mlir::SymbolTable::SymbolTable(), and mlir::detail::verifySymbolTable().
|
static |
The implementation of SymbolTable::getSymbolUses below.
Definition at line 755 of file SymbolTable.cpp.
References mlir::WalkResult::advance(), result, and walkSymbolUses().
Referenced by mlir::SymbolTable::getSymbolUses(), mlir::SymbolTable::getSymbolUses(), mlir::SymbolTable::getSymbolUses(), mlir::SymbolTable::getSymbolUses(), mlir::SymbolTable::getSymbolUses(), and mlir::SymbolTable::getSymbolUses().
|
static |
The implementation of SymbolTable::getSymbolUses below.
Definition at line 786 of file SymbolTable.cpp.
References collectSymbolScopes().
Return true if the given operation is unknown and may potentially define a symbol table.
Definition at line 20 of file SymbolTable.cpp.
References mlir::Operation::getDialect(), and mlir::Operation::getNumRegions().
Referenced by mlir::SymbolTable::getNearestSymbolTable(), walkSymbolUses(), and walkSymbolUses().
|
static |
Returns true if the given reference 'SubRef' is a sub reference of the reference 'ref', i.e.
'ref' is a further qualified reference.
Definition at line 733 of file SymbolTable.cpp.
Referenced by replaceAllSymbolUsesImpl().
|
static |
Internal implementation of lookupSymbolIn that allows for specialized implementations of the lookup function.
Definition at line 387 of file SymbolTable.cpp.
References mlir::Operation::hasTrait(), and success().
Referenced by mlir::LockedSymbolTableCollection::lookupSymbolIn(), mlir::SymbolTable::lookupSymbolIn(), and mlir::SymbolTableCollection::lookupSymbolIn().
|
static |
The implementation of SymbolTable::replaceAllSymbolUses below.
Definition at line 873 of file SymbolTable.cpp.
References mlir::detail::AttrTypeReplacerBase< Concrete >::addReplacement(), mlir::WalkResult::advance(), collectSymbolScopes(), generateNewRefAttr(), mlir::FlatSymbolRefAttr::get(), isReferencePrefixOf(), mlir::detail::AttrTypeReplacerBase< Concrete >::replaceElementsIn(), mlir::WalkResult::skip(), and success().
Referenced by mlir::SymbolTable::replaceAllSymbolUses(), mlir::SymbolTable::replaceAllSymbolUses(), mlir::SymbolTable::replaceAllSymbolUses(), and mlir::SymbolTable::replaceAllSymbolUses().
|
static |
The implementation of SymbolTable::symbolKnownUseEmpty below.
Definition at line 826 of file SymbolTable.cpp.
References mlir::WalkResult::advance(), and collectSymbolScopes().
Referenced by mlir::SymbolTable::symbolKnownUseEmpty(), mlir::SymbolTable::symbolKnownUseEmpty(), mlir::SymbolTable::symbolKnownUseEmpty(), and mlir::SymbolTable::symbolKnownUseEmpty().
|
static |
Walk all of the symbol references within the given operation, invoking the provided callback for each found use.
The callbacks takes the use of the symbol.
Definition at line 536 of file SymbolTable.cpp.
References mlir::WalkResult::advance(), mlir::Operation::getName(), mlir::Operation::getRawDictionaryAttrs(), mlir::WalkResult::interrupt(), mlir::PreOrder, mlir::WalkResult::skip(), and mlir::OperationName::walkInherentAttrs().
Referenced by walkSymbolUses(), and walkSymbolUses().
|
static |
Walk all of the operations within the given set of regions, without traversing into any nested symbol tables.
Stops walking if the result of the callback is anything other than WalkResult::advance.
Definition at line 76 of file SymbolTable.cpp.
References mlir::WalkResult::advance(), and result.
Referenced by mlir::detail::verifySymbolTable(), walkSymbolTable(), and walkSymbolUses().
|
static |
Walk all of the operations nested under, and including, the given operation, without traversing into any nested symbol tables.
Stops walking if the result of the callback is anything other than WalkResult::advance.
Definition at line 100 of file SymbolTable.cpp.
References mlir::WalkResult::advance(), mlir::Operation::getRegions(), mlir::Operation::hasTrait(), result, and walkSymbolTable().
|
static |
Walk all of the uses, for any symbol, that are nested within the given regions, invoking the provided callback for each.
This does not traverse into any nested symbol tables.
Definition at line 561 of file SymbolTable.cpp.
References isPotentiallyUnknownSymbolTable(), walkSymbolRefs(), and walkSymbolTable().
Referenced by getSymbolUsesImpl(), and walkSymbolUses().
|
static |
Walk all of the uses, for any symbol, that are nested within the given operation 'from', invoking the provided callback for each.
This does not traverse into any nested symbol tables.
Definition at line 577 of file SymbolTable.cpp.
References mlir::WalkResult::advance(), mlir::Operation::getRegions(), mlir::Operation::hasTrait(), mlir::WalkResult::interrupt(), isPotentiallyUnknownSymbolTable(), walkSymbolRefs(), and walkSymbolUses().