MLIR
20.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 | OperandOrAttribute |
Pair consisting kind of argument and index into operands or attributes. 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. More... | |
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. More... | |
using | const_successor_iterator = const NamedSuccessor * |
Successors. More... | |
using | const_trait_iterator = const Trait * |
Trait. More... | |
Public Member Functions | |
Operator (const llvm::Record &def) | |
Operator (const llvm::Record *def) | |
StringRef | getDialectName () const |
Returns this op's dialect name. More... | |
std::string | getOperationName () const |
Returns the operation name. More... | |
StringRef | getCppClassName () const |
Returns this op's C++ class name. More... | |
std::string | getQualCppClassName () const |
Returns this op's C++ class name prefixed with namespaces. More... | |
StringRef | getCppNamespace () const |
Returns this op's C++ namespace. More... | |
std::string | getAdaptorName () const |
Returns the name of op's adaptor C++ class. More... | |
std::string | getGenericAdaptorName () const |
Returns the name of op's generic adaptor C++ class. More... | |
void | assertInvariants () const |
Check invariants (like no duplicated or conflicted names) and abort the process if any invariant is broken. More... | |
bool | isVariadic () const |
Returns true if this op has variable length operands or results. More... | |
bool | skipDefaultBuilders () const |
Returns true if default builders should not be generated. More... | |
const_value_iterator | result_begin () const |
Op result iterators. More... | |
const_value_iterator | result_end () const |
const_value_range | getResults () const |
int | getNumResults () const |
Returns the number of results this op produces. More... | |
NamedTypeConstraint & | getResult (int index) |
Returns the op result at the given index . More... | |
const NamedTypeConstraint & | getResult (int index) const |
TypeConstraint | getResultTypeConstraint (int index) const |
Returns the index -th result's type constraint. More... | |
StringRef | getResultName (int index) const |
Returns the index -th result's name. More... | |
var_decorator_range | getResultDecorators (int index) const |
Returns the index -th result's decorators. More... | |
unsigned | getNumVariableLengthResults () const |
Returns the number of variable length results in this operation. More... | |
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. More... | |
const NamedAttribute & | getAttribute (int index) const |
const_value_iterator | operand_begin () const |
Op operand iterators. More... | |
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. More... | |
int | getNumArgs () const |
Returns the total number of arguments. More... | |
bool | hasSingleVariadicArg () const |
Returns true of the operation has a single variadic arg. More... | |
bool | hasSingleVariadicResult () const |
Returns true if the operation has a single variadic result. More... | |
bool | hasNoVariadicRegions () const |
Returns true of the operation has no variadic regions. More... | |
arg_iterator | arg_begin () const |
Op argument (attribute or operand) iterators. More... | |
arg_iterator | arg_end () const |
arg_range | getArgs () const |
Argument | getArg (int index) const |
Op argument (attribute or operand) accessors. More... | |
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 . More... | |
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. More... | |
const NamedRegion & | getRegion (unsigned index) const |
Returns the index -th region. More... | |
unsigned | getNumVariadicRegions () const |
Returns the number of variadic regions in this operation. More... | |
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. More... | |
const NamedSuccessor & | getSuccessor (unsigned index) const |
Returns the index -th successor. More... | |
unsigned | getNumVariadicSuccessors () const |
Returns the number of variadic successors in this operation. More... | |
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. More... | |
StringRef | getDescription () const |
bool | hasSummary () const |
StringRef | getSummary () const |
bool | hasAssemblyFormat () const |
Query functions for the assembly format of the operator. More... | |
StringRef | getAssemblyFormat () const |
StringRef | getExtraClassDeclaration () const |
Returns this op's extra class declaration code. More... | |
StringRef | getExtraClassDefinition () const |
Returns this op's extra class definition code. More... | |
const llvm::Record & | getDef () const |
Returns the Tablegen definition this operator was constructed from. More... | |
const Dialect & | getDialect () const |
Returns the dialect of the op. More... | |
void | print (llvm::raw_ostream &os) const |
Prints the contents in this operator to the given os . More... | |
bool | allResultTypesKnown () const |
Return whether all the result types are known. More... | |
const InferredResultType & | getInferredResultType (int index) const |
Return all arguments or type constraints with same type as result[index]. More... | |
OperandOrAttribute | getArgToOperandOrAttribute (int index) const |
Returns the OperandOrAttribute corresponding to the index. More... | |
ArrayRef< Builder > | getBuilders () const |
Returns the builders of this operation. More... | |
std::string | getGetterName (StringRef name) const |
Returns the getter name for the accessor of name . More... | |
std::string | getSetterName (StringRef name) const |
Returns the setter name for the accessor of name . More... | |
std::string | getRemoverName (StringRef name) const |
Returns the remove name for the accessor of name . More... | |
bool | hasFolder () const |
bool | useCustomPropertiesEncoding () const |
Whether to generate the readProperty /writeProperty methods for bytecode emission. More... | |
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 238 of file Operator.h.
Definition at line 239 of file Operator.h.
Definition at line 175 of file Operator.h.
using mlir::tblgen::Operator::const_attribute_iterator = const NamedAttribute * |
Op attribute iterators.
Definition at line 171 of file Operator.h.
using mlir::tblgen::Operator::const_property_iterator = const NamedProperty * |
Definition at line 195 of file Operator.h.
using mlir::tblgen::Operator::const_region_iterator = const NamedRegion * |
Regions.
Definition at line 255 of file Operator.h.
using mlir::tblgen::Operator::const_successor_iterator = const NamedSuccessor * |
Successors.
Definition at line 269 of file Operator.h.
using mlir::tblgen::Operator::const_trait_iterator = const Trait * |
Definition at line 283 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 203 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 |
|
inlineexplicit |
Definition at line 80 of file Operator.h.
|
inline |
Return whether all the result types are known.
Definition at line 320 of file Operator.h.
Referenced by getInferredResultType().
Operator::arg_iterator Operator::arg_begin | ( | ) | const |
Op argument (attribute or operand) iterators.
Definition at line 238 of file Operator.cpp.
Referenced by getArgs().
Operator::arg_iterator Operator::arg_end | ( | ) | const |
Definition at line 240 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 116 of file Operator.cpp.
References assertAccessorInvariants(), getLoc(), getNumOperands(), getNumRegions(), getNumResults(), getNumSuccessors(), getOperand(), getRegion(), getResult(), and getSuccessor().
auto Operator::attribute_begin | ( | ) |
Definition at line 339 of file Operator.cpp.
auto Operator::attribute_begin | ( | ) | const |
Definition at line 329 of file Operator.cpp.
Referenced by getAttributes().
auto Operator::attribute_end | ( | ) |
Definition at line 342 of file Operator.cpp.
auto Operator::attribute_end | ( | ) | const |
Definition at line 332 of file Operator.cpp.
Referenced by getAttributes().
std::string Operator::getAdaptorName | ( | ) | const |
Returns the name of op's adaptor C++ class.
Definition at line 73 of file Operator.cpp.
References getCppClassName().
auto Operator::getArg | ( | int | index | ) | const |
Op argument (attribute or operand) accessors.
Definition at line 359 of file Operator.cpp.
Referenced by mlir::tblgen::SymbolInfoMap::bindOpArgument(), and hasSingleVariadicArg().
auto Operator::getArgDecorators | ( | int | index | ) | const |
Definition at line 251 of file Operator.cpp.
StringRef Operator::getArgName | ( | int | index | ) | const |
Definition at line 246 of file Operator.cpp.
Operator::arg_range Operator::getArgs | ( | ) | const |
Definition at line 242 of file Operator.cpp.
References arg_begin(), and arg_end().
auto Operator::getArgToOperandOrAttribute | ( | int | index | ) | const |
Returns the OperandOrAttribute corresponding to the index.
Definition at line 841 of file Operator.cpp.
StringRef Operator::getAssemblyFormat | ( | ) | const |
Definition at line 821 of file Operator.cpp.
|
inline |
Op attribute accessors.
Definition at line 184 of file Operator.h.
|
inline |
Definition at line 185 of file Operator.h.
auto Operator::getAttributes | ( | ) |
Definition at line 345 of file Operator.cpp.
auto Operator::getAttributes | ( | ) | const |
Definition at line 335 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 343 of file Operator.h.
StringRef Operator::getCppClassName | ( | ) | const |
Returns this op's C++ class name.
Definition at line 156 of file Operator.cpp.
Referenced by getAdaptorName(), and getGenericAdaptorName().
StringRef Operator::getCppNamespace | ( | ) | const |
Returns this op's C++ namespace.
Definition at line 164 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 185 of file Operator.cpp.
Referenced by mlir::tblgen::DagNode::getDialectOp().
StringRef Operator::getDescription | ( | ) | const |
Definition at line 806 of file Operator.cpp.
Referenced by hasDescription().
|
inline |
Returns the dialect of the op.
Definition at line 313 of file Operator.h.
StringRef Operator::getDialectName | ( | ) | const |
Returns this op's dialect name.
Definition at line 154 of file Operator.cpp.
References mlir::tblgen::Dialect::getName().
StringRef Operator::getExtraClassDeclaration | ( | ) | const |
Returns this op's extra class declaration code.
Definition at line 171 of file Operator.cpp.
StringRef Operator::getExtraClassDefinition | ( | ) | const |
Returns this op's extra class definition code.
Definition at line 178 of file Operator.cpp.
std::string Operator::getGenericAdaptorName | ( | ) | const |
Returns the name of op's generic adaptor C++ class.
Definition at line 77 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 846 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 795 of file Operator.cpp.
References allResultTypesKnown().
ArrayRef< SMLoc > Operator::getLoc | ( | ) | const |
Definition at line 800 of file Operator.cpp.
Referenced by assertAccessorInvariants(), and assertInvariants().
|
inline |
Returns the total number of arguments.
Definition at line 225 of file Operator.h.
Referenced by hasSingleVariadicArg().
|
inline |
Definition at line 180 of file Operator.h.
|
inline |
Definition at line 207 of file Operator.h.
|
inline |
Definition at line 181 of file Operator.h.
|
inline |
Definition at line 215 of file Operator.h.
Referenced by assertAccessorInvariants(), and assertInvariants().
unsigned Operator::getNumRegions | ( | ) | const |
Returns the number of regions.
Definition at line 286 of file Operator.cpp.
Referenced by assertAccessorInvariants(), and assertInvariants().
int Operator::getNumResults | ( | ) | const |
Returns the number of results this op produces.
Definition at line 166 of file Operator.cpp.
Referenced by assertAccessorInvariants(), assertInvariants(), and hasSingleVariadicResult().
unsigned Operator::getNumSuccessors | ( | ) | const |
Returns the number of successors.
Definition at line 308 of file Operator.cpp.
Referenced by assertInvariants().
unsigned Operator::getNumVariableLengthOperands | ( | ) | const |
Returns the number of variadic operands in this operation.
Definition at line 227 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 221 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 292 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 314 of file Operator.cpp.
References mlir::tblgen::NamedSuccessor::isVariadic().
|
inline |
Definition at line 216 of file Operator.h.
Referenced by assertInvariants(), and hasSingleVariadicArg().
|
inline |
Definition at line 217 of file Operator.h.
auto Operator::getOperands | ( | ) | const |
Definition at line 355 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 65 of file Operator.cpp.
References mlir::tblgen::Dialect::getName().
Referenced by print().
|
inline |
Definition at line 206 of file Operator.h.
|
inline |
Definition at line 200 of file Operator.h.
|
inline |
Definition at line 210 of file Operator.h.
|
inline |
Definition at line 211 of file Operator.h.
std::string Operator::getQualCppClassName | ( | ) | const |
Returns this op's C++ class name prefixed with namespaces.
Definition at line 158 of file Operator.cpp.
const NamedRegion & Operator::getRegion | ( | unsigned | index | ) | const |
Returns the index
-th region.
Definition at line 288 of file Operator.cpp.
Referenced by assertInvariants().
auto Operator::getRegions | ( | ) | const |
Definition at line 281 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 854 of file Operator.cpp.
|
inline |
Returns the op result at the given index
.
Definition at line 155 of file Operator.h.
Referenced by assertInvariants(), and hasSingleVariadicResult().
|
inline |
Definition at line 156 of file Operator.h.
auto Operator::getResultDecorators | ( | int | index | ) | const |
Returns the index
-th result's decorators.
Definition at line 213 of file Operator.cpp.
StringRef Operator::getResultName | ( | int | index | ) | const |
Returns the index
-th result's name.
Definition at line 208 of file Operator.cpp.
auto Operator::getResults | ( | ) | const |
Definition at line 199 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 203 of file Operator.cpp.
std::string Operator::getSetterName | ( | StringRef | name | ) | const |
Returns the setter name for the accessor of name
.
Definition at line 850 of file Operator.cpp.
const NamedSuccessor & Operator::getSuccessor | ( | unsigned | index | ) | const |
Returns the index
-th successor.
Definition at line 310 of file Operator.cpp.
Referenced by assertInvariants().
auto Operator::getSuccessors | ( | ) | const |
Definition at line 303 of file Operator.cpp.
References successor_begin(), and successor_end().
Referenced by mlir::tblgen::StaticVerifierFunctionEmitter::collectOpConstraints().
StringRef Operator::getSummary | ( | ) | const |
Definition at line 812 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 259 of file Operator.cpp.
auto Operator::getTraits | ( | ) | const |
Definition at line 325 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 816 of file Operator.cpp.
bool Operator::hasDescription | ( | ) | const |
Query functions for the documentation of the operator.
Definition at line 802 of file Operator.cpp.
References getDescription().
bool Operator::hasFolder | ( | ) | const |
Definition at line 858 of file Operator.cpp.
|
inline |
Returns true of the operation has no variadic regions.
Definition at line 236 of file Operator.h.
References getNumVariadicRegions().
bool Operator::hasSingleVariadicArg | ( | ) | const |
Returns true of the operation has a single variadic arg.
Definition at line 233 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 231 of file Operator.h.
References getNumResults(), getResult(), and mlir::tblgen::NamedTypeConstraint::isVariadic().
bool Operator::hasSummary | ( | ) | const |
Definition at line 810 of file Operator.cpp.
References getSummary().
bool Operator::isVariadic | ( | ) | const |
Returns true if this op has variable length operands or results.
Definition at line 361 of file Operator.cpp.
References mlir::tblgen::NamedTypeConstraint::isVariadic().
auto Operator::operand_begin | ( | ) | const |
auto Operator::operand_end | ( | ) | const |
Definition at line 352 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 826 of file Operator.cpp.
References getOperationName().
|
inline |
Definition at line 204 of file Operator.h.
|
inline |
Definition at line 196 of file Operator.h.
|
inline |
Definition at line 205 of file Operator.h.
|
inline |
Definition at line 199 of file Operator.h.
auto Operator::region_begin | ( | ) | const |
Definition at line 275 of file Operator.cpp.
Referenced by getRegions().
auto Operator::region_end | ( | ) | const |
Definition at line 278 of file Operator.cpp.
Referenced by getRegions().
auto Operator::result_begin | ( | ) | const |
auto Operator::result_end | ( | ) | const |
Definition at line 195 of file Operator.cpp.
Referenced by getResults().
bool Operator::skipDefaultBuilders | ( | ) | const |
Returns true if default builders should not be generated.
Definition at line 187 of file Operator.cpp.
auto Operator::successor_begin | ( | ) | const |
Definition at line 297 of file Operator.cpp.
Referenced by getSuccessors().
auto Operator::successor_end | ( | ) | const |
Definition at line 300 of file Operator.cpp.
Referenced by getSuccessors().
auto Operator::trait_begin | ( | ) | const |
Definition at line 319 of file Operator.cpp.
Referenced by getTraits().
auto Operator::trait_end | ( | ) | const |
Definition at line 322 of file Operator.cpp.
Referenced by getTraits().
bool Operator::useCustomPropertiesEncoding | ( | ) | const |
Whether to generate the readProperty
/writeProperty
methods for bytecode emission.
Definition at line 860 of file Operator.cpp.