9 #ifndef MLIR_TOOLS_PDLL_ODS_OPERATION_H_
10 #define MLIR_TOOLS_PDLL_ODS_OPERATION_H_
15 #include "llvm/ADT/ArrayRef.h"
16 #include "llvm/ADT/SmallVector.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Support/SMLoc.h"
23 class AttributeConstraint;
42 StringRef
getName()
const {
return name; }
53 : name(name.str()), optional(optional), constraint(constraint) {}
62 const AttributeConstraint &constraint;
77 StringRef
getName()
const {
return name; }
93 return variableLengthKind;
102 : name(name.str()), variableLengthKind(variableLengthKind),
103 constraint(constraint) {}
112 const TypeConstraint &constraint;
128 SMRange
getLoc()
const {
return location; }
133 attributes.emplace_back(
Attribute(name, optional, constraint));
139 operands.emplace_back(
146 results.emplace_back(
OperandOrResult(name, variableLengthKind, constraint));
174 Operation(StringRef name, StringRef summary, StringRef desc,
175 StringRef nativeClassName,
bool supportsTypeInferrence, SMLoc loc);
182 std::string description;
185 std::string nativeClassName;
188 bool supportsTypeInferrence;
This class represents a generic ODS Attribute constraint.
This class provides an ODS representation of a specific operation attribute.
StringRef getName() const
Return the name of this operand.
const AttributeConstraint & getConstraint() const
Return the constraint of this attribute.
bool isOptional() const
Return true if this attribute is optional.
This class represents an ODS dialect, and contains information on the constructs held within the dial...
This class provides an ODS representation of a specific operation operand or result.
const TypeConstraint & getConstraint() const
Return the constraint of this value.
bool isVariadic() const
Returns true if this value is variadic (Note this is false if the value is Optional).
VariableLengthKind getVariableLengthKind() const
Returns the variable length kind of this value.
StringRef getName() const
Return the name of this value.
bool isVariableLength() const
Returns true if this value is variable length, i.e.
This class provides an ODS representation of a specific operation.
StringRef getDescription() const
Returns the description of the operation.
StringRef getSummary() const
Returns the summary of the operation.
ArrayRef< Attribute > getAttributes() const
Returns the attributes of this operation.
StringRef getName() const
Returns the name of the operation.
SMRange getLoc() const
Return the source location of this operation.
ArrayRef< OperandOrResult > getOperands() const
Returns the operands of this operation.
void appendResult(StringRef name, VariableLengthKind variableLengthKind, const TypeConstraint &constraint)
Append a result to this operation.
StringRef getNativeClassName() const
Returns the native class name of the operation.
void appendOperand(StringRef name, VariableLengthKind variableLengthKind, const TypeConstraint &constraint)
Append an operand to this operation.
bool hasResultTypeInferrence() const
Return if the operation is known to support result type inferrence.
void appendAttribute(StringRef name, bool optional, const AttributeConstraint &constraint)
Append an attribute to this operation.
ArrayRef< OperandOrResult > getResults() const
Returns the results of this operation.
This class represents a generic ODS Type constraint.
Include the generated interface declarations.