MLIR  21.0.0git
Public Member Functions | Friends | List of all members
mlir::SymbolTableCollection Class Reference

This class represents a collection of SymbolTables. More...

#include "mlir/IR/SymbolTable.h"

+ Inheritance diagram for mlir::SymbolTableCollection:

Public Member Functions

virtual ~SymbolTableCollection ()=default
 
virtual OperationlookupSymbolIn (Operation *symbolTableOp, StringAttr symbol)
 Look up a symbol with the specified name within the specified symbol table operation, returning null if no such name exists. More...
 
virtual OperationlookupSymbolIn (Operation *symbolTableOp, SymbolRefAttr name)
 
template<typename T , typename NameT >
lookupSymbolIn (Operation *symbolTableOp, NameT &&name)
 
virtual LogicalResult lookupSymbolIn (Operation *symbolTableOp, SymbolRefAttr name, SmallVectorImpl< Operation * > &symbols)
 A variant of 'lookupSymbolIn' that returns all of the symbols referenced by a given SymbolRefAttr when resolved within the provided symbol table operation. More...
 
virtual OperationlookupNearestSymbolFrom (Operation *from, StringAttr symbol)
 Returns the operation registered with the given symbol name within the closest parent operation of, or including, 'from' with the 'OpTrait::SymbolTable' trait. More...
 
virtual OperationlookupNearestSymbolFrom (Operation *from, SymbolRefAttr symbol)
 
template<typename T >
lookupNearestSymbolFrom (Operation *from, StringAttr symbol)
 
template<typename T >
lookupNearestSymbolFrom (Operation *from, SymbolRefAttr symbol)
 
virtual SymbolTablegetSymbolTable (Operation *op)
 Lookup, or create, a symbol table for an operation. More...
 
virtual void invalidateSymbolTable (Operation *op)
 Invalidate the cached symbol table for an operation. More...
 

Friends

class LockedSymbolTableCollection
 

Detailed Description

This class represents a collection of SymbolTables.

This simplifies certain algorithms that run recursively on nested symbol tables. Symbol tables are constructed lazily to reduce the upfront cost of constructing unnecessary tables.

Definition at line 283 of file SymbolTable.h.

Constructor & Destructor Documentation

◆ ~SymbolTableCollection()

virtual mlir::SymbolTableCollection::~SymbolTableCollection ( )
virtualdefault

Member Function Documentation

◆ getSymbolTable()

SymbolTable & SymbolTableCollection::getSymbolTable ( Operation op)
virtual

Lookup, or create, a symbol table for an operation.

Definition at line 994 of file SymbolTable.cpp.

Referenced by mlir::bufferization::getGlobalFor(), and lookupSymbolIn().

◆ invalidateSymbolTable()

void SymbolTableCollection::invalidateSymbolTable ( Operation op)
virtual

Invalidate the cached symbol table for an operation.

This is important when doing IR modifications that erase and also create operations having the 'OpTrait::SymbolTable' trait. If a symbol table of an erased operation is not invalidated, a new operation sharing the same address would be associated with outdated, and wrong, information.

Definition at line 1001 of file SymbolTable.cpp.

◆ lookupNearestSymbolFrom() [1/4]

Operation * SymbolTableCollection::lookupNearestSymbolFrom ( Operation from,
StringAttr  symbol 
)
virtual

Returns the operation registered with the given symbol name within the closest parent operation of, or including, 'from' with the 'OpTrait::SymbolTable' trait.

Returns nullptr if no valid symbol was found.

Definition at line 981 of file SymbolTable.cpp.

References mlir::SymbolTable::getNearestSymbolTable(), and lookupSymbolIn().

Referenced by mlir::bufferization::func_ext::getCalledFunction(), getCalledFunction(), mlir::mesh::getMeshOrNull(), lookupNearestSymbolFrom(), mlir::irdl::lookupSymbolNearDialect(), mlir::call_interface_impl::resolveCallable(), verifySymbolAttrUse(), and walkReferencedSymbolNodes().

◆ lookupNearestSymbolFrom() [2/4]

template<typename T >
T mlir::SymbolTableCollection::lookupNearestSymbolFrom ( Operation from,
StringAttr  symbol 
)
inline

Definition at line 315 of file SymbolTable.h.

References lookupNearestSymbolFrom().

◆ lookupNearestSymbolFrom() [3/4]

Operation * SymbolTableCollection::lookupNearestSymbolFrom ( Operation from,
SymbolRefAttr  symbol 
)
virtual

◆ lookupNearestSymbolFrom() [4/4]

template<typename T >
T mlir::SymbolTableCollection::lookupNearestSymbolFrom ( Operation from,
SymbolRefAttr  symbol 
)
inline

Definition at line 319 of file SymbolTable.h.

References lookupNearestSymbolFrom().

◆ lookupSymbolIn() [1/4]

template<typename T , typename NameT >
T mlir::SymbolTableCollection::lookupSymbolIn ( Operation symbolTableOp,
NameT &&  name 
)
inline

Definition at line 294 of file SymbolTable.h.

References lookupSymbolIn().

◆ lookupSymbolIn() [2/4]

Operation * SymbolTableCollection::lookupSymbolIn ( Operation symbolTableOp,
StringAttr  symbol 
)
virtual

Look up a symbol with the specified name within the specified symbol table operation, returning null if no such name exists.

Reimplemented in mlir::LockedSymbolTableCollection.

Definition at line 953 of file SymbolTable.cpp.

References getSymbolTable(), and mlir::SymbolTable::lookup().

Referenced by lookupNearestSymbolFrom(), lookupSymbolIn(), mlir::SymbolUserMap::replaceAllUsesWith(), mlir::AsmParserState::Impl::resolveSymbolUses(), and mlir::SymbolUserMap::SymbolUserMap().

◆ lookupSymbolIn() [3/4]

Operation * SymbolTableCollection::lookupSymbolIn ( Operation symbolTableOp,
SymbolRefAttr  name 
)
virtual

Reimplemented in mlir::LockedSymbolTableCollection.

Definition at line 957 of file SymbolTable.cpp.

References lookupSymbolIn().

◆ lookupSymbolIn() [4/4]

LogicalResult SymbolTableCollection::lookupSymbolIn ( Operation symbolTableOp,
SymbolRefAttr  name,
SmallVectorImpl< Operation * > &  symbols 
)
virtual

A variant of 'lookupSymbolIn' that returns all of the symbols referenced by a given SymbolRefAttr when resolved within the provided symbol table operation.

A variant of 'lookupSymbolIn' that returns all of the symbols referenced by a given SymbolRefAttr.

Returns failure if any of the nested references could not be resolved.

Reimplemented in mlir::LockedSymbolTableCollection.

Definition at line 968 of file SymbolTable.cpp.

References lookupSymbolIn(), and lookupSymbolInImpl().

Friends And Related Function Documentation

◆ LockedSymbolTableCollection

Definition at line 334 of file SymbolTable.h.


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