MLIR  19.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)
 
LogicalResult foldCastInterfaceOp (Operation *op, ArrayRef< Attribute > attrOperands, SmallVectorImpl< OpFoldResult > &foldResults)
 Attempt to fold the given cast operation. More...
 
LogicalResult verifyCastInterfaceOp (Operation *op)
 Attempt to verify the given cast operation. More...
 
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...
 
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 >
std::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...
 
LogicalResult scalarizeVectorOp (Operation *op, ValueRange operands, ConversionPatternRewriter &rewriter, const LLVMTypeConverter &converter)
 Unrolls op if it's operating on vectors. 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,
Builder builder,
Location  loc,
function_ref< Operation *(OpBuilder &, Location)>  buildTerminatorOp 
)

Create a simple OpBuilder and forward to the OpBuilder version of this function.

Definition at line 1405 of file Operation.cpp.

References ensureRegionTerminator(), and mlir::Builder::getContext().

Referenced by mlir::OpTrait::SingleBlockImplicitTerminator< TerminatorOpType >::Impl< ConcreteType >::ensureTerminator().

◆ ensureRegionTerminator() [2/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 1388 of file Operation.cpp.

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

Referenced by ensureRegionTerminator().

◆ findAttrSorted() [1/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 764 of file OperationSupport.h.

References findAttrSorted(), and findAttrUnsorted().

◆ findAttrSorted() [2/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 740 of file OperationSupport.h.

References mlir::presburger::compare().

Referenced by findAttrSorted(), 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 727 of file OperationSupport.h.

Referenced by findAttrSorted().

◆ foldCastInterfaceOp()

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

Attempt to fold the given cast operation.

Definition at line 22 of file CastInterfaces.cpp.

◆ 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 775 of file OperationSupport.h.

References findAttrSorted().

◆ getDataLayoutSpec()

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

◆ getNamedAttrFromSortedRange()

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

Get an attribute from a sorted range of named attributes.

Returns std::nullopt if the attribute was not found.

Definition at line 784 of file OperationSupport.h.

References findAttrSorted().

◆ parseOptionalVisibilityKeyword()

ParseResult mlir::impl::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'.

Definition at line 1110 of file SymbolTable.cpp.

References mlir::failure(), mlir::AsmParser::getBuilder(), mlir::Builder::getNamedAttr(), mlir::Builder::getStringAttr(), mlir::SymbolTable::getVisibilityAttrName(), mlir::AsmParser::parseOptionalKeyword(), mlir::NamedAttrList::push_back(), and mlir::success().

Referenced by mlir::function_interface_impl::parseFunctionOp().

◆ scalarizeVectorOp()

LogicalResult mlir::impl::scalarizeVectorOp ( Operation op,
ValueRange  operands,
ConversionPatternRewriter rewriter,
const LLVMTypeConverter converter 
)

Unrolls op if it's operating on vectors.

Definition at line 544 of file GPUOpsLowering.cpp.

◆ verifyCastInterfaceOp()

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

Attempt to verify the given cast operation.

Definition at line 39 of file CastInterfaces.cpp.

◆ verifyHasDefaultDLTIDataLayoutTrait()

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

Definition at line 15 of file Traits.cpp.