MLIR
21.0.0git
|
This represents an operation in an abstracted form, suitable for use with the builder APIs. More...
#include "mlir/IR/OperationSupport.h"
Public Member Functions | |
OperationState (Location location, StringRef name) | |
OperationState (Location location, OperationName name) | |
OperationState (Location location, OperationName name, ValueRange operands, TypeRange types, ArrayRef< NamedAttribute > attributes={}, BlockRange successors={}, MutableArrayRef< std::unique_ptr< Region >> regions={}) | |
OperationState (Location location, StringRef name, ValueRange operands, TypeRange types, ArrayRef< NamedAttribute > attributes={}, BlockRange successors={}, MutableArrayRef< std::unique_ptr< Region >> regions={}) | |
OperationState (OperationState &&other)=default | |
OperationState (const OperationState &other)=default | |
OperationState & | operator= (OperationState &&other)=default |
OperationState & | operator= (const OperationState &other)=default |
~OperationState () | |
template<typename T > | |
T & | getOrAddProperties () |
Get (or create) a properties of the provided type to be set on the operation on creation. More... | |
OpaqueProperties | getRawProperties () |
LogicalResult | setProperties (Operation *op, function_ref< InFlightDiagnostic()> emitError) const |
void | addOperands (ValueRange newOperands) |
void | addTypes (ArrayRef< Type > newTypes) |
template<typename RangeT > | |
std::enable_if_t<!std::is_convertible< RangeT, ArrayRef< Type > >::value > | addTypes (RangeT &&newTypes) |
void | addAttribute (StringRef name, Attribute attr) |
Add an attribute with the specified name. More... | |
void | addAttribute (StringAttr name, Attribute attr) |
Add an attribute with the specified name. More... | |
void | addAttributes (ArrayRef< NamedAttribute > newAttributes) |
Add an array of named attributes. More... | |
void | addSuccessors (Block *successor) |
Adds a successor to the operation sate. successor must not be null. More... | |
void | addSuccessors (BlockRange newSuccessors) |
Region * | addRegion () |
Create a region that should be attached to the operation. More... | |
void | addRegion (std::unique_ptr< Region > &®ion) |
Take a region that should be attached to the Operation. More... | |
void | addRegions (MutableArrayRef< std::unique_ptr< Region >> regions) |
Take ownership of a set of regions that should be attached to the Operation. More... | |
MLIRContext * | getContext () const |
Get the context held by this operation state. More... | |
Public Attributes | |
Location | location |
OperationName | name |
SmallVector< Value, 4 > | operands |
SmallVector< Type, 4 > | types |
Types of the results of this operation. More... | |
NamedAttrList | attributes |
SmallVector< Block *, 1 > | successors |
Successors of this operation and their respective operands. More... | |
SmallVector< std::unique_ptr< Region >, 1 > | regions |
Regions that the op will hold. More... | |
Attribute | propertiesAttr |
This Attribute is used to opaquely construct the properties of the operation. More... | |
Friends | |
class | Operation |
This represents an operation in an abstracted form, suitable for use with the builder APIs.
This object is a large and heavy weight object meant to be used as a temporary object on the stack. It is generally unwise to put this in a collection.
Definition at line 947 of file OperationSupport.h.
OperationState::OperationState | ( | Location | location, |
StringRef | name | ||
) |
Definition at line 164 of file OperationSupport.cpp.
OperationState::OperationState | ( | Location | location, |
OperationName | name | ||
) |
Definition at line 167 of file OperationSupport.cpp.
OperationState::OperationState | ( | Location | location, |
OperationName | name, | ||
ValueRange | operands, | ||
TypeRange | types, | ||
ArrayRef< NamedAttribute > | attributes = {} , |
||
BlockRange | successors = {} , |
||
MutableArrayRef< std::unique_ptr< Region >> | regions = {} |
||
) |
Definition at line 170 of file OperationSupport.cpp.
OperationState::OperationState | ( | Location | location, |
StringRef | name, | ||
ValueRange | operands, | ||
TypeRange | types, | ||
ArrayRef< NamedAttribute > | attributes = {} , |
||
BlockRange | successors = {} , |
||
MutableArrayRef< std::unique_ptr< Region >> | regions = {} |
||
) |
Definition at line 183 of file OperationSupport.cpp.
|
default |
|
default |
OperationState::~OperationState | ( | ) |
Definition at line 191 of file OperationSupport.cpp.
|
inline |
Add an attribute with the specified name.
name
and attr
must not be null.
Definition at line 1038 of file OperationSupport.h.
References mlir::NamedAttrList::append(), attributes, and name.
|
inline |
Add an attribute with the specified name.
Definition at line 1032 of file OperationSupport.h.
References mlir::get(), getContext(), and name.
Referenced by mlir::affine::AffineDmaStartOp::build(), mlir::affine::AffineDmaWaitOp::build(), buildAvgPool2dOpWithQuantInfo(), buildConvOpWithQuantInfo(), buildExplicitValuePadOpWithQuantInfo(), buildMatMulOpWithQuantInfo(), buildPadOpWithQuantInfo(), buildTransConvOpWithQuantInfo(), buildUnaryOpWithQuantInfo(), parseAffineMapWithMinMax(), parseBound(), parseCommonGlobalAndAlias(), parseCommonStructuredOpParts(), and mlir::function_interface_impl::parseFunctionOp().
|
inline |
Add an array of named attributes.
Definition at line 1045 of file OperationSupport.h.
References mlir::NamedAttrList::append(), and attributes.
Referenced by mlir::convertOpResultTypes().
void OperationState::addOperands | ( | ValueRange | newOperands | ) |
Definition at line 207 of file OperationSupport.cpp.
References operands.
Referenced by mlir::affine::AffineDmaStartOp::build(), mlir::affine::AffineDmaWaitOp::build(), buildAvgPool2dOpWithQuantInfo(), buildConvOpWithQuantInfo(), buildExplicitValuePadOpWithQuantInfo(), buildMatMulOpWithQuantInfo(), buildPadOpWithQuantInfo(), buildTransConvOpWithQuantInfo(), buildUnaryOpWithQuantInfo(), and mlir::convertOpResultTypes().
Region * OperationState::addRegion | ( | ) |
Create a region that should be attached to the operation.
These regions can be filled in immediately without waiting for Operation to be created. When it is, the region bodies will be transferred.
Definition at line 215 of file OperationSupport.cpp.
References regions.
Referenced by addBodyWithPayloadOp(), addRegions(), mlir::function_interface_impl::parseFunctionOp(), and parseNamedStructuredOp().
void OperationState::addRegion | ( | std::unique_ptr< Region > && | region | ) |
void OperationState::addRegions | ( | MutableArrayRef< std::unique_ptr< Region >> | regions | ) |
Take ownership of a set of regions that should be attached to the Operation.
Definition at line 224 of file OperationSupport.cpp.
References addRegion(), and regions.
|
inline |
Adds a successor to the operation sate. successor
must not be null.
Definition at line 1050 of file OperationSupport.h.
References successors.
void OperationState::addSuccessors | ( | BlockRange | newSuccessors | ) |
Definition at line 211 of file OperationSupport.cpp.
References successors.
Definition at line 1022 of file OperationSupport.h.
References types.
Referenced by buildConvOpWithQuantInfo(), buildMatMulOpWithQuantInfo(), buildTransConvOpWithQuantInfo(), mlir::convertOpResultTypes(), parseArithmeticExtendedBinaryOp(), parseCallTypeAndResolveOperands(), parseCmpOp(), parseDstStyleOp(), parseNamedStructuredOp(), and parseOneResultSameOperandTypeOp().
|
inline |
Definition at line 1027 of file OperationSupport.h.
References types.
|
inline |
Get the context held by this operation state.
Definition at line 1071 of file OperationSupport.h.
References mlir::Attribute::getContext(), and location.
Referenced by addAttribute(), and mlir::Op< ConcreteType, Traits >::parseProperties().
|
inline |
Get (or create) a properties of the provided type to be set on the operation on creation.
Definition at line 996 of file OperationSupport.h.
References mlir::OpaqueProperties::as().
Referenced by mlir::Op< ConcreteType, Traits >::parseProperties().
|
inline |
Definition at line 1012 of file OperationSupport.h.
|
default |
|
default |
LogicalResult OperationState::setProperties | ( | Operation * | op, |
function_ref< InFlightDiagnostic()> | emitError | ||
) | const |
Definition at line 196 of file OperationSupport.cpp.
References mlir::emitError(), mlir::Operation::getPropertiesStorage(), propertiesAttr, and mlir::Operation::setPropertiesFromAttribute().
Definition at line 973 of file OperationSupport.h.
NamedAttrList mlir::OperationState::attributes |
Definition at line 953 of file OperationSupport.h.
Referenced by addAttribute(), addAttributes(), mlir::affine::AffineDmaStartOp::parse(), mlir::affine::AffineDmaWaitOp::parse(), parseAffineMapWithMinMax(), parseAffineMinMaxOp(), parseArithmeticExtendedBinaryOp(), parseBound(), parseCmpOp(), parseCommonStructuredOpParts(), parseDstStyleOp(), mlir::function_interface_impl::parseFunctionOp(), parseNamedStructuredOp(), and parseOneResultSameOperandTypeOp().
Location mlir::OperationState::location |
Definition at line 948 of file OperationSupport.h.
Referenced by addBodyWithPayloadOp(), getContext(), and mlir::Op< ConcreteType, Traits >::parseProperties().
OperationName mlir::OperationState::name |
Definition at line 949 of file OperationSupport.h.
Referenced by addAttribute(), mlir::OpState::parse(), parseBound(), parseCommonGlobalAndAlias(), parseCommonStructuredOpParts(), and mlir::Op< ConcreteType, Traits >::parseProperties().
SmallVector<Value, 4> mlir::OperationState::operands |
Definition at line 950 of file OperationSupport.h.
Referenced by addOperands(), mlir::affine::AffineDmaStartOp::parse(), mlir::affine::AffineDmaWaitOp::parse(), parseAffineMapWithMinMax(), parseAffineMinMaxOp(), parseArithmeticExtendedBinaryOp(), parseBound(), parseCallTypeAndResolveOperands(), parseCmpOp(), parseCommonStructuredOpParts(), and parseOneResultSameOperandTypeOp().
Attribute mlir::OperationState::propertiesAttr |
This Attribute is used to opaquely construct the properties of the operation.
If we're creating an unregistered operation, the Attribute is used as-is as the Properties storage of the operation. Otherwise, the operation properties are constructed opaquely using its setPropertiesFromAttr
hook. Note that getOrAddProperties
is the preferred method to construct properties from C++.
Definition at line 965 of file OperationSupport.h.
Referenced by parseCommonStructuredOpParts(), and setProperties().
SmallVector<std::unique_ptr<Region>, 1> mlir::OperationState::regions |
Regions that the op will hold.
Definition at line 957 of file OperationSupport.h.
Referenced by addRegion(), and addRegions().
SmallVector<Block *, 1> mlir::OperationState::successors |
Successors of this operation and their respective operands.
Definition at line 955 of file OperationSupport.h.
Referenced by addSuccessors().
SmallVector<Type, 4> mlir::OperationState::types |
Types of the results of this operation.
Definition at line 952 of file OperationSupport.h.
Referenced by addTypes(), buildAvgPool2dOpWithQuantInfo(), buildExplicitValuePadOpWithQuantInfo(), buildPadOpWithQuantInfo(), buildUnaryOpWithQuantInfo(), parseAffineMinMaxOp(), and parseOneResultSameOperandTypeOp().