MLIR
20.0.0git
|
Attribute collections provide a dictionary-like interface. More...
Functions | |
LogicalResult | verifyHasDefaultDLTIDataLayoutTrait (Operation *op) |
DataLayoutSpecInterface | getDataLayoutSpec (Operation *op) |
TargetSystemSpecInterface | getTargetSystemSpec (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 ®ion, 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 ®ion, 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< NamedAttribute > | getNamedAttrFromSortedRange (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... | |
Attribute collections provide a dictionary-like interface.
Define common lookup functions.
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 1423 of file Operation.cpp.
References ensureRegionTerminator(), and mlir::Builder::getContext().
Referenced by mlir::OpTrait::SingleBlockImplicitTerminator< TerminatorOpType >::Impl< ConcreteType >::ensureTerminator().
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 1406 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().
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 768 of file OperationSupport.h.
References findAttrSorted(), and findAttrUnsorted().
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 744 of file OperationSupport.h.
References mlir::presburger::compare().
Referenced by findAttrSorted(), getAttrFromSortedRange(), and getNamedAttrFromSortedRange().
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 731 of file OperationSupport.h.
Referenced by findAttrSorted().
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.
References mlir::Operation::getOperands(), mlir::Operation::getResults(), mlir::OperandRange::getTypes(), and mlir::ResultRange::getTypes().
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 779 of file OperationSupport.h.
References findAttrSorted().
DataLayoutSpecInterface mlir::impl::getDataLayoutSpec | ( | Operation * | op | ) |
Definition at line 26 of file Traits.cpp.
References mlir::Operation::getAttrOfType().
Referenced by mlir::HasDefaultDLTIDataLayout< ConcreteOp >::getDataLayoutSpec().
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 788 of file OperationSupport.h.
References findAttrSorted().
TargetSystemSpecInterface mlir::impl::getTargetSystemSpec | ( | Operation * | op | ) |
Definition at line 31 of file Traits.cpp.
References mlir::Operation::getAttrOfType().
Referenced by mlir::HasDefaultDLTIDataLayout< ConcreteOp >::getTargetSystemSpec().
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::AsmParser::getBuilder(), mlir::Builder::getNamedAttr(), mlir::Builder::getStringAttr(), mlir::SymbolTable::getVisibilityAttrName(), mlir::AsmParser::parseOptionalKeyword(), and mlir::NamedAttrList::push_back().
Referenced by mlir::function_interface_impl::parseFunctionOp().
LogicalResult mlir::impl::scalarizeVectorOp | ( | Operation * | op, |
ValueRange | operands, | ||
ConversionPatternRewriter & | rewriter, | ||
const LLVMTypeConverter & | converter | ||
) |
Unrolls op if it's operating on vectors.
Definition at line 592 of file GPUOpsLowering.cpp.
References mlir::LLVMTypeConverter::convertType(), mlir::OpBuilder::create(), mlir::Operation::getAttrs(), mlir::OperationName::getIdentifier(), mlir::Builder::getIndexType(), mlir::Operation::getLoc(), mlir::Operation::getName(), mlir::Operation::getNumRegions(), mlir::Operation::getNumResults(), mlir::Operation::getNumSuccessors(), mlir::Operation::getResult(), mlir::Value::getType(), mlir::RewriterBase::notifyMatchFailure(), and mlir::ConversionPatternRewriter::replaceOp().
Referenced by mlir::ScalarizeVectorOpLowering< SourceOp >::matchAndRewrite().
LogicalResult mlir::impl::verifyCastInterfaceOp | ( | Operation * | op | ) |
Attempt to verify the given cast operation.
Definition at line 39 of file CastInterfaces.cpp.
References diag(), mlir::Operation::emitOpError(), mlir::Operation::getOperandTypes(), and mlir::Operation::getResultTypes().
LogicalResult mlir::impl::verifyHasDefaultDLTIDataLayoutTrait | ( | Operation * | op | ) |
Definition at line 15 of file Traits.cpp.
Referenced by mlir::HasDefaultDLTIDataLayout< ConcreteOp >::verifyTrait().