|
MLIR 24.0.0git
|
Wrapper class that contains a MLIR op's information (e.g., operands, attributes) defined in TableGen and provides helper methods for accessing them. More...
#include "mlir/TableGen/Operator.h"
Classes | |
| struct | OperandAttrOrProp |
| Pair consisting kind of argument and index into operands, attributes, or properties. More... | |
| struct | VariableDecorator |
| A class used to represent the decorators of an operator variable, i.e. More... | |
| struct | VariableDecoratorIterator |
| A utility iterator over a list of variable decorators. More... | |
Public Types | |
| using | var_decorator_iterator = VariableDecoratorIterator |
| using | var_decorator_range = llvm::iterator_range<VariableDecoratorIterator> |
| using | value_iterator = NamedTypeConstraint * |
| using | const_value_iterator = const NamedTypeConstraint * |
| using | value_range = llvm::iterator_range<value_iterator> |
| using | const_value_range = llvm::iterator_range<const_value_iterator> |
| using | const_attribute_iterator = const NamedAttribute * |
| Op attribute iterators. | |
| using | attribute_iterator = NamedAttribute * |
| using | const_property_iterator = const NamedProperty * |
| using | property_iterator = NamedProperty * |
| using | arg_iterator = const Argument * |
| using | arg_range = llvm::iterator_range<arg_iterator> |
| using | const_region_iterator = const NamedRegion * |
| Regions. | |
| using | const_successor_iterator = const NamedSuccessor * |
| Successors. | |
| using | const_trait_iterator = const Trait * |
| Trait. | |
Public Member Functions | |
| Operator (const llvm::Record &def) | |
| Operator (const llvm::Record *def) | |
| StringRef | getDialectName () const |
| Returns this op's dialect name. | |
| std::string | getOperationName () const |
| Returns the operation name. | |
| StringRef | getCppClassName () const |
| Returns this op's C++ class name. | |
| std::string | getQualCppClassName () const |
| Returns this op's C++ class name prefixed with namespaces. | |
| StringRef | getCppNamespace () const |
| Returns this op's C++ namespace. | |
| std::string | getAdaptorName () const |
| Returns the name of op's adaptor C++ class. | |
| std::string | getGenericAdaptorName () const |
| Returns the name of op's generic adaptor C++ class. | |
| void | assertInvariants () const |
| Check invariants (like no duplicated or conflicted names) and abort the process if any invariant is broken. | |
| bool | isVariadic () const |
| Returns true if this op has variable length operands or results. | |
| bool | skipDefaultBuilders () const |
| Returns true if default builders should not be generated. | |
| bool | hasCustomPropertiesPrinter () const |
| Returns true if the operation provides a custom properties printer. | |
| const_value_iterator | result_begin () const |
| Op result iterators. | |
| const_value_iterator | result_end () const |
| const_value_range | getResults () const |
| int | getNumResults () const |
| Returns the number of results this op produces. | |
| NamedTypeConstraint & | getResult (int index) |
| Returns the op result at the given index. | |
| const NamedTypeConstraint & | getResult (int index) const |
| TypeConstraint | getResultTypeConstraint (int index) const |
| Returns the index-th result's type constraint. | |
| StringRef | getResultName (int index) const |
| Returns the index-th result's name. | |
| var_decorator_range | getResultDecorators (int index) const |
| Returns the index-th result's decorators. | |
| unsigned | getNumVariableLengthResults () const |
| Returns the number of variable length results in this operation. | |
| const_attribute_iterator | attribute_begin () const |
| const_attribute_iterator | attribute_end () const |
| llvm::iterator_range< const_attribute_iterator > | getAttributes () const |
| attribute_iterator | attribute_begin () |
| attribute_iterator | attribute_end () |
| llvm::iterator_range< attribute_iterator > | getAttributes () |
| int | getNumAttributes () const |
| int | getNumNativeAttributes () const |
| NamedAttribute & | getAttribute (int index) |
| Op attribute accessors. | |
| const NamedAttribute & | getAttribute (int index) const |
| const_value_iterator | operand_begin () const |
| Op operand iterators. | |
| const_value_iterator | operand_end () const |
| const_value_range | getOperands () const |
| const_property_iterator | properties_begin () const |
| const_property_iterator | properties_end () const |
| llvm::iterator_range< const_property_iterator > | getProperties () const |
| property_iterator | properties_begin () |
| property_iterator | properties_end () |
| llvm::iterator_range< property_iterator > | getProperties () |
| int | getNumCoreAttributes () const |
| NamedProperty & | getProperty (int index) |
| const NamedProperty & | getProperty (int index) const |
| int | getNumOperands () const |
| NamedTypeConstraint & | getOperand (int index) |
| const NamedTypeConstraint & | getOperand (int index) const |
| unsigned | getNumVariableLengthOperands () const |
| Returns the number of variadic operands in this operation. | |
| int | getNumArgs () const |
| Returns the total number of arguments. | |
| bool | hasSingleVariadicArg () const |
| Returns true of the operation has a single variadic arg. | |
| bool | hasSingleVariadicResult () const |
| Returns true if the operation has a single variadic result. | |
| bool | hasNoVariadicRegions () const |
| Returns true of the operation has no variadic regions. | |
| arg_iterator | arg_begin () const |
| Op argument (attribute or operand) iterators. | |
| arg_iterator | arg_end () const |
| arg_range | getArgs () const |
| Argument | getArg (int index) const |
| Op argument (attribute or operand) accessors. | |
| StringRef | getArgName (int index) const |
| var_decorator_range | getArgDecorators (int index) const |
| const Trait * | getTrait (llvm::StringRef trait) const |
| Returns the trait wrapper for the given MLIR C++ trait. | |
| const_region_iterator | region_begin () const |
| const_region_iterator | region_end () const |
| llvm::iterator_range< const_region_iterator > | getRegions () const |
| unsigned | getNumRegions () const |
| Returns the number of regions. | |
| const NamedRegion & | getRegion (unsigned index) const |
| Returns the index-th region. | |
| unsigned | getNumVariadicRegions () const |
| Returns the number of variadic regions in this operation. | |
| const_successor_iterator | successor_begin () const |
| const_successor_iterator | successor_end () const |
| llvm::iterator_range< const_successor_iterator > | getSuccessors () const |
| unsigned | getNumSuccessors () const |
| Returns the number of successors. | |
| const NamedSuccessor & | getSuccessor (unsigned index) const |
| Returns the index-th successor. | |
| unsigned | getNumVariadicSuccessors () const |
| Returns the number of variadic successors in this operation. | |
| const_trait_iterator | trait_begin () const |
| const_trait_iterator | trait_end () const |
| llvm::iterator_range< const_trait_iterator > | getTraits () const |
| ArrayRef< SMLoc > | getLoc () const |
| bool | hasDescription () const |
| Query functions for the documentation of the operator. | |
| StringRef | getDescription () const |
| bool | hasSummary () const |
| StringRef | getSummary () const |
| bool | hasAssemblyFormat () const |
| Query functions for the assembly format of the operator. | |
| StringRef | getAssemblyFormat () const |
| StringRef | getExtraClassDeclaration () const |
| Returns this op's extra class declaration code. | |
| StringRef | getExtraClassDefinition () const |
| Returns this op's extra class definition code. | |
| const llvm::Record & | getDef () const |
| Returns the Tablegen definition this operator was constructed from. | |
| const Dialect & | getDialect () const |
| Returns the dialect of the op. | |
| void | print (llvm::raw_ostream &os) const |
| Prints the contents in this operator to the given os. | |
| bool | allResultTypesKnown () const |
| Return whether all the result types are known. | |
| const InferredResultType & | getInferredResultType (int index) const |
| Return all arguments or type constraints with same type as result[index]. | |
| OperandAttrOrProp | getArgToOperandAttrOrProp (int index) const |
| Returns the OperandAttrOrProp corresponding to the index. | |
| ArrayRef< Builder > | getBuilders () const |
| Returns the builders of this operation. | |
| std::string | getGetterName (StringRef name) const |
| Returns the getter name for the accessor of name. | |
| std::string | getSetterName (StringRef name) const |
| Returns the setter name for the accessor of name. | |
| std::string | getRemoverName (StringRef name) const |
| Returns the remove name for the accessor of name. | |
| bool | hasFolder () const |
| bool | useCustomPropertiesEncoding () const |
| Whether to generate the readProperty/writeProperty methods for bytecode emission. | |
Wrapper class that contains a MLIR op's information (e.g., operands, attributes) defined in TableGen and provides helper methods for accessing them.
Definition at line 77 of file Operator.h.
| using mlir::tblgen::Operator::arg_iterator = const Argument * |
Definition at line 241 of file Operator.h.
Definition at line 242 of file Operator.h.
Definition at line 178 of file Operator.h.
| using mlir::tblgen::Operator::const_attribute_iterator = const NamedAttribute * |
Op attribute iterators.
Definition at line 174 of file Operator.h.
| using mlir::tblgen::Operator::const_property_iterator = const NamedProperty * |
Definition at line 198 of file Operator.h.
| using mlir::tblgen::Operator::const_region_iterator = const NamedRegion * |
Regions.
Definition at line 258 of file Operator.h.
| using mlir::tblgen::Operator::const_successor_iterator = const NamedSuccessor * |
Successors.
Definition at line 272 of file Operator.h.
| using mlir::tblgen::Operator::const_trait_iterator = const Trait * |
Definition at line 286 of file Operator.h.
| using mlir::tblgen::Operator::const_value_iterator = const NamedTypeConstraint * |
Definition at line 136 of file Operator.h.
Definition at line 138 of file Operator.h.
Definition at line 206 of file Operator.h.
Definition at line 135 of file Operator.h.
Definition at line 137 of file Operator.h.
Definition at line 132 of file Operator.h.
Definition at line 133 of file Operator.h.
|
explicit |
Referenced by Operator().
|
inlineexplicit |
Definition at line 80 of file Operator.h.
References Operator().
|
inline |
Return whether all the result types are known.
Definition at line 323 of file Operator.h.
Referenced by getInferredResultType().
| Operator::arg_iterator Operator::arg_begin | ( | ) | const |
Op argument (attribute or operand) iterators.
Definition at line 240 of file Operator.cpp.
Referenced by getArgs().
| Operator::arg_iterator Operator::arg_end | ( | ) | const |
Definition at line 242 of file Operator.cpp.
Referenced by getArgs().
| void Operator::assertInvariants | ( | ) | const |
Check invariants (like no duplicated or conflicted names) and abort the process if any invariant is broken.
Definition at line 114 of file Operator.cpp.
References assertAccessorInvariants(), getLoc(), getNumOperands(), getNumRegions(), getNumResults(), getNumSuccessors(), getOperand(), getRegion(), getResult(), and getSuccessor().
| auto Operator::attribute_begin | ( | ) |
Definition at line 341 of file Operator.cpp.
| auto Operator::attribute_begin | ( | ) | const |
Definition at line 331 of file Operator.cpp.
Referenced by getAttributes(), and getAttributes().
| auto Operator::attribute_end | ( | ) |
Definition at line 344 of file Operator.cpp.
| auto Operator::attribute_end | ( | ) | const |
Definition at line 334 of file Operator.cpp.
Referenced by getAttributes(), and getAttributes().
| std::string Operator::getAdaptorName | ( | ) | const |
Returns the name of op's adaptor C++ class.
Definition at line 71 of file Operator.cpp.
References getCppClassName().
| auto Operator::getArg | ( | int | index | ) | const |
Op argument (attribute or operand) accessors.
Definition at line 361 of file Operator.cpp.
Referenced by mlir::tblgen::SymbolInfoMap::bindOpArgument(), and hasSingleVariadicArg().
| auto Operator::getArgDecorators | ( | int | index | ) | const |
Definition at line 253 of file Operator.cpp.
| StringRef Operator::getArgName | ( | int | index | ) | const |
Definition at line 248 of file Operator.cpp.
| Operator::arg_range Operator::getArgs | ( | ) | const |
Definition at line 244 of file Operator.cpp.
References arg_begin(), and arg_end().
| auto Operator::getArgToOperandAttrOrProp | ( | int | index | ) | const |
Returns the OperandAttrOrProp corresponding to the index.
Definition at line 877 of file Operator.cpp.
| StringRef Operator::getAssemblyFormat | ( | ) | const |
Definition at line 857 of file Operator.cpp.
|
inline |
Op attribute accessors.
Definition at line 187 of file Operator.h.
|
inline |
Definition at line 188 of file Operator.h.
| auto Operator::getAttributes | ( | ) |
Definition at line 347 of file Operator.cpp.
References attribute_begin(), and attribute_end().
| auto Operator::getAttributes | ( | ) | const |
Definition at line 337 of file Operator.cpp.
References attribute_begin(), and attribute_end().
Referenced by mlir::tblgen::StaticVerifierFunctionEmitter::collectOpConstraints().
Returns the builders of this operation.
Definition at line 347 of file Operator.h.
| StringRef Operator::getCppClassName | ( | ) | const |
Returns this op's C++ class name.
Definition at line 154 of file Operator.cpp.
Referenced by getAdaptorName(), and getGenericAdaptorName().
| StringRef Operator::getCppNamespace | ( | ) | const |
Returns this op's C++ namespace.
Definition at line 162 of file Operator.cpp.
| const Record & Operator::getDef | ( | ) | const |
Returns the Tablegen definition this operator was constructed from.
TODO: do not expose the TableGen record, this is a temporary solution to OpEmitter requiring a Record because Operator does not provide enough methods.
Definition at line 183 of file Operator.cpp.
Referenced by mlir::tblgen::DagNode::getDialectOp(), and mlir::tblgen::Operator::VariableDecoratorIterator::unwrap().
| StringRef Operator::getDescription | ( | ) | const |
Definition at line 842 of file Operator.cpp.
Referenced by hasDescription().
|
inline |
Returns the dialect of the op.
Definition at line 316 of file Operator.h.
| StringRef Operator::getDialectName | ( | ) | const |
Returns this op's dialect name.
Definition at line 152 of file Operator.cpp.
| StringRef Operator::getExtraClassDeclaration | ( | ) | const |
Returns this op's extra class declaration code.
Definition at line 169 of file Operator.cpp.
| StringRef Operator::getExtraClassDefinition | ( | ) | const |
Returns this op's extra class definition code.
Definition at line 176 of file Operator.cpp.
| std::string Operator::getGenericAdaptorName | ( | ) | const |
Returns the name of op's generic adaptor C++ class.
Definition at line 75 of file Operator.cpp.
References getCppClassName().
| std::string Operator::getGetterName | ( | StringRef | name | ) | const |
Returns the getter name for the accessor of name.
Definition at line 881 of file Operator.cpp.
| const InferredResultType & Operator::getInferredResultType | ( | int | index | ) | const |
Return all arguments or type constraints with same type as result[index].
Requires: all result types are known.
Definition at line 831 of file Operator.cpp.
References allResultTypesKnown().
| ArrayRef< SMLoc > Operator::getLoc | ( | ) | const |
Definition at line 836 of file Operator.cpp.
Referenced by assertAccessorInvariants(), and assertInvariants().
|
inline |
Returns the total number of arguments.
Definition at line 228 of file Operator.h.
Referenced by hasSingleVariadicArg().
|
inline |
Definition at line 183 of file Operator.h.
|
inline |
Definition at line 210 of file Operator.h.
|
inline |
Definition at line 184 of file Operator.h.
|
inline |
Definition at line 218 of file Operator.h.
Referenced by assertAccessorInvariants(), and assertInvariants().
| unsigned Operator::getNumRegions | ( | ) | const |
Returns the number of regions.
Definition at line 288 of file Operator.cpp.
Referenced by assertAccessorInvariants(), and assertInvariants().
| int Operator::getNumResults | ( | ) | const |
Returns the number of results this op produces.
Definition at line 164 of file Operator.cpp.
Referenced by assertAccessorInvariants(), assertInvariants(), and hasSingleVariadicResult().
| unsigned Operator::getNumSuccessors | ( | ) | const |
Returns the number of successors.
Definition at line 310 of file Operator.cpp.
Referenced by assertInvariants().
| unsigned Operator::getNumVariableLengthOperands | ( | ) | const |
Returns the number of variadic operands in this operation.
Definition at line 229 of file Operator.cpp.
References mlir::tblgen::NamedTypeConstraint::constraint, and mlir::tblgen::TypeConstraint::isVariableLength().
Referenced by assertAccessorInvariants().
| unsigned Operator::getNumVariableLengthResults | ( | ) | const |
Returns the number of variable length results in this operation.
Definition at line 223 of file Operator.cpp.
References mlir::tblgen::NamedTypeConstraint::constraint, and mlir::tblgen::TypeConstraint::isVariableLength().
| unsigned Operator::getNumVariadicRegions | ( | ) | const |
Returns the number of variadic regions in this operation.
Definition at line 294 of file Operator.cpp.
References mlir::tblgen::NamedRegion::isVariadic().
Referenced by assertAccessorInvariants(), and hasNoVariadicRegions().
| unsigned Operator::getNumVariadicSuccessors | ( | ) | const |
Returns the number of variadic successors in this operation.
Definition at line 316 of file Operator.cpp.
References mlir::tblgen::NamedSuccessor::isVariadic().
|
inline |
Definition at line 219 of file Operator.h.
Referenced by assertInvariants(), and hasSingleVariadicArg().
|
inline |
Definition at line 220 of file Operator.h.
| auto Operator::getOperands | ( | ) | const |
Definition at line 357 of file Operator.cpp.
References operand_begin(), and operand_end().
Referenced by mlir::tblgen::StaticVerifierFunctionEmitter::collectOpConstraints().
| std::string Operator::getOperationName | ( | ) | const |
Returns the operation name.
The name will follow the "<dialect>.<op-name>" format if its dialect name is not empty.
Definition at line 63 of file Operator.cpp.
Referenced by print().
|
inline |
Definition at line 209 of file Operator.h.
|
inline |
Definition at line 203 of file Operator.h.
Referenced by mlir::tblgen::StaticVerifierFunctionEmitter::collectOpConstraints().
|
inline |
Definition at line 213 of file Operator.h.
|
inline |
Definition at line 214 of file Operator.h.
| std::string Operator::getQualCppClassName | ( | ) | const |
Returns this op's C++ class name prefixed with namespaces.
Definition at line 156 of file Operator.cpp.
| const NamedRegion & Operator::getRegion | ( | unsigned | index | ) | const |
Returns the index-th region.
Definition at line 290 of file Operator.cpp.
Referenced by assertInvariants().
| auto Operator::getRegions | ( | ) | const |
Definition at line 283 of file Operator.cpp.
References region_begin(), and region_end().
Referenced by mlir::tblgen::StaticVerifierFunctionEmitter::collectOpConstraints().
| std::string Operator::getRemoverName | ( | StringRef | name | ) | const |
Returns the remove name for the accessor of name.
Definition at line 889 of file Operator.cpp.
|
inline |
Returns the op result at the given index.
Definition at line 158 of file Operator.h.
Referenced by assertInvariants(), and hasSingleVariadicResult().
|
inline |
Definition at line 159 of file Operator.h.
| auto Operator::getResultDecorators | ( | int | index | ) | const |
Returns the index-th result's decorators.
Definition at line 215 of file Operator.cpp.
References result.
| StringRef Operator::getResultName | ( | int | index | ) | const |
Returns the index-th result's name.
Definition at line 210 of file Operator.cpp.
| auto Operator::getResults | ( | ) | const |
Definition at line 201 of file Operator.cpp.
References result_begin(), and result_end().
Referenced by mlir::tblgen::StaticVerifierFunctionEmitter::collectOpConstraints().
| TypeConstraint Operator::getResultTypeConstraint | ( | int | index | ) | const |
Returns the index-th result's type constraint.
Definition at line 205 of file Operator.cpp.
| std::string Operator::getSetterName | ( | StringRef | name | ) | const |
Returns the setter name for the accessor of name.
Definition at line 885 of file Operator.cpp.
| const NamedSuccessor & Operator::getSuccessor | ( | unsigned | index | ) | const |
Returns the index-th successor.
Definition at line 312 of file Operator.cpp.
Referenced by assertInvariants().
| auto Operator::getSuccessors | ( | ) | const |
Definition at line 305 of file Operator.cpp.
References successor_begin(), and successor_end().
Referenced by mlir::tblgen::StaticVerifierFunctionEmitter::collectOpConstraints().
| StringRef Operator::getSummary | ( | ) | const |
Definition at line 848 of file Operator.cpp.
Referenced by hasSummary().
| const Trait * Operator::getTrait | ( | llvm::StringRef | trait | ) | const |
Returns the trait wrapper for the given MLIR C++ trait.
Definition at line 261 of file Operator.cpp.
| auto Operator::getTraits | ( | ) | const |
Definition at line 327 of file Operator.cpp.
References trait_begin(), and trait_end().
| bool Operator::hasAssemblyFormat | ( | ) | const |
Query functions for the assembly format of the operator.
Definition at line 852 of file Operator.cpp.
| bool Operator::hasCustomPropertiesPrinter | ( | ) | const |
Returns true if the operation provides a custom properties printer.
Definition at line 189 of file Operator.cpp.
| bool Operator::hasDescription | ( | ) | const |
Query functions for the documentation of the operator.
Definition at line 838 of file Operator.cpp.
References getDescription().
| bool Operator::hasFolder | ( | ) | const |
Definition at line 893 of file Operator.cpp.
|
inline |
Returns true of the operation has no variadic regions.
Definition at line 239 of file Operator.h.
References getNumVariadicRegions().
| bool Operator::hasSingleVariadicArg | ( | ) | const |
Returns true of the operation has a single variadic arg.
Definition at line 235 of file Operator.cpp.
References getArg(), getNumArgs(), getOperand(), and mlir::tblgen::NamedTypeConstraint::isVariadic().
|
inline |
Returns true if the operation has a single variadic result.
Definition at line 234 of file Operator.h.
References getNumResults(), getResult(), and mlir::tblgen::NamedTypeConstraint::isVariadic().
| bool Operator::hasSummary | ( | ) | const |
Definition at line 846 of file Operator.cpp.
References getSummary().
| bool Operator::isVariadic | ( | ) | const |
Returns true if this op has variable length operands or results.
Definition at line 363 of file Operator.cpp.
References mlir::tblgen::NamedTypeConstraint::isVariadic().
| auto Operator::operand_begin | ( | ) | const |
| auto Operator::operand_end | ( | ) | const |
Definition at line 354 of file Operator.cpp.
Referenced by getOperands().
| void Operator::print | ( | llvm::raw_ostream & | os | ) | const |
Prints the contents in this operator to the given os.
This is used for debugging purposes.
Definition at line 862 of file Operator.cpp.
References getOperationName().
|
inline |
Definition at line 207 of file Operator.h.
|
inline |
Definition at line 199 of file Operator.h.
|
inline |
Definition at line 208 of file Operator.h.
|
inline |
Definition at line 202 of file Operator.h.
| auto Operator::region_begin | ( | ) | const |
Definition at line 277 of file Operator.cpp.
Referenced by getRegions().
| auto Operator::region_end | ( | ) | const |
Definition at line 280 of file Operator.cpp.
Referenced by getRegions().
| auto Operator::result_begin | ( | ) | const |
| auto Operator::result_end | ( | ) | const |
Definition at line 197 of file Operator.cpp.
Referenced by getResults().
| bool Operator::skipDefaultBuilders | ( | ) | const |
Returns true if default builders should not be generated.
Definition at line 185 of file Operator.cpp.
| auto Operator::successor_begin | ( | ) | const |
Definition at line 299 of file Operator.cpp.
Referenced by getSuccessors().
| auto Operator::successor_end | ( | ) | const |
Definition at line 302 of file Operator.cpp.
Referenced by getSuccessors().
| auto Operator::trait_begin | ( | ) | const |
Definition at line 321 of file Operator.cpp.
Referenced by getTraits().
| auto Operator::trait_end | ( | ) | const |
Definition at line 324 of file Operator.cpp.
Referenced by getTraits().
| bool Operator::useCustomPropertiesEncoding | ( | ) | const |
Whether to generate the readProperty/writeProperty methods for bytecode emission.
Definition at line 895 of file Operator.cpp.