MLIR  16.0.0git
Classes | Functions
mlir::impl Namespace Reference

Attribute collections provide a dictionary-like interface. More...

Classes

class  DataLayoutEntryStorage
 
class  DataLayoutSpecStorage
 

Functions

LogicalResult verifyHasDefaultDLTIDataLayoutTrait (Operation *op)
 
DataLayoutSpecInterface getDataLayoutSpec (Operation *op)
 
void ensureRegionTerminator (Region &region, OpBuilder &builder, Location loc, function_ref< Operation *(OpBuilder &, Location)> buildTerminatorOp)
 Insert an operation, generated by buildTerminatorOp, at the end of the region's only block if it does not have a terminator already. More...
 
void ensureRegionTerminator (Region &region, Builder &builder, Location loc, function_ref< Operation *(OpBuilder &, Location)> buildTerminatorOp)
 Create a simple OpBuilder and forward to the OpBuilder version of this function. More...
 
LogicalResult foldCastInterfaceOp (Operation *op, ArrayRef< Attribute > attrOperands, SmallVectorImpl< OpFoldResult > &foldResults)
 Attempt to fold the given cast operation. More...
 
LogicalResult verifyCastInterfaceOp (Operation *op, function_ref< bool(TypeRange, TypeRange)> areCastCompatible)
 Attempt to verify the given cast operation. More...
 
template<typename IteratorT , typename NameT >
std::pair< IteratorT, bool > findAttrUnsorted (IteratorT first, IteratorT last, NameT name)
 Unsorted string search or identifier lookups are linear scans. More...
 
template<typename IteratorT >
std::pair< IteratorT, bool > findAttrSorted (IteratorT first, IteratorT last, StringRef name)
 Using llvm::lower_bound requires an extra string comparison to check whether the returned iterator points to the found element or whether it indicates the lower bound. More...
 
template<typename IteratorT >
std::pair< IteratorT, bool > findAttrSorted (IteratorT first, IteratorT last, StringAttr name)
 StringAttr lookups on large attribute lists will switch to string binary search. More...
 
template<typename IteratorT , typename NameT >
Attribute getAttrFromSortedRange (IteratorT first, IteratorT last, NameT name)
 Get an attribute from a sorted range of named attributes. More...
 
template<typename IteratorT , typename NameT >
Optional< NamedAttributegetNamedAttrFromSortedRange (IteratorT first, IteratorT last, NameT name)
 Get an attribute from a sorted range of named attributes. More...
 
ParseResult parseOptionalVisibilityKeyword (OpAsmParser &parser, NamedAttrList &attrs)
 Parse an optional visibility attribute keyword (i.e., public, private, or nested) without quotes in a string attribute named 'attrName'. More...
 

Detailed Description

Attribute collections provide a dictionary-like interface.

Define common lookup functions.

Function Documentation

◆ ensureRegionTerminator() [1/2]

void mlir::impl::ensureRegionTerminator ( Region region,
OpBuilder builder,
Location  loc,
function_ref< Operation *(OpBuilder &, Location)>  buildTerminatorOp 
)

Insert an operation, generated by buildTerminatorOp, at the end of the region's only block if it does not have a terminator already.

If the region is empty, insert a new block first. buildTerminatorOp should return the terminator operation to insert.

Definition at line 1188 of file Operation.cpp.

References mlir::Region::back(), mlir::Block::back(), mlir::OpBuilder::createBlock(), mlir::Region::empty(), mlir::Block::empty(), mlir::Operation::hasTrait(), mlir::OpBuilder::insert(), and mlir::OpBuilder::setInsertionPointToEnd().

Referenced by ensureRegionTerminator().

◆ ensureRegionTerminator() [2/2]

void mlir::impl::ensureRegionTerminator ( Region region,
Builder builder,
Location  loc,
function_ref< Operation *(OpBuilder &, Location)>  buildTerminatorOp 
)

◆ findAttrSorted() [1/2]

template<typename IteratorT >
std::pair<IteratorT, bool> mlir::impl::findAttrSorted ( IteratorT  first,
IteratorT  last,
StringRef  name 
)

Using llvm::lower_bound requires an extra string comparison to check whether the returned iterator points to the found element or whether it indicates the lower bound.

Skip this redundant comparison by checking if compare == 0 during the binary search.

Definition at line 427 of file OperationSupport.h.

References mlir::presburger::compare().

Referenced by findDuplicateElement().

◆ findAttrSorted() [2/2]

template<typename IteratorT >
std::pair<IteratorT, bool> mlir::impl::findAttrSorted ( IteratorT  first,
IteratorT  last,
StringAttr  name 
)

StringAttr lookups on large attribute lists will switch to string binary search.

String binary searches become significantly faster than linear scans with the identifier when the attribute list becomes very large.

Definition at line 451 of file OperationSupport.h.

References findAttrUnsorted().

Referenced by getAttrFromSortedRange(), and getNamedAttrFromSortedRange().

◆ findAttrUnsorted()

template<typename IteratorT , typename NameT >
std::pair<IteratorT, bool> mlir::impl::findAttrUnsorted ( IteratorT  first,
IteratorT  last,
NameT  name 
)

Unsorted string search or identifier lookups are linear scans.

Definition at line 414 of file OperationSupport.h.

Referenced by findAttrSorted().

◆ foldCastInterfaceOp()

LogicalResult mlir::impl::foldCastInterfaceOp ( Operation op,
ArrayRef< Attribute attrOperands,
SmallVectorImpl< OpFoldResult > &  foldResults 
)

◆ getAttrFromSortedRange()

template<typename IteratorT , typename NameT >
Attribute mlir::impl::getAttrFromSortedRange ( IteratorT  first,
IteratorT  last,
NameT  name 
)

Get an attribute from a sorted range of named attributes.

Returns null if the attribute was not found.

Definition at line 462 of file OperationSupport.h.

References findAttrSorted().

◆ getDataLayoutSpec()

DataLayoutSpecInterface mlir::impl::getDataLayoutSpec ( Operation op)

◆ getNamedAttrFromSortedRange()

template<typename IteratorT , typename NameT >
Optional<NamedAttribute> mlir::impl::getNamedAttrFromSortedRange ( IteratorT  first,
IteratorT  last,
NameT  name 
)

Get an attribute from a sorted range of named attributes.

Returns None if the attribute was not found.

Definition at line 471 of file OperationSupport.h.

References findAttrSorted().

◆ parseOptionalVisibilityKeyword()

ParseResult mlir::impl::parseOptionalVisibilityKeyword ( OpAsmParser parser,
NamedAttrList attrs 
)

◆ verifyCastInterfaceOp()

LogicalResult mlir::impl::verifyCastInterfaceOp ( Operation op,
function_ref< bool(TypeRange, TypeRange)>  areCastCompatible 
)

Attempt to verify the given cast operation.

Definition at line 1157 of file Operation.cpp.

References diag(), mlir::Operation::emitOpError(), mlir::Operation::getOperandTypes(), mlir::Operation::getResultTypes(), and mlir::success().

◆ verifyHasDefaultDLTIDataLayoutTrait()

LogicalResult mlir::impl::verifyHasDefaultDLTIDataLayoutTrait ( Operation op)

Definition at line 15 of file Traits.cpp.

References mlir::success().

Referenced by mlir::HasDefaultDLTIDataLayout< ConcreteOp >::verifyTrait().