14 #ifndef MLIR_TABLEGEN_ATTRORTYPEDEF_H
15 #define MLIR_TABLEGEN_ATTRORTYPEDEF_H
57 : def(def), index(index) {}
87 std::optional<StringRef>
getParser()
const;
108 llvm::Init *
getDef()
const;
112 return def == other.def && index == other.index;
115 return !(*
this == other);
121 template <
typename InitT>
122 auto getDefValue(StringRef name)
const;
125 const llvm::DagInit *def;
236 operator bool()
const {
return def !=
nullptr; }
This class represents a wrapper around a tablegen AttrDef record.
StringRef getAttrName() const
Get the unique attribute name "dialect.attrname".
std::optional< StringRef > getTypeBuilder() const
Returns the attributes value type builder code block, or std::nullopt if it doesn't have one.
static bool classof(const AttrOrTypeDef *def)
Wrapper class that represents a Tablegen AttrOrTypeBuilder.
bool hasInferredContextParameter() const
Returns true if this builder is able to infer the MLIRContext parameter.
std::optional< StringRef > getReturnType() const
Returns an optional builder return type.
Wrapper class that contains a TableGen AttrOrTypeDef's record and provides helper methods for accessi...
const llvm::Record * getDef() const
Return the underlying def.
SmallVector< AttrOrTypeParameter > parameters
The parameters of this attribute or type.
bool hasCustomAssemblyFormat() const
Returns if the attribute or type has a custom assembly format implemented in C++.
std::optional< StringRef > getMnemonic() const
Return the keyword/mnemonic to use in the printer/parser methods if we are supposed to auto-generate ...
bool operator==(const AttrOrTypeDef &other) const
Returns whether two AttrOrTypeDefs are equal by checking the equality of the underlying record.
StringRef getCppClassName() const
Returns the name of the C++ class to generate.
AttrOrTypeDef(const llvm::Record *def)
StringRef getStorageNamespace() const
Returns the C++ namespace for this def's storage class.
ArrayRef< AttrOrTypeBuilder > getBuilders() const
Returns the builders of this def.
bool genVerifyDecl() const
Return true if we need to generate the verify declaration and getChecked method.
ArrayRef< SMLoc > getLoc() const
Get the code location (for error printing).
bool hasDescription() const
Query functions for the documentation of the def.
StringRef getCppBaseClassName() const
Returns the name of the C++ base class to use when generating this def.
Dialect getDialect() const
Get the dialect for which this def belongs.
SmallVector< Trait > traits
The traits of this definition.
std::optional< StringRef > getExtraDefs() const
Returns the def's extra class definition code.
StringRef getSummary() const
ArrayRef< Trait > getTraits() const
Returns the traits of this def.
bool genStorageClass() const
Returns true if we should generate the storage class.
StringRef getDescription() const
std::optional< StringRef > getExtraDecls() const
Returns the def's extra class declaration code.
bool genVerifyInvariantsImpl() const
Return true if we need to generate any type constraint verification and the getChecked method.
StringRef getStorageClassName() const
Returns the name of the storage class for this def.
SmallVector< AttrOrTypeBuilder > builders
The builders of this definition.
bool hasStorageCustomConstructor() const
Indicates whether or not to generate the storage class constructor.
bool skipDefaultBuilders() const
Returns true if the default get/getChecked methods should be skipped during generation.
ArrayRef< AttrOrTypeParameter > getParameters() const
Get the parameters of this attribute or type.
unsigned getNumParameters() const
Return the number of parameters.
std::optional< StringRef > getAssemblyFormat() const
Returns the custom assembly format, if one was specified.
bool operator<(const AttrOrTypeDef &other) const
Compares two AttrOrTypeDefs by comparing the names of the dialects.
StringRef getName() const
Returns the name of this AttrOrTypeDef record.
bool genAccessors() const
Returns true if the accessors based on the parameters should be generated.
A wrapper class for tblgen AttrOrTypeParameter, arrays of which belong to AttrOrTypeDefs to parameter...
std::optional< StringRef > getParser() const
Get an optional C++ parameter parser.
StringRef getSyntax() const
Get the assembly syntax documentation.
std::optional< Constraint > getConstraint() const
If this is a type constraint, return it.
StringRef getComparator() const
If specified, get the custom comparator code for this parameter.
StringRef getName() const
Get the parameter name.
std::optional< StringRef > getPrinter() const
Get an optional C++ parameter printer.
bool operator!=(const AttrOrTypeParameter &other) const
llvm::Init * getDef() const
Return the underlying def of this parameter.
StringRef getConvertFromStorage() const
Get the C++ code to convert from the storage type to the parameter type.
bool operator==(const AttrOrTypeParameter &other) const
The parameter is pointer-comparable.
std::optional< StringRef > getDefaultValue() const
Get the default value of the parameter if it has one.
bool isAnonymous() const
Returns true if the parameter is anonymous (has no name).
std::string getAccessorName() const
Get the parameter accessor name.
StringRef getCppType() const
Get the C++ type of this parameter.
std::optional< StringRef > getSummary() const
Get a description of this parameter for documentation purposes.
StringRef getCppStorageType() const
Get the C++ storage type of this parameter.
bool isOptional() const
Returns true if the parameter is optional.
std::optional< StringRef > getAllocator() const
If specified, get the custom allocator code for this parameter.
StringRef getCppAccessorType() const
Get the C++ accessor type of this parameter.
AttrOrTypeParameter(const llvm::DagInit *def, unsigned index)
static bool classof(const AttrOrTypeParameter *param)
Wrapper class with helper methods for accessing Builders defined in TableGen.
Builder(const llvm::Record *record, ArrayRef< SMLoc > loc)
Construct a builder from the given Record instance.
This class represents a wrapper around a tablegen TypeDef record.
StringRef getTypeName() const
Get the unique type name "dialect.typename".
static bool classof(const AttrOrTypeDef *def)
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Include the generated interface declarations.