[MLIR][NFC] Fix incomplete boundary comments. (#133516)

I observed that we have the boundary comments in the codebase like:

```
//===----------------------------------------------------------------------===//
// ...
//===----------------------------------------------------------------------===//
```

I also observed that there are incomplete boundary comments. The
revision is generated by a script that completes the boundary comments.

```
//===----------------------------------------------------------------------===//
// ...

...
```

Signed-off-by: hanhanW <hanhan0912@gmail.com>
This commit is contained in:
Han-Chung Wang 2025-03-31 09:29:54 -07:00 committed by GitHub
parent c180e249d0
commit 66b0b0466b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
60 changed files with 257 additions and 0 deletions

View File

@ -48,6 +48,7 @@ mlirRewriterBaseGetContext(MlirRewriterBase rewriter);
//===----------------------------------------------------------------------===//
/// Insertion points methods
//===----------------------------------------------------------------------===//
// These do not include functions using Block::iterator or Region::iterator, as
// they are not exposed by the C API yet. Similarly for methods using
@ -101,6 +102,7 @@ mlirRewriterBaseGetBlock(MlirRewriterBase rewriter);
//===----------------------------------------------------------------------===//
/// Block and operation creation/insertion/cloning
//===----------------------------------------------------------------------===//
// These functions do not include the IRMapper, as it is not yet exposed by the
// C API.

View File

@ -145,6 +145,7 @@ class ROCDL_DimGetterFunctionOp<string mnemonic, string device_function,
//===----------------------------------------------------------------------===//
// Wave-level primitives
//===----------------------------------------------------------------------===//
class ROCDL_MbcntOp<string mnemonic> :
ROCDL_IntrPure1Op<"mbcnt." # mnemonic>,
@ -205,6 +206,7 @@ def ROCDL_ReadlaneOp : ROCDL_IntrOp<"readlane", [], [0], [AllTypesMatch<["res",
//===----------------------------------------------------------------------===//
// Thread index and Block index
//===----------------------------------------------------------------------===//
def ROCDL_ThreadIdXOp : ROCDL_SpecialIdRegisterOp<"workitem.id.x">;
def ROCDL_ThreadIdYOp : ROCDL_SpecialIdRegisterOp<"workitem.id.y">;
@ -216,6 +218,7 @@ def ROCDL_BlockIdZOp : ROCDL_SpecialIdRegisterOp<"workgroup.id.z">;
//===----------------------------------------------------------------------===//
// Thread range and Block range
//===----------------------------------------------------------------------===//
def ROCDL_BlockDimXOp : ROCDL_DimGetterFunctionOp<"workgroup.dim.x",
"__ockl_get_local_size", 0>;
@ -237,6 +240,7 @@ def ROCDL_GridDimZOp : ROCDL_DimGetterFunctionOp<"grid.dim.z",
//===----------------------------------------------------------------------===//
// Synchronization primitives
//===----------------------------------------------------------------------===//
// Emits the waintcnt instruction. The bitfield's semantics depend
// on the target chipset

View File

@ -60,6 +60,7 @@ class PDLInterp_Op<string mnemonic, list<Trait> traits = []> :
//===----------------------------------------------------------------------===//
// PDLInterp_PredicateOp
//===----------------------------------------------------------------------===//
// Check operations evaluate a predicate on a positional value and then
// conditionally branch on the result.
@ -70,6 +71,7 @@ class PDLInterp_PredicateOp<string mnemonic, list<Trait> traits = []> :
//===----------------------------------------------------------------------===//
// PDLInterp_SwitchOp
//===----------------------------------------------------------------------===//
// Switch operations evaluate a predicate on a positional value and then
// conditionally branch on the result.

View File

@ -81,6 +81,7 @@ class AsmStateImpl;
//===----------------------------------------------------------------------===//
// Resource Entry
//===----------------------------------------------------------------------===//
class HeapAsmResourceBlob;
@ -330,6 +331,7 @@ public:
//===----------------------------------------------------------------------===//
// Resource Parser/Printer
//===----------------------------------------------------------------------===//
/// This class represents an instance of a resource parser. This class should be
/// implemented by non-dialect clients that want to inject additional resources

View File

@ -717,6 +717,7 @@ using DenseResourceElementsHandle = DialectResourceBlobHandle<BuiltinDialect>;
namespace mlir {
//===----------------------------------------------------------------------===//
// DenseArrayAttr
//===----------------------------------------------------------------------===//
namespace detail {
/// Base class for DenseArrayAttr that is instantiated and specialized for each
@ -772,6 +773,7 @@ using DenseF64ArrayAttr = detail::DenseArrayAttrImpl<double>;
//===----------------------------------------------------------------------===//
// DenseResourceElementsAttr
//===----------------------------------------------------------------------===//
namespace detail {
/// Base class for DenseResourceElementsAttr that is instantiated and

View File

@ -98,6 +98,7 @@ class Builtin_CachedFloatType<string name, string mnemonic,
//===----------------------------------------------------------------------===//
// Float8E5M2Type
//===----------------------------------------------------------------------===//
def Builtin_Float8E5M2 : Builtin_FloatType<"Float8E5M2", "f8E5M2"> {
let summary = "8-bit floating point with 2 bit mantissa";
@ -119,6 +120,7 @@ def Builtin_Float8E5M2 : Builtin_FloatType<"Float8E5M2", "f8E5M2"> {
//===----------------------------------------------------------------------===//
// Float8E4M3Type
//===----------------------------------------------------------------------===//
def Builtin_Float8E4M3 : Builtin_FloatType<"Float8E4M3", "f8E4M3"> {
let summary = "8-bit floating point with 3 bit mantissa";
@ -138,6 +140,7 @@ def Builtin_Float8E4M3 : Builtin_FloatType<"Float8E4M3", "f8E4M3"> {
//===----------------------------------------------------------------------===//
// Float8E4M3FNType
//===----------------------------------------------------------------------===//
def Builtin_Float8E4M3FN : Builtin_FloatType<"Float8E4M3FN", "f8E4M3FN"> {
let summary = "8-bit floating point with 3 bit mantissa";
@ -160,6 +163,7 @@ def Builtin_Float8E4M3FN : Builtin_FloatType<"Float8E4M3FN", "f8E4M3FN"> {
//===----------------------------------------------------------------------===//
// Float8E5M2FNUZType
//===----------------------------------------------------------------------===//
def Builtin_Float8E5M2FNUZ : Builtin_FloatType<"Float8E5M2FNUZ", "f8E5M2FNUZ"> {
let summary = "8-bit floating point with 2 bit mantissa";
@ -182,6 +186,7 @@ def Builtin_Float8E5M2FNUZ : Builtin_FloatType<"Float8E5M2FNUZ", "f8E5M2FNUZ"> {
//===----------------------------------------------------------------------===//
// Float8E4M3FNUZType
//===----------------------------------------------------------------------===//
def Builtin_Float8E4M3FNUZ : Builtin_FloatType<"Float8E4M3FNUZ", "f8E4M3FNUZ"> {
let summary = "8-bit floating point with 3 bit mantissa";
@ -204,6 +209,7 @@ def Builtin_Float8E4M3FNUZ : Builtin_FloatType<"Float8E4M3FNUZ", "f8E4M3FNUZ"> {
//===----------------------------------------------------------------------===//
// Float8E4M3B11FNUZType
//===----------------------------------------------------------------------===//
def Builtin_Float8E4M3B11FNUZ : Builtin_FloatType<"Float8E4M3B11FNUZ", "f8E4M3B11FNUZ"> {
let summary = "8-bit floating point with 3 bit mantissa";
@ -226,6 +232,7 @@ def Builtin_Float8E4M3B11FNUZ : Builtin_FloatType<"Float8E4M3B11FNUZ", "f8E4M3B1
//===----------------------------------------------------------------------===//
// Float8E3M4Type
//===----------------------------------------------------------------------===//
def Builtin_Float8E3M4 : Builtin_FloatType<"Float8E3M4", "f8E3M4"> {
let summary = "8-bit floating point with 3 bits exponent and 4 bit mantissa";
@ -245,6 +252,7 @@ def Builtin_Float8E3M4 : Builtin_FloatType<"Float8E3M4", "f8E3M4"> {
//===----------------------------------------------------------------------===//
// Float4E2M1FNType
//===----------------------------------------------------------------------===//
def Builtin_Float4E2M1FN : Builtin_FloatType<"Float4E2M1FN", "f4E2M1FN"> {
let summary = "4-bit floating point with 2-bit exponent and 1-bit mantissa";
@ -266,6 +274,7 @@ def Builtin_Float4E2M1FN : Builtin_FloatType<"Float4E2M1FN", "f4E2M1FN"> {
//===----------------------------------------------------------------------===//
// Float6E2M3FNType
//===----------------------------------------------------------------------===//
def Builtin_Float6E2M3FN : Builtin_FloatType<"Float6E2M3FN", "f6E2M3FN"> {
let summary = "6-bit floating point with 2-bit exponent and 3-bit mantissa";
@ -287,6 +296,7 @@ def Builtin_Float6E2M3FN : Builtin_FloatType<"Float6E2M3FN", "f6E2M3FN"> {
//===----------------------------------------------------------------------===//
// Float6E3M2FNType
//===----------------------------------------------------------------------===//
def Builtin_Float6E3M2FN : Builtin_FloatType<"Float6E3M2FN", "f6E3M2FN"> {
let summary = "6-bit floating point with 3-bit exponent and 2-bit mantissa";
@ -308,6 +318,7 @@ def Builtin_Float6E3M2FN : Builtin_FloatType<"Float6E3M2FN", "f6E3M2FN"> {
//===----------------------------------------------------------------------===//
// Float8E8M0FNUType
//===----------------------------------------------------------------------===//
def Builtin_Float8E8M0FNU : Builtin_FloatType<"Float8E8M0FNU", "f8E8M0FNU"> {
let summary = "8-bit floating point with 8-bit exponent, no mantissa or sign";
@ -331,6 +342,7 @@ def Builtin_Float8E8M0FNU : Builtin_FloatType<"Float8E8M0FNU", "f8E8M0FNU"> {
//===----------------------------------------------------------------------===//
// BFloat16Type
//===----------------------------------------------------------------------===//
def Builtin_BFloat16 : Builtin_CachedFloatType<"BFloat16", "bf16",
/*declaredInterfaceMethods=*/["scaleElementBitwidth"]> {
@ -339,6 +351,7 @@ def Builtin_BFloat16 : Builtin_CachedFloatType<"BFloat16", "bf16",
//===----------------------------------------------------------------------===//
// Float16Type
//===----------------------------------------------------------------------===//
def Builtin_Float16 : Builtin_CachedFloatType<"Float16", "f16",
/*declaredInterfaceMethods=*/["scaleElementBitwidth"]> {
@ -347,6 +360,7 @@ def Builtin_Float16 : Builtin_CachedFloatType<"Float16", "f16",
//===----------------------------------------------------------------------===//
// FloatTF32Type
//===----------------------------------------------------------------------===//
def Builtin_FloatTF32 : Builtin_CachedFloatType<"FloatTF32", "tf32"> {
let summary = "TF32 floating-point type";
@ -354,6 +368,7 @@ def Builtin_FloatTF32 : Builtin_CachedFloatType<"FloatTF32", "tf32"> {
//===----------------------------------------------------------------------===//
// Float32Type
//===----------------------------------------------------------------------===//
def Builtin_Float32 : Builtin_CachedFloatType<"Float32", "f32",
/*declaredInterfaceMethods=*/["scaleElementBitwidth"]> {
@ -362,6 +377,7 @@ def Builtin_Float32 : Builtin_CachedFloatType<"Float32", "f32",
//===----------------------------------------------------------------------===//
// Float64Type
//===----------------------------------------------------------------------===//
def Builtin_Float64 : Builtin_CachedFloatType<"Float64", "f64"> {
let summary = "64-bit floating-point type";
@ -369,6 +385,7 @@ def Builtin_Float64 : Builtin_CachedFloatType<"Float64", "f64"> {
//===----------------------------------------------------------------------===//
// Float80Type
//===----------------------------------------------------------------------===//
def Builtin_Float80 : Builtin_CachedFloatType<"Float80", "f80"> {
let summary = "80-bit floating-point type";
@ -376,6 +393,7 @@ def Builtin_Float80 : Builtin_CachedFloatType<"Float80", "f80"> {
//===----------------------------------------------------------------------===//
// Float128Type
//===----------------------------------------------------------------------===//
def Builtin_Float128 : Builtin_CachedFloatType<"Float128", "f128"> {
let summary = "128-bit floating-point type";

View File

@ -23,6 +23,7 @@ include "mlir/IR/DialectBase.td"
//===----------------------------------------------------------------------===//
// Base attribute definition
//===----------------------------------------------------------------------===//
// Base class for all attributes.
class Attr<Pred condition, string summary = ""> :
@ -91,6 +92,7 @@ class DialectAttr<Dialect d, Pred condition, string summary = ""> :
//===----------------------------------------------------------------------===//
// Attribute modifier definition
//===----------------------------------------------------------------------===//
// Decorates an attribute to have an (unvalidated) default value if not present.
class DefaultValuedAttr<Attr attr, string val> :
@ -150,6 +152,7 @@ class DefaultValuedOptionalStrAttr<Attr attr, string val>
//===----------------------------------------------------------------------===//
// Primitive attribute kinds
//===----------------------------------------------------------------------===//
// A generic attribute that must be constructed around a specific buildable type
// `attrValType`. Backed by MLIR attribute kind `attrKind`.
@ -395,6 +398,7 @@ def UnitAttr : Attr<CPred<"::llvm::isa<::mlir::UnitAttr>($_self)">, "unit attrib
//===----------------------------------------------------------------------===//
// Composite attribute kinds
//===----------------------------------------------------------------------===//
class DictionaryAttrBase<Pred condition, string summary> :
Attr<condition, summary> {
@ -681,6 +685,7 @@ def FlatSymbolRefArrayAttr :
//===----------------------------------------------------------------------===//
// Derive attribute kinds
//===----------------------------------------------------------------------===//
// DerivedAttr are attributes whose value is computed from properties
// of the operation. They do not require additional storage and are
@ -714,6 +719,7 @@ class DerivedTypeAttr<code body> : DerivedAttr<"::mlir::Type", body> {
//===----------------------------------------------------------------------===//
// Constant attribute kinds
//===----------------------------------------------------------------------===//
// Represents a constant attribute of specific Attr type. A constant
// attribute can be specified only of attributes that have a constant

View File

@ -679,6 +679,7 @@ def AnyShaped: ShapedContainerType<[AnyType], IsShapedTypePred, "shaped",
//===----------------------------------------------------------------------===//
// Tensor types.
//===----------------------------------------------------------------------===//
// Unranked tensor type whose element type is from the given `allowedTypes`
// list, and which additionally satisfies an optional list of predicates.
@ -755,6 +756,7 @@ def AnyStaticShapeTensor : StaticShapeTensorOf<[AnyType]>;
//===----------------------------------------------------------------------===//
// Memref type.
//===----------------------------------------------------------------------===//
// Any unranked memref whose element type is from the given `allowedTypes` list.
class UnrankedMemRefOf<list<Type> allowedTypes> :

View File

@ -13,6 +13,7 @@ include "mlir/IR/AttrTypeBase.td"
//===----------------------------------------------------------------------===//
// Enum attribute kinds
//===----------------------------------------------------------------------===//
// Additional information for an enum case.
class EnumCase<string sym, int intVal, string strVal, int widthVal> {

View File

@ -385,6 +385,7 @@ protected:
//===----------------------------------------------------------------------===//
// Operand Traits
//===----------------------------------------------------------------------===//
namespace detail {
/// Utility trait base that provides accessors for derived traits that have
@ -514,6 +515,7 @@ class VariadicOperands
//===----------------------------------------------------------------------===//
// Region Traits
//===----------------------------------------------------------------------===//
/// This class provides verification for ops that are known to have zero
/// regions.
@ -606,6 +608,7 @@ class VariadicRegions
//===----------------------------------------------------------------------===//
// Result Traits
//===----------------------------------------------------------------------===//
/// This class provides return value APIs for ops that are known to have
/// zero results.
@ -757,6 +760,7 @@ class VariadicResults
//===----------------------------------------------------------------------===//
// Terminator Traits
//===----------------------------------------------------------------------===//
/// This class indicates that the regions associated with this op don't have
/// terminators.
@ -868,6 +872,7 @@ class VariadicSuccessors
//===----------------------------------------------------------------------===//
// SingleBlock
//===----------------------------------------------------------------------===//
/// This class provides APIs and verifiers for ops with regions having a single
/// block.
@ -949,6 +954,7 @@ public:
//===----------------------------------------------------------------------===//
// SingleBlockImplicitTerminator
//===----------------------------------------------------------------------===//
/// This class provides APIs and verifiers for ops with regions having a single
/// block that must terminate with `TerminatorOpType`.
@ -1034,6 +1040,7 @@ struct hasSingleBlockImplicitTerminator<Op, false> {
//===----------------------------------------------------------------------===//
// Misc Traits
//===----------------------------------------------------------------------===//
/// This class provides verification for ops that are known to have the same
/// operand shape: all operands are scalars, vectors/tensors of the same
@ -1514,6 +1521,7 @@ bool hasElementwiseMappableTraits(Operation *op);
namespace op_definition_impl {
//===----------------------------------------------------------------------===//
// Trait Existence
//===----------------------------------------------------------------------===//
/// Returns true if this given Trait ID matches the IDs of any of the provided
/// trait types `Traits`.
@ -1532,6 +1540,7 @@ inline bool hasTrait<>(TypeID traitID) {
//===----------------------------------------------------------------------===//
// Trait Folding
//===----------------------------------------------------------------------===//
/// Trait to check if T provides a 'foldTrait' method for single result
/// operations.
@ -1604,6 +1613,7 @@ static LogicalResult foldTraits(Operation *op, ArrayRef<Attribute> operands,
//===----------------------------------------------------------------------===//
// Trait Verification
//===----------------------------------------------------------------------===//
/// Trait to check if T provides a `verifyTrait` method.
template <typename T, typename... Args>

View File

@ -210,6 +210,7 @@ defvar writeMlirBytecodeWithConvertToAttribute = [{
//===----------------------------------------------------------------------===//
// Primitive property kinds
//===----------------------------------------------------------------------===//
// Any kind of integer stored as properties.
class IntProp<string storageTypeParam, string desc = ""> :
@ -360,6 +361,7 @@ def UnitProperty : _cls_UnitProp, Deprecated<"moved to shorter name UnitProp">;
//===----------------------------------------------------------------------===//
// Property field overwrites
//===----------------------------------------------------------------------===//
/// Class for giving a property a default value.
/// This doesn't change anything about the property other than giving it a default
@ -419,6 +421,7 @@ class ConfinedProperty<Property p, Pred pred, string newSummary = "">
//===----------------------------------------------------------------------===//
// Primitive property combinators
//===----------------------------------------------------------------------===//
/// Create a variable named `name` of `prop`'s storage type that is initialized
/// to the correct default value, if there is one.

View File

@ -23,6 +23,7 @@ namespace mlir {
//===----------------------------------------------------------------------===//
// TypeRange
//===----------------------------------------------------------------------===//
/// This class provides an abstraction over the various different ranges of
/// value types. In many cases, this prevents the need to explicitly materialize
@ -82,6 +83,7 @@ inline raw_ostream &operator<<(raw_ostream &os, const TypeRange &types) {
//===----------------------------------------------------------------------===//
// TypeRangeRange
//===----------------------------------------------------------------------===//
using TypeRangeRangeIterator =
llvm::mapped_iterator<llvm::iota_range<unsigned>::iterator,
@ -111,6 +113,7 @@ private:
//===----------------------------------------------------------------------===//
// ValueTypeRange
//===----------------------------------------------------------------------===//
/// This class implements iteration on the types of a given range of values.
template <typename ValueIteratorT>

View File

@ -36,6 +36,7 @@ class MutableOperandRangeRange;
//===----------------------------------------------------------------------===//
// OperandRange
//===----------------------------------------------------------------------===//
/// This class implements the operand iterators for the Operation class.
class OperandRange final : public llvm::detail::indexed_accessor_range_base<
@ -73,6 +74,7 @@ private:
//===----------------------------------------------------------------------===//
// OperandRangeRange
//===----------------------------------------------------------------------===//
/// This class represents a contiguous range of operand ranges, e.g. from a
/// VariadicOfVariadic operand group.
@ -109,6 +111,7 @@ private:
//===----------------------------------------------------------------------===//
// MutableOperandRange
//===----------------------------------------------------------------------===//
/// This class provides a mutable adaptor for a range of operands. It allows for
/// setting, inserting, and erasing operands from the given range.
@ -196,6 +199,7 @@ private:
//===----------------------------------------------------------------------===//
// MutableOperandRangeRange
//===----------------------------------------------------------------------===//
/// This class represents a contiguous range of mutable operand ranges, e.g.
/// from a VariadicOfVariadic operand group.
@ -235,6 +239,7 @@ private:
//===----------------------------------------------------------------------===//
// ResultRange
//===----------------------------------------------------------------------===//
/// This class implements the result iterators for the Operation class.
class ResultRange final
@ -368,6 +373,7 @@ private:
//===----------------------------------------------------------------------===//
// ValueRange
//===----------------------------------------------------------------------===//
/// This class provides an abstraction over the different types of ranges over
/// Values. In many cases, this prevents the need to explicitly materialize a

View File

@ -45,6 +45,7 @@ class MemoryEffects<list<MemoryEffect> effects = []>
//===----------------------------------------------------------------------===//
// Effects
//===----------------------------------------------------------------------===//
// The following effect indicates that the operation allocates from some
// resource. An 'allocate' effect implies only allocation of the resource, and

View File

@ -406,6 +406,7 @@ namespace llvm {
namespace cl {
//===----------------------------------------------------------------------===//
// std::vector+SmallVector
//===----------------------------------------------------------------------===//
namespace detail {
template <typename VectorT, typename ElementT>
@ -470,6 +471,7 @@ public:
//===----------------------------------------------------------------------===//
// OpPassManager: OptionValue
//===----------------------------------------------------------------------===//
template <>
struct OptionValue<mlir::OpPassManager> final : GenericOptionValue {
@ -514,6 +516,7 @@ private:
//===----------------------------------------------------------------------===//
// OpPassManager: Parser
//===----------------------------------------------------------------------===//
extern template class basic_parser<mlir::OpPassManager>;

View File

@ -247,6 +247,7 @@ protected:
//===----------------------------------------------------------------------===//
// EraseStmt
//===----------------------------------------------------------------------===//
/// This statement represents the `erase` statement in PDLL. This statement
/// erases the given root operation, corresponding roughly to the
@ -261,6 +262,7 @@ private:
//===----------------------------------------------------------------------===//
// ReplaceStmt
//===----------------------------------------------------------------------===//
/// This statement represents the `replace` statement in PDLL. This statement
/// replace the given root operation with a set of values, corresponding roughly
@ -292,6 +294,7 @@ private:
//===----------------------------------------------------------------------===//
// RewriteStmt
//===----------------------------------------------------------------------===//
/// This statement represents an operation rewrite that contains a block of
/// nested rewrite commands. This allows for building more complex operation
@ -478,6 +481,7 @@ private:
//===----------------------------------------------------------------------===//
// AllResultsMemberAccessExpr
//===----------------------------------------------------------------------===//
/// This class represents an instance of MemberAccessExpr that references all
/// results of an operation.
@ -742,6 +746,7 @@ protected:
//===----------------------------------------------------------------------===//
// AttrConstraintDecl
//===----------------------------------------------------------------------===//
/// The class represents an Attribute constraint, and constrains a variable to
/// be an Attribute.
@ -765,6 +770,7 @@ protected:
//===----------------------------------------------------------------------===//
// OpConstraintDecl
//===----------------------------------------------------------------------===//
/// The class represents an Operation constraint, and constrains a variable to
/// be an Operation.
@ -790,6 +796,7 @@ protected:
//===----------------------------------------------------------------------===//
// TypeConstraintDecl
//===----------------------------------------------------------------------===//
/// The class represents a Type constraint, and constrains a variable to be a
/// Type.
@ -804,6 +811,7 @@ protected:
//===----------------------------------------------------------------------===//
// TypeRangeConstraintDecl
//===----------------------------------------------------------------------===//
/// The class represents a TypeRange constraint, and constrains a variable to be
/// a TypeRange.
@ -818,6 +826,7 @@ protected:
//===----------------------------------------------------------------------===//
// ValueConstraintDecl
//===----------------------------------------------------------------------===//
/// The class represents a Value constraint, and constrains a variable to be a
/// Value.
@ -840,6 +849,7 @@ protected:
//===----------------------------------------------------------------------===//
// ValueRangeConstraintDecl
//===----------------------------------------------------------------------===//
/// The class represents a ValueRange constraint, and constrains a variable to
/// be a ValueRange.

View File

@ -198,6 +198,7 @@ public:
//===----------------------------------------------------------------------===//
// TypeRangeType
//===----------------------------------------------------------------------===//
/// This class represents a PDLL type that corresponds to an mlir::TypeRange.
class TypeRangeType : public RangeType {
@ -213,6 +214,7 @@ public:
//===----------------------------------------------------------------------===//
// ValueRangeType
//===----------------------------------------------------------------------===//
/// This class represents a PDLL type that corresponds to an mlir::ValueRange.
class ValueRangeType : public RangeType {

View File

@ -173,6 +173,7 @@ void CallGraph::eraseNode(CallGraphNode *node) {
//===----------------------------------------------------------------------===//
// Printing
//===----------------------------------------------------------------------===//
/// Dump the graph in a human readable format.
void CallGraph::dump() const { print(llvm::errs()); }

View File

@ -119,6 +119,7 @@ AsmParserState &AsmParserState::operator=(AsmParserState &&other) {
//===----------------------------------------------------------------------===//
// Access State
//===----------------------------------------------------------------------===//
auto AsmParserState::getBlockDefs() const -> iterator_range<BlockDefIterator> {
return llvm::make_pointee_range(llvm::ArrayRef(impl->blocks));
@ -216,6 +217,7 @@ SMRange AsmParserState::convertIdLocToRange(SMLoc loc) {
//===----------------------------------------------------------------------===//
// Populate State
//===----------------------------------------------------------------------===//
void AsmParserState::initialize(Operation *topLevelOp) {
startOperationDefinition(topLevelOp->getName());

View File

@ -435,6 +435,7 @@ ParseResult Parser::parseOptionalKeywordOrString(std::string *result) {
//===----------------------------------------------------------------------===//
// Resource Parsing
//===----------------------------------------------------------------------===//
FailureOr<AsmDialectResourceHandle>
Parser::parseResourceHandle(const OpAsmDialectInterface *dialect,
@ -478,6 +479,7 @@ Parser::parseResourceHandle(Dialect *dialect) {
//===----------------------------------------------------------------------===//
// Code Completion
//===----------------------------------------------------------------------===//
ParseResult Parser::codeCompleteDialectName() {
state.codeCompleteContext->completeDialectName();

View File

@ -1733,6 +1733,7 @@ LogicalResult BytecodeReader::Impl::parseVersion(EncodingReader &reader) {
//===----------------------------------------------------------------------===//
// Dialect Section
//===----------------------------------------------------------------------===//
LogicalResult BytecodeDialect::load(const DialectReader &reader,
MLIRContext *ctx) {
@ -1874,6 +1875,7 @@ BytecodeReader::Impl::parseOpName(EncodingReader &reader,
//===----------------------------------------------------------------------===//
// Resource Section
//===----------------------------------------------------------------------===//
LogicalResult BytecodeReader::Impl::parseResourceSection(
EncodingReader &reader, std::optional<ArrayRef<uint8_t>> resourceData,
@ -1902,6 +1904,7 @@ LogicalResult BytecodeReader::Impl::parseResourceSection(
//===----------------------------------------------------------------------===//
// UseListOrder Helpers
//===----------------------------------------------------------------------===//
FailureOr<BytecodeReader::Impl::UseListMapT>
BytecodeReader::Impl::parseUseListOrderForRange(EncodingReader &reader,
@ -2060,6 +2063,7 @@ LogicalResult BytecodeReader::Impl::processUseLists(Operation *topLevelOp) {
//===----------------------------------------------------------------------===//
// IR Section
//===----------------------------------------------------------------------===//
LogicalResult
BytecodeReader::Impl::parseIRSection(ArrayRef<uint8_t> sectionData,
@ -2460,6 +2464,7 @@ LogicalResult BytecodeReader::Impl::parseBlockArguments(EncodingReader &reader,
//===----------------------------------------------------------------------===//
// Value Processing
//===----------------------------------------------------------------------===//
Value BytecodeReader::Impl::parseOperand(EncodingReader &reader) {
std::vector<Value> &values = valueScopes.back().values;

View File

@ -772,6 +772,7 @@ LogicalResult BytecodeWriter::write(Operation *rootOp, raw_ostream &os) {
//===----------------------------------------------------------------------===//
// Dialects
//===----------------------------------------------------------------------===//
/// Write the given entries in contiguous groups with the same parent dialect.
/// Each dialect sub-group is encoded with the parent dialect and number of
@ -855,6 +856,7 @@ void BytecodeWriter::writeDialectSection(EncodingEmitter &emitter) {
//===----------------------------------------------------------------------===//
// Attributes and Types
//===----------------------------------------------------------------------===//
void BytecodeWriter::writeAttrTypeSection(EncodingEmitter &emitter) {
EncodingEmitter attrTypeEmitter;
@ -936,6 +938,7 @@ void BytecodeWriter::writeAttrTypeSection(EncodingEmitter &emitter) {
//===----------------------------------------------------------------------===//
// Operations
//===----------------------------------------------------------------------===//
LogicalResult BytecodeWriter::writeBlock(EncodingEmitter &emitter,
Block *block) {
@ -1215,6 +1218,7 @@ LogicalResult BytecodeWriter::writeIRSection(EncodingEmitter &emitter,
//===----------------------------------------------------------------------===//
// Resources
//===----------------------------------------------------------------------===//
namespace {
/// This class represents a resource builder implementation for the MLIR
@ -1327,6 +1331,7 @@ void BytecodeWriter::writeResourceSection(Operation *op,
//===----------------------------------------------------------------------===//
// Strings
//===----------------------------------------------------------------------===//
void BytecodeWriter::writeStringSection(EncodingEmitter &emitter) {
EncodingEmitter stringEmitter;
@ -1336,6 +1341,7 @@ void BytecodeWriter::writeStringSection(EncodingEmitter &emitter) {
//===----------------------------------------------------------------------===//
// Properties
//===----------------------------------------------------------------------===//
void BytecodeWriter::writePropertiesSection(EncodingEmitter &emitter) {
EncodingEmitter propertiesEmitter;

View File

@ -29,6 +29,7 @@ MlirContext mlirRewriterBaseGetContext(MlirRewriterBase rewriter) {
//===----------------------------------------------------------------------===//
/// Insertion points methods
//===----------------------------------------------------------------------===//
void mlirRewriterBaseClearInsertionPoint(MlirRewriterBase rewriter) {
unwrap(rewriter)->clearInsertionPoint();
@ -69,6 +70,7 @@ MlirBlock mlirRewriterBaseGetBlock(MlirRewriterBase rewriter) {
//===----------------------------------------------------------------------===//
/// Block and operation creation/insertion/cloning
//===----------------------------------------------------------------------===//
MlirBlock mlirRewriterBaseCreateBlockBefore(MlirRewriterBase rewriter,
MlirBlock insertBefore,

View File

@ -26,6 +26,7 @@ unsigned Position::getOperationDepth() const {
//===----------------------------------------------------------------------===//
// AttributePosition
//===----------------------------------------------------------------------===//
AttributePosition::AttributePosition(const KeyTy &key) : Base(key) {
parent = key.first;
@ -33,6 +34,7 @@ AttributePosition::AttributePosition(const KeyTy &key) : Base(key) {
//===----------------------------------------------------------------------===//
// OperandPosition
//===----------------------------------------------------------------------===//
OperandPosition::OperandPosition(const KeyTy &key) : Base(key) {
parent = key.first;
@ -40,6 +42,7 @@ OperandPosition::OperandPosition(const KeyTy &key) : Base(key) {
//===----------------------------------------------------------------------===//
// OperandGroupPosition
//===----------------------------------------------------------------------===//
OperandGroupPosition::OperandGroupPosition(const KeyTy &key) : Base(key) {
parent = std::get<0>(key);
@ -47,6 +50,7 @@ OperandGroupPosition::OperandGroupPosition(const KeyTy &key) : Base(key) {
//===----------------------------------------------------------------------===//
// OperationPosition
//===----------------------------------------------------------------------===//
bool OperationPosition::isOperandDefiningOp() const {
return isa_and_nonnull<OperandPosition, OperandGroupPosition>(parent);

View File

@ -166,6 +166,7 @@ private:
//===----------------------------------------------------------------------===//
// AttributePosition
//===----------------------------------------------------------------------===//
/// A position describing an attribute of an operation.
struct AttributePosition
@ -180,6 +181,7 @@ struct AttributePosition
//===----------------------------------------------------------------------===//
// AttributeLiteralPosition
//===----------------------------------------------------------------------===//
/// A position describing a literal attribute.
struct AttributeLiteralPosition
@ -190,6 +192,7 @@ struct AttributeLiteralPosition
//===----------------------------------------------------------------------===//
// ForEachPosition
//===----------------------------------------------------------------------===//
/// A position describing an iterative choice of an operation.
struct ForEachPosition : public PredicateBase<ForEachPosition, Position,
@ -204,6 +207,7 @@ struct ForEachPosition : public PredicateBase<ForEachPosition, Position,
//===----------------------------------------------------------------------===//
// OperandPosition
//===----------------------------------------------------------------------===//
/// A position describing an operand of an operation.
struct OperandPosition
@ -218,6 +222,7 @@ struct OperandPosition
//===----------------------------------------------------------------------===//
// OperandGroupPosition
//===----------------------------------------------------------------------===//
/// A position describing an operand group of an operation.
struct OperandGroupPosition
@ -245,6 +250,7 @@ struct OperandGroupPosition
//===----------------------------------------------------------------------===//
// OperationPosition
//===----------------------------------------------------------------------===//
/// An operation position describes an operation node in the IR. Other position
/// kinds are formed with respect to an operation position.
@ -282,6 +288,7 @@ struct OperationPosition : public PredicateBase<OperationPosition, Position,
//===----------------------------------------------------------------------===//
// ConstraintPosition
//===----------------------------------------------------------------------===//
struct ConstraintQuestion;
@ -304,6 +311,7 @@ struct ConstraintPosition
//===----------------------------------------------------------------------===//
// ResultPosition
//===----------------------------------------------------------------------===//
/// A position describing a result of an operation.
struct ResultPosition
@ -318,6 +326,7 @@ struct ResultPosition
//===----------------------------------------------------------------------===//
// ResultGroupPosition
//===----------------------------------------------------------------------===//
/// A position describing a result group of an operation.
struct ResultGroupPosition
@ -347,6 +356,7 @@ struct ResultGroupPosition
//===----------------------------------------------------------------------===//
// TypePosition
//===----------------------------------------------------------------------===//
/// A position describing the result type of an entity, i.e. an Attribute,
/// Operand, Result, etc.
@ -362,6 +372,7 @@ struct TypePosition : public PredicateBase<TypePosition, Position, Position *,
//===----------------------------------------------------------------------===//
// TypeLiteralPosition
//===----------------------------------------------------------------------===//
/// A position describing a literal type or type range. The value is stored as
/// either a TypeAttr, or an ArrayAttr of TypeAttr.
@ -373,6 +384,7 @@ struct TypeLiteralPosition
//===----------------------------------------------------------------------===//
// UsersPosition
//===----------------------------------------------------------------------===//
/// A position describing the users of a value or a range of values. The second
/// value in the key indicates whether we choose users of a representative for
@ -421,6 +433,7 @@ private:
//===----------------------------------------------------------------------===//
// Answers
//===----------------------------------------------------------------------===//
/// An Answer representing an `Attribute` value.
struct AttributeAnswer
@ -464,6 +477,7 @@ struct UnsignedAnswer
//===----------------------------------------------------------------------===//
// Questions
//===----------------------------------------------------------------------===//
/// Compare an `Attribute` to a constant value.
struct AttributeQuestion

View File

@ -102,6 +102,7 @@ private:
//===----------------------------------------------------------------------===//
// BoolNode
//===----------------------------------------------------------------------===//
/// A BoolNode denotes a question with a boolean-like result. These nodes branch
/// to a single node on a successful result, otherwise defaulting to the failure
@ -133,6 +134,7 @@ private:
//===----------------------------------------------------------------------===//
// ExitNode
//===----------------------------------------------------------------------===//
/// An ExitNode is a special sentinel node that denotes the end of matcher.
struct ExitNode : public MatcherNode {
@ -147,6 +149,7 @@ struct ExitNode : public MatcherNode {
//===----------------------------------------------------------------------===//
// SuccessNode
//===----------------------------------------------------------------------===//
/// A SuccessNode denotes that a given high level pattern has successfully been
/// matched. This does not terminate the matcher, as there may be multiple
@ -178,6 +181,7 @@ private:
//===----------------------------------------------------------------------===//
// SwitchNode
//===----------------------------------------------------------------------===//
/// A SwitchNode denotes a question with multiple potential results. These nodes
/// branch to a specific node based on the result of the question.

View File

@ -55,6 +55,7 @@ using mlir::LLVM::tailcallkind::getMaxEnumValForTailCallKind;
//===----------------------------------------------------------------------===//
// IntegerOverflowFlags
//===----------------------------------------------------------------------===//
namespace mlir {
static Attribute convertToAttribute(MLIRContext *ctx,

View File

@ -177,6 +177,7 @@ LLVMArrayType::verify(function_ref<InFlightDiagnostic()> emitError,
//===----------------------------------------------------------------------===//
// DataLayoutTypeInterface
//===----------------------------------------------------------------------===//
llvm::TypeSize
LLVMArrayType::getTypeSizeInBits(const DataLayout &dataLayout,
@ -255,6 +256,7 @@ LLVMFunctionType::verify(function_ref<InFlightDiagnostic()> emitError,
//===----------------------------------------------------------------------===//
// DataLayoutTypeInterface
//===----------------------------------------------------------------------===//
constexpr const static uint64_t kDefaultPointerSizeBits = 64;
constexpr const static uint64_t kDefaultPointerAlignment = 8;

View File

@ -600,6 +600,7 @@ static bool hasSameElementsOrSplat(ShapedType type, const Values &values) {
//===----------------------------------------------------------------------===//
// AttributeElementIterator
//===----------------------------------------------------------------------===//
DenseElementsAttr::AttributeElementIterator::AttributeElementIterator(
DenseElementsAttr attr, size_t index)
@ -647,6 +648,7 @@ Attribute DenseElementsAttr::AttributeElementIterator::operator*() const {
//===----------------------------------------------------------------------===//
// BoolElementIterator
//===----------------------------------------------------------------------===//
DenseElementsAttr::BoolElementIterator::BoolElementIterator(
DenseElementsAttr attr, size_t dataIndex)
@ -659,6 +661,7 @@ bool DenseElementsAttr::BoolElementIterator::operator*() const {
//===----------------------------------------------------------------------===//
// IntElementIterator
//===----------------------------------------------------------------------===//
DenseElementsAttr::IntElementIterator::IntElementIterator(
DenseElementsAttr attr, size_t dataIndex)
@ -674,6 +677,7 @@ APInt DenseElementsAttr::IntElementIterator::operator*() const {
//===----------------------------------------------------------------------===//
// ComplexIntElementIterator
//===----------------------------------------------------------------------===//
DenseElementsAttr::ComplexIntElementIterator::ComplexIntElementIterator(
DenseElementsAttr attr, size_t dataIndex)
@ -1552,6 +1556,7 @@ ArrayRef<char> DenseResourceElementsAttr::getData() {
//===----------------------------------------------------------------------===//
// DenseResourceElementsAttrBase
//===----------------------------------------------------------------------===//
namespace {
/// Instantiations of this class provide utilities for interacting with native

View File

@ -29,6 +29,7 @@ namespace {
//===----------------------------------------------------------------------===//
// Utility functions
//===----------------------------------------------------------------------===//
// TODO: Move these to separate file.

View File

@ -383,6 +383,7 @@ MutableArrayRef<OpOperand> detail::OperandStorage::resize(Operation *owner,
//===----------------------------------------------------------------------===//
// OperandRange
//===----------------------------------------------------------------------===//
unsigned OperandRange::getBeginOperandIndex() const {
assert(!empty() && "range must not be empty");
@ -395,6 +396,7 @@ OperandRangeRange OperandRange::split(DenseI32ArrayAttr segmentSizes) const {
//===----------------------------------------------------------------------===//
// OperandRangeRange
//===----------------------------------------------------------------------===//
OperandRangeRange::OperandRangeRange(OperandRange operands,
Attribute operandSegments)
@ -419,6 +421,7 @@ OperandRange OperandRangeRange::dereference(const OwnerT &object,
//===----------------------------------------------------------------------===//
// MutableOperandRange
//===----------------------------------------------------------------------===//
/// Construct a new mutable range from the given operand, operand start index,
/// and range length.
@ -542,6 +545,7 @@ MutableArrayRef<OpOperand>::iterator MutableOperandRange::end() const {
//===----------------------------------------------------------------------===//
// MutableOperandRangeRange
//===----------------------------------------------------------------------===//
MutableOperandRangeRange::MutableOperandRangeRange(
const MutableOperandRange &operands, NamedAttribute operandSegmentAttr)
@ -571,6 +575,7 @@ MutableOperandRange MutableOperandRangeRange::dereference(const OwnerT &object,
//===----------------------------------------------------------------------===//
// ResultRange
//===----------------------------------------------------------------------===//
ResultRange::ResultRange(OpResult result)
: ResultRange(static_cast<detail::OpResultImpl *>(Value(result).getImpl()),
@ -637,6 +642,7 @@ void ResultRange::replaceUsesWithIf(
//===----------------------------------------------------------------------===//
// ValueRange
//===----------------------------------------------------------------------===//
ValueRange::ValueRange(ArrayRef<Value> values)
: ValueRange(values.data(), values.size()) {}

View File

@ -113,6 +113,7 @@ void PDLPatternModule::attachConfigToPatterns(ModuleOp module,
//===----------------------------------------------------------------------===//
// Function Registry
//===----------------------------------------------------------------------===//
void PDLPatternModule::registerConstraintFunction(
StringRef name, PDLConstraintFunction constraintFn) {

View File

@ -35,6 +35,7 @@ unsigned short PatternBenefit::getBenefit() const {
//===----------------------------------------------------------------------===//
// OperationName Root Constructors
//===----------------------------------------------------------------------===//
Pattern::Pattern(StringRef rootName, PatternBenefit benefit,
MLIRContext *context, ArrayRef<StringRef> generatedNames)
@ -43,6 +44,7 @@ Pattern::Pattern(StringRef rootName, PatternBenefit benefit,
//===----------------------------------------------------------------------===//
// MatchAnyOpTypeTag Root Constructors
//===----------------------------------------------------------------------===//
Pattern::Pattern(MatchAnyOpTypeTag tag, PatternBenefit benefit,
MLIRContext *context, ArrayRef<StringRef> generatedNames)
@ -50,6 +52,7 @@ Pattern::Pattern(MatchAnyOpTypeTag tag, PatternBenefit benefit,
//===----------------------------------------------------------------------===//
// MatchInterfaceOpTypeTag Root Constructors
//===----------------------------------------------------------------------===//
Pattern::Pattern(MatchInterfaceOpTypeTag tag, TypeID interfaceID,
PatternBenefit benefit, MLIRContext *context,
@ -59,6 +62,7 @@ Pattern::Pattern(MatchInterfaceOpTypeTag tag, TypeID interfaceID,
//===----------------------------------------------------------------------===//
// MatchTraitOpTypeTag Root Constructors
//===----------------------------------------------------------------------===//
Pattern::Pattern(MatchTraitOpTypeTag tag, TypeID traitID,
PatternBenefit benefit, MLIRContext *context,
@ -68,6 +72,7 @@ Pattern::Pattern(MatchTraitOpTypeTag tag, TypeID traitID,
//===----------------------------------------------------------------------===//
// General Constructors
//===----------------------------------------------------------------------===//
Pattern::Pattern(const void *rootValue, RootKind rootKind,
ArrayRef<StringRef> generatedNames, PatternBenefit benefit,

View File

@ -759,6 +759,7 @@ static bool isReferencePrefixOf(SymbolRefAttr subRef, SymbolRefAttr ref) {
//===----------------------------------------------------------------------===//
// SymbolTable::getSymbolUses
//===----------------------------------------------------------------------===//
/// The implementation of SymbolTable::getSymbolUses below.
template <typename FromT>
@ -789,6 +790,7 @@ auto SymbolTable::getSymbolUses(Region *from) -> std::optional<UseRange> {
//===----------------------------------------------------------------------===//
// SymbolTable::getSymbolUses
//===----------------------------------------------------------------------===//
/// The implementation of SymbolTable::getSymbolUses below.
template <typename SymbolT, typename IRUnitT>
@ -828,6 +830,7 @@ auto SymbolTable::getSymbolUses(Operation *symbol, Region *from)
//===----------------------------------------------------------------------===//
// SymbolTable::symbolKnownUseEmpty
//===----------------------------------------------------------------------===//
/// The implementation of SymbolTable::symbolKnownUseEmpty below.
template <typename SymbolT, typename IRUnitT>
@ -863,6 +866,7 @@ bool SymbolTable::symbolKnownUseEmpty(Operation *symbol, Region *from) {
//===----------------------------------------------------------------------===//
// SymbolTable::replaceAllSymbolUses
//===----------------------------------------------------------------------===//
/// Generates a new symbol reference attribute with a new leaf reference.
static SymbolRefAttr generateNewRefAttr(SymbolRefAttr oldAttr,

View File

@ -13,6 +13,7 @@ using namespace mlir;
//===----------------------------------------------------------------------===//
// TypeRange
//===----------------------------------------------------------------------===//
TypeRange::TypeRange(ArrayRef<Type> types)
: TypeRange(types.data(), types.size()) {

View File

@ -13,6 +13,7 @@ using namespace mlir;
//===----------------------------------------------------------------------===//
// TypeRangeRange
//===----------------------------------------------------------------------===//
TypeRangeRange OperandRangeRange::getTypes() const {
return TypeRangeRange(*this);
@ -22,6 +23,7 @@ TypeRangeRange OperandRangeRange::getType() const { return getTypes(); }
//===----------------------------------------------------------------------===//
// OperandRange
//===----------------------------------------------------------------------===//
OperandRange::type_range OperandRange::getTypes() const {
return {begin(), end()};
@ -31,6 +33,7 @@ OperandRange::type_range OperandRange::getType() const { return getTypes(); }
//===----------------------------------------------------------------------===//
// ResultRange
//===----------------------------------------------------------------------===//
ResultRange::type_range ResultRange::getTypes() const {
return {begin(), end()};
@ -40,6 +43,7 @@ ResultRange::type_range ResultRange::getType() const { return getTypes(); }
//===----------------------------------------------------------------------===//
// ValueRange
//===----------------------------------------------------------------------===//
ValueRange::type_range ValueRange::getTypes() const { return {begin(), end()}; }

View File

@ -418,6 +418,7 @@ size_t detail::PassOptions::getOptionWidth() const {
//===----------------------------------------------------------------------===//
// OpPassManager: OptionValue
//===----------------------------------------------------------------------===//
llvm::cl::OptionValue<OpPassManager>::OptionValue() = default;
llvm::cl::OptionValue<OpPassManager>::OptionValue(
@ -470,6 +471,7 @@ void llvm::cl::OptionValue<OpPassManager>::anchor() {}
//===----------------------------------------------------------------------===//
// OpPassManager: Parser
//===----------------------------------------------------------------------===//
namespace llvm {
namespace cl {
@ -1028,6 +1030,7 @@ LogicalResult PassPipelineCLParser::addToPipeline(
//===----------------------------------------------------------------------===//
// PassNameCLParser
//===----------------------------------------------------------------------===//
/// Construct a pass pipeline parser with the given command line description.
PassNameCLParser::PassNameCLParser(StringRef arg, StringRef description)

View File

@ -179,6 +179,7 @@ static constexpr ByteCodeField kInferTypesMarker =
//===----------------------------------------------------------------------===//
// Generator
//===----------------------------------------------------------------------===//
namespace {
struct ByteCodeLiveRange;
@ -1086,6 +1087,7 @@ void PDLByteCode::initializeMutableState(PDLByteCodeMutableState &state) const {
//===----------------------------------------------------------------------===//
// ByteCode Execution
//===----------------------------------------------------------------------===//
namespace {
/// This class is an instantiation of the PDLResultList that provides access to

View File

@ -65,6 +65,7 @@ void StaticVerifierFunctionEmitter::emitPatternConstraints(
//===----------------------------------------------------------------------===//
// Constraint Getters
//===----------------------------------------------------------------------===//
StringRef StaticVerifierFunctionEmitter::getTypeConstraintFn(
const Constraint &constraint) const {
@ -100,6 +101,7 @@ StringRef StaticVerifierFunctionEmitter::getRegionConstraintFn(
//===----------------------------------------------------------------------===//
// Constraint Emission
//===----------------------------------------------------------------------===//
/// Code templates for emitting type, attribute, successor, and region
/// constraints. Each of these templates require the following arguments:
@ -234,6 +236,7 @@ void StaticVerifierFunctionEmitter::emitPatternConstraints() {
//===----------------------------------------------------------------------===//
// Constraint Uniquing
//===----------------------------------------------------------------------===//
/// An attribute constraint that references anything other than itself and the
/// current op cannot be generically extracted into a function. Most

View File

@ -214,6 +214,7 @@ LetStmt *LetStmt::create(Context &ctx, SMRange loc, VariableDecl *varDecl) {
//===----------------------------------------------------------------------===//
// EraseStmt
//===----------------------------------------------------------------------===//
EraseStmt *EraseStmt::create(Context &ctx, SMRange loc, Expr *rootOp) {
return new (ctx.getAllocator().Allocate<EraseStmt>()) EraseStmt(loc, rootOp);
@ -221,6 +222,7 @@ EraseStmt *EraseStmt::create(Context &ctx, SMRange loc, Expr *rootOp) {
//===----------------------------------------------------------------------===//
// ReplaceStmt
//===----------------------------------------------------------------------===//
ReplaceStmt *ReplaceStmt::create(Context &ctx, SMRange loc, Expr *rootOp,
ArrayRef<Expr *> replExprs) {
@ -235,6 +237,7 @@ ReplaceStmt *ReplaceStmt::create(Context &ctx, SMRange loc, Expr *rootOp,
//===----------------------------------------------------------------------===//
// RewriteStmt
//===----------------------------------------------------------------------===//
RewriteStmt *RewriteStmt::create(Context &ctx, SMRange loc, Expr *rootOp,
CompoundStmt *rewriteBody) {

View File

@ -103,6 +103,7 @@ Type RangeType::getElementType() const {
//===----------------------------------------------------------------------===//
// TypeRangeType
//===----------------------------------------------------------------------===//
bool TypeRangeType::classof(Type type) {
RangeType range = mlir::dyn_cast<RangeType>(type);
@ -116,6 +117,7 @@ TypeRangeType TypeRangeType::get(Context &context) {
//===----------------------------------------------------------------------===//
// ValueRangeType
//===----------------------------------------------------------------------===//
bool ValueRangeType::classof(Type type) {
RangeType range = mlir::dyn_cast<RangeType>(type);

View File

@ -762,6 +762,7 @@ LogicalResult Parser::convertTupleExpressionTo(
//===----------------------------------------------------------------------===//
// Directives
//===----------------------------------------------------------------------===//
LogicalResult Parser::parseDirective(SmallVectorImpl<ast::Decl *> &decls) {
StringRef directive = curToken.getSpelling();
@ -1021,6 +1022,7 @@ Parser::createODSNativePDLLConstraintDecl(const tblgen::Constraint &constraint,
//===----------------------------------------------------------------------===//
// Decls
//===----------------------------------------------------------------------===//
FailureOr<ast::Decl *> Parser::parseTopLevelDecl() {
FailureOr<ast::Decl *> decl;
@ -1786,6 +1788,7 @@ FailureOr<ast::ConstraintRef> Parser::parseArgOrResultConstraint() {
//===----------------------------------------------------------------------===//
// Exprs
//===----------------------------------------------------------------------===//
FailureOr<ast::Expr *> Parser::parseExpr() {
if (curToken.is(Token::underscore))
@ -2249,6 +2252,7 @@ FailureOr<ast::Expr *> Parser::parseUnderscoreExpr() {
//===----------------------------------------------------------------------===//
// Stmts
//===----------------------------------------------------------------------===//
FailureOr<ast::Stmt *> Parser::parseStmt(bool expectTerminalSemicolon) {
FailureOr<ast::Stmt *> stmt;
@ -2482,6 +2486,7 @@ FailureOr<ast::RewriteStmt *> Parser::parseRewriteStmt() {
//===----------------------------------------------------------------------===//
// Decls
//===----------------------------------------------------------------------===//
ast::CallableDecl *Parser::tryExtractCallableDecl(ast::Node *node) {
// Unwrap reference expressions.
@ -2681,6 +2686,7 @@ Parser::validateTypeRangeConstraintExpr(const ast::Expr *typeExpr) {
//===----------------------------------------------------------------------===//
// Exprs
//===----------------------------------------------------------------------===//
FailureOr<ast::CallExpr *>
Parser::createCallExpr(SMRange loc, ast::Expr *parentExpr,
@ -3057,6 +3063,7 @@ Parser::createTupleExpr(SMRange loc, ArrayRef<ast::Expr *> elements,
//===----------------------------------------------------------------------===//
// Stmts
//===----------------------------------------------------------------------===//
FailureOr<ast::EraseStmt *> Parser::createEraseStmt(SMRange loc,
ast::Expr *rootOp) {

View File

@ -101,6 +101,7 @@ struct LSPServer {
//===----------------------------------------------------------------------===//
// Initialization
//===----------------------------------------------------------------------===//
void LSPServer::onInitialize(const InitializeParams &params,
Callback<llvm::json::Value> reply) {
@ -160,6 +161,7 @@ void LSPServer::onShutdown(const NoParams &, Callback<std::nullptr_t> reply) {
//===----------------------------------------------------------------------===//
// Document Change
//===----------------------------------------------------------------------===//
void LSPServer::onDocumentDidOpen(const DidOpenTextDocumentParams &params) {
PublishDiagnosticsParams diagParams(params.textDocument.uri,
@ -200,6 +202,7 @@ void LSPServer::onDocumentDidChange(const DidChangeTextDocumentParams &params) {
//===----------------------------------------------------------------------===//
// Definitions and References
//===----------------------------------------------------------------------===//
void LSPServer::onGoToDefinition(const TextDocumentPositionParams &params,
Callback<std::vector<Location>> reply) {
@ -217,6 +220,7 @@ void LSPServer::onReference(const ReferenceParams &params,
//===----------------------------------------------------------------------===//
// Hover
//===----------------------------------------------------------------------===//
void LSPServer::onHover(const TextDocumentPositionParams &params,
Callback<std::optional<Hover>> reply) {
@ -225,6 +229,7 @@ void LSPServer::onHover(const TextDocumentPositionParams &params,
//===----------------------------------------------------------------------===//
// Document Symbols
//===----------------------------------------------------------------------===//
void LSPServer::onDocumentSymbol(const DocumentSymbolParams &params,
Callback<std::vector<DocumentSymbol>> reply) {
@ -235,6 +240,7 @@ void LSPServer::onDocumentSymbol(const DocumentSymbolParams &params,
//===----------------------------------------------------------------------===//
// Code Completion
//===----------------------------------------------------------------------===//
void LSPServer::onCompletion(const CompletionParams &params,
Callback<CompletionList> reply) {
@ -243,6 +249,7 @@ void LSPServer::onCompletion(const CompletionParams &params,
//===----------------------------------------------------------------------===//
// Code Action
//===----------------------------------------------------------------------===//
void LSPServer::onCodeAction(const CodeActionParams &params,
Callback<llvm::json::Value> reply) {
@ -267,6 +274,7 @@ void LSPServer::onCodeAction(const CodeActionParams &params,
//===----------------------------------------------------------------------===//
// Bytecode
//===----------------------------------------------------------------------===//
void LSPServer::onConvertFromBytecode(
const MLIRConvertBytecodeParams &params,

View File

@ -114,6 +114,7 @@ struct LSPServer {
//===----------------------------------------------------------------------===//
// Initialization
//===----------------------------------------------------------------------===//
void LSPServer::onInitialize(const InitializeParams &params,
Callback<llvm::json::Value> reply) {
@ -164,6 +165,7 @@ void LSPServer::onShutdown(const NoParams &, Callback<std::nullptr_t> reply) {
//===----------------------------------------------------------------------===//
// Document Change
//===----------------------------------------------------------------------===//
void LSPServer::onDocumentDidOpen(const DidOpenTextDocumentParams &params) {
PublishDiagnosticsParams diagParams(params.textDocument.uri,
@ -198,6 +200,7 @@ void LSPServer::onDocumentDidChange(const DidChangeTextDocumentParams &params) {
//===----------------------------------------------------------------------===//
// Definitions and References
//===----------------------------------------------------------------------===//
void LSPServer::onGoToDefinition(const TextDocumentPositionParams &params,
Callback<std::vector<Location>> reply) {
@ -215,6 +218,7 @@ void LSPServer::onReference(const ReferenceParams &params,
//===----------------------------------------------------------------------===//
// DocumentLink
//===----------------------------------------------------------------------===//
void LSPServer::onDocumentLink(const DocumentLinkParams &params,
Callback<std::vector<DocumentLink>> reply) {
@ -225,6 +229,7 @@ void LSPServer::onDocumentLink(const DocumentLinkParams &params,
//===----------------------------------------------------------------------===//
// Hover
//===----------------------------------------------------------------------===//
void LSPServer::onHover(const TextDocumentPositionParams &params,
Callback<std::optional<Hover>> reply) {
@ -233,6 +238,7 @@ void LSPServer::onHover(const TextDocumentPositionParams &params,
//===----------------------------------------------------------------------===//
// Document Symbols
//===----------------------------------------------------------------------===//
void LSPServer::onDocumentSymbol(const DocumentSymbolParams &params,
Callback<std::vector<DocumentSymbol>> reply) {
@ -243,6 +249,7 @@ void LSPServer::onDocumentSymbol(const DocumentSymbolParams &params,
//===----------------------------------------------------------------------===//
// Code Completion
//===----------------------------------------------------------------------===//
void LSPServer::onCompletion(const CompletionParams &params,
Callback<CompletionList> reply) {
@ -251,6 +258,7 @@ void LSPServer::onCompletion(const CompletionParams &params,
//===----------------------------------------------------------------------===//
// Signature Help
//===----------------------------------------------------------------------===//
void LSPServer::onSignatureHelp(const TextDocumentPositionParams &params,
Callback<SignatureHelp> reply) {
@ -259,6 +267,7 @@ void LSPServer::onSignatureHelp(const TextDocumentPositionParams &params,
//===----------------------------------------------------------------------===//
// Inlay Hints
//===----------------------------------------------------------------------===//
void LSPServer::onInlayHint(const InlayHintsParams &params,
Callback<std::vector<InlayHint>> reply) {
@ -269,6 +278,7 @@ void LSPServer::onInlayHint(const InlayHintsParams &params,
//===----------------------------------------------------------------------===//
// PDLL ViewOutput
//===----------------------------------------------------------------------===//
void LSPServer::onPDLLViewOutput(
const PDLLViewOutputParams &params,

View File

@ -82,6 +82,7 @@ struct LSPServer {
//===----------------------------------------------------------------------===//
// Initialization
//===----------------------------------------------------------------------===//
void LSPServer::onInitialize(const InitializeParams &params,
Callback<llvm::json::Value> reply) {
@ -116,6 +117,7 @@ void LSPServer::onShutdown(const NoParams &, Callback<std::nullptr_t> reply) {
//===----------------------------------------------------------------------===//
// Document Change
//===----------------------------------------------------------------------===//
void LSPServer::onDocumentDidOpen(const DidOpenTextDocumentParams &params) {
PublishDiagnosticsParams diagParams(params.textDocument.uri,
@ -150,6 +152,7 @@ void LSPServer::onDocumentDidChange(const DidChangeTextDocumentParams &params) {
//===----------------------------------------------------------------------===//
// Definitions and References
//===----------------------------------------------------------------------===//
void LSPServer::onGoToDefinition(const TextDocumentPositionParams &params,
Callback<std::vector<Location>> reply) {
@ -167,6 +170,7 @@ void LSPServer::onReference(const ReferenceParams &params,
//===----------------------------------------------------------------------===//
// DocumentLink
//===----------------------------------------------------------------------===//
void LSPServer::onDocumentLink(const DocumentLinkParams &params,
Callback<std::vector<DocumentLink>> reply) {
@ -177,6 +181,7 @@ void LSPServer::onDocumentLink(const DocumentLinkParams &params,
//===----------------------------------------------------------------------===//
// Hover
//===----------------------------------------------------------------------===//
void LSPServer::onHover(const TextDocumentPositionParams &params,
Callback<std::optional<Hover>> reply) {

View File

@ -1198,6 +1198,7 @@ void ConversionPatternRewriterImpl::applyRewrites() {
//===----------------------------------------------------------------------===//
// State Management
//===----------------------------------------------------------------------===//
RewriterState ConversionPatternRewriterImpl::getCurrentState() {
return RewriterState(rewrites.size(), ignoredOps.size(), replacedOps.size());
@ -1288,6 +1289,7 @@ bool ConversionPatternRewriterImpl::wasOpReplaced(Operation *op) const {
//===----------------------------------------------------------------------===//
// Type Conversion
//===----------------------------------------------------------------------===//
FailureOr<Block *> ConversionPatternRewriterImpl::convertRegionTypes(
ConversionPatternRewriter &rewriter, Region *region,
@ -1502,6 +1504,7 @@ Value ConversionPatternRewriterImpl::findOrBuildReplacementValue(
//===----------------------------------------------------------------------===//
// Rewriter Notification Hooks
//===----------------------------------------------------------------------===//
void ConversionPatternRewriterImpl::notifyOperationInserted(
Operation *op, OpBuilder::InsertPoint previous) {
@ -2336,6 +2339,7 @@ LogicalResult OperationLegalizer::legalizePatternRootUpdates(
//===----------------------------------------------------------------------===//
// Cost Model
//===----------------------------------------------------------------------===//
void OperationLegalizer::buildLegalizationGraph(
LegalizationPatterns &anyOpLegalizerPatterns,
@ -3355,6 +3359,7 @@ void mlir::registerConversionPDLFunctions(RewritePatternSet &patterns) {
//===----------------------------------------------------------------------===//
// Partial Conversion
//===----------------------------------------------------------------------===//
LogicalResult mlir::applyPartialConversion(
ArrayRef<Operation *> ops, const ConversionTarget &target,
@ -3372,6 +3377,7 @@ mlir::applyPartialConversion(Operation *op, const ConversionTarget &target,
//===----------------------------------------------------------------------===//
// Full Conversion
//===----------------------------------------------------------------------===//
LogicalResult mlir::applyFullConversion(ArrayRef<Operation *> ops,
const ConversionTarget &target,
@ -3390,6 +3396,7 @@ LogicalResult mlir::applyFullConversion(Operation *op,
//===----------------------------------------------------------------------===//
// Analysis Conversion
//===----------------------------------------------------------------------===//
/// Find a common IsolatedFromAbove ancestor of the given ops. If at least one
/// op is a top-level module op (which is expected to be isolated from above),

View File

@ -65,6 +65,7 @@ static void walkReferencedSymbolNodes(
//===----------------------------------------------------------------------===//
// CGUseList
//===----------------------------------------------------------------------===//
namespace {
/// This struct tracks the uses of callgraph nodes that can be dropped when

View File

@ -489,6 +489,7 @@ LogicalResult mlir::runRegionDCE(RewriterBase &rewriter,
//===----------------------------------------------------------------------===//
// BlockEquivalenceData
//===----------------------------------------------------------------------===//
namespace {
/// This class contains the information for comparing the equivalencies of two
@ -557,6 +558,7 @@ unsigned BlockEquivalenceData::getOrderOf(Value value) const {
//===----------------------------------------------------------------------===//
// BlockMergeCluster
//===----------------------------------------------------------------------===//
namespace {
/// This class represents a cluster of blocks to be merged together.

View File

@ -77,6 +77,7 @@ def TestBitEnumVerticalBar
//===----------------------------------------------------------------------===//
// Test Patterns (Multi-result Ops)
//===----------------------------------------------------------------------===//
def MultiResultOpKind1: I64EnumAttrCase<"kind1", 1>;
def MultiResultOpKind2: I64EnumAttrCase<"kind2", 2>;

View File

@ -730,6 +730,7 @@ LogicalResult TestVerifiersOp::verifyRegions() {
//===----------------------------------------------------------------------===//
// TestWithBoundsOp
//===----------------------------------------------------------------------===//
void TestWithBoundsOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
SetIntRangeFn setResultRanges) {
@ -738,6 +739,7 @@ void TestWithBoundsOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
//===----------------------------------------------------------------------===//
// TestWithBoundsRegionOp
//===----------------------------------------------------------------------===//
ParseResult TestWithBoundsRegionOp::parse(OpAsmParser &parser,
OperationState &result) {
@ -771,6 +773,7 @@ void TestWithBoundsRegionOp::inferResultRanges(
//===----------------------------------------------------------------------===//
// TestIncrementOp
//===----------------------------------------------------------------------===//
void TestIncrementOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
SetIntRangeFn setResultRanges) {
@ -783,6 +786,7 @@ void TestIncrementOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
//===----------------------------------------------------------------------===//
// TestReflectBoundsOp
//===----------------------------------------------------------------------===//
void TestReflectBoundsOp::inferResultRanges(
ArrayRef<ConstantIntRanges> argRanges, SetIntRangeFn setResultRanges) {
@ -1124,6 +1128,7 @@ void ReadBufferOp::getEffects(
//===----------------------------------------------------------------------===//
// TestCallAndStoreOp
//===----------------------------------------------------------------------===//
CallInterfaceCallable TestCallAndStoreOp::getCallableForCallee() {
return getCallee();
@ -1143,6 +1148,7 @@ MutableOperandRange TestCallAndStoreOp::getArgOperandsMutable() {
//===----------------------------------------------------------------------===//
// TestCallOnDeviceOp
//===----------------------------------------------------------------------===//
CallInterfaceCallable TestCallOnDeviceOp::getCallableForCallee() {
return getCallee();
@ -1162,6 +1168,7 @@ MutableOperandRange TestCallOnDeviceOp::getArgOperandsMutable() {
//===----------------------------------------------------------------------===//
// TestStoreWithARegion
//===----------------------------------------------------------------------===//
void TestStoreWithARegion::getSuccessorRegions(
RegionBranchPoint point, SmallVectorImpl<RegionSuccessor> &regions) {
@ -1173,6 +1180,7 @@ void TestStoreWithARegion::getSuccessorRegions(
//===----------------------------------------------------------------------===//
// TestStoreWithALoopRegion
//===----------------------------------------------------------------------===//
void TestStoreWithALoopRegion::getSuccessorRegions(
RegionBranchPoint point, SmallVectorImpl<RegionSuccessor> &regions) {

View File

@ -1462,6 +1462,7 @@ def TestDialectCanonicalizerOp : TEST_Op<"dialect_canonicalizable"> {
//===----------------------------------------------------------------------===//
// Test Patterns (Symbol Binding)
//===----------------------------------------------------------------------===//
// Test symbol binding.
def OpSymbolBindingA : TEST_Op<"symbol_binding_a", []> {
@ -1503,6 +1504,7 @@ def : Pat<(OpSymbolBindingNoResult:$op $operand),
//===----------------------------------------------------------------------===//
// Test Patterns (Attributes)
//===----------------------------------------------------------------------===//
// Test matching against op attributes.
def OpAttrMatch1 : TEST_Op<"match_op_attribute1"> {
@ -1618,6 +1620,7 @@ def : Pattern<
//===----------------------------------------------------------------------===//
// Test Patterns (Variadic Ops)
//===----------------------------------------------------------------------===//
def OneVResOneVOperandOp1 : TEST_Op<"one_variadic_out_one_variadic_in1"> {
let arguments = (ins Variadic<I32>);
@ -1803,6 +1806,7 @@ def : Pat<
//===----------------------------------------------------------------------===//
// Test Patterns (either)
//===----------------------------------------------------------------------===//
def TestEitherOpA : TEST_Op<"either_op_a"> {
let arguments = (ins AnyInteger:$arg0, AnyInteger:$arg1, AnyInteger:$arg2);
@ -1845,6 +1849,7 @@ def : Pat<(TestEitherOpB (either (TestEitherHelperOpA I32:$either_helper_0),
//===----------------------------------------------------------------------===//
// Test Patterns (Location)
//===----------------------------------------------------------------------===//
// Test that we can specify locations for generated ops.
def : Pat<(TestLocationSrcOp:$res1
@ -1863,6 +1868,7 @@ def : Pat<(TestLocationSrcNoResOp:$loc
//===----------------------------------------------------------------------===//
// Test Patterns (Type Builders)
//===----------------------------------------------------------------------===//
def SourceOp : TEST_Op<"source_op"> {
let arguments = (ins AnyInteger:$arg, AnyI32Attr:$tag);
@ -1913,6 +1919,7 @@ def : Pat<(SourceOp $val, ConstantAttr<I32Attr, "55">:$attr),
//===----------------------------------------------------------------------===//
// Test Patterns (Trailing Directives)
//===----------------------------------------------------------------------===//
// Test that we can specify both `location` and `returnType` directives.
def : Pat<(SourceOp $val, ConstantAttr<I32Attr, "66">:$attr),
@ -2079,6 +2086,7 @@ def ParseB64BytesOp : TEST_Op<"parse_b64"> {
//===----------------------------------------------------------------------===//
// Test region argument list parsing.
//===----------------------------------------------------------------------===//
def IsolatedRegionOp : TEST_Op<"isolated_region", [IsolatedFromAbove]> {
let summary = "isolated region operation";
@ -2139,6 +2147,7 @@ def AffineScopeOp : TEST_Op<"affine_scope", [AffineScope]> {
//===----------------------------------------------------------------------===//
// Custom printer/parser
//===----------------------------------------------------------------------===//
def CustomDimensionListAttrOp : TEST_Op<"custom_dimension_list_attr"> {
let description = [{
@ -2164,6 +2173,7 @@ def OptionalCustomAttrOp : TEST_Op<"optional_custom_attr"> {
//===----------------------------------------------------------------------===//
// Test OpAsmInterface.
//===----------------------------------------------------------------------===//
def AsmInterfaceOp : TEST_Op<"asm_interface_op"> {
let results = (outs AnyType:$first, Variadic<AnyType>:$middle_results,

View File

@ -21,6 +21,7 @@ using namespace test;
//===----------------------------------------------------------------------===//
// Parsing
//===----------------------------------------------------------------------===//
static ParseResult parseCustomOptionalOperand(
OpAsmParser &parser,
@ -155,6 +156,7 @@ static ParseResult parseCustomDirectiveOptionalOperandRef(
//===----------------------------------------------------------------------===//
// Printing
//===----------------------------------------------------------------------===//
static void printCustomOptionalOperand(OpAsmPrinter &printer, Operation *,
Value optOperand) {
@ -291,6 +293,7 @@ void ParseB64BytesOp::print(OpAsmPrinter &p) {
//===----------------------------------------------------------------------===//
// Test WrapRegionOp - wrapping op exercising `parseGenericOperation()`.
//===----------------------------------------------------------------------===//
ParseResult WrappingRegionOp::parse(OpAsmParser &parser,
OperationState &result) {

View File

@ -475,6 +475,7 @@ def FormatQualifiedNestedType : TEST_Op<"format_qual_cpmd_nested_type"> {
//===----------------------------------------------------------------------===//
// Custom Directives
//===----------------------------------------------------------------------===//
def FormatCustomDirectiveOperands
: TEST_Op<"format_custom_directive_operands", [AttrSizedOperandSegments]> {
@ -599,6 +600,7 @@ def FormatLiteralFollowingOptionalGroup
//===----------------------------------------------------------------------===//
// AllTypesMatch type inference
//===----------------------------------------------------------------------===//
def FormatAllTypesMatchVarOp : TEST_Op<"format_all_types_match_var", [
AllTypesMatch<["value1", "value2", "result"]>
@ -618,6 +620,7 @@ def FormatAllTypesMatchAttrOp : TEST_Op<"format_all_types_match_attr", [
//===----------------------------------------------------------------------===//
// TypesMatchWith type inference
//===----------------------------------------------------------------------===//
def FormatTypesMatchVarOp : TEST_Op<"format_types_match_var", [
TypesMatchWith<"result type matches operand", "value", "result", "$_self">
@ -655,6 +658,7 @@ def FormatTypesMatchContextOp : TEST_Op<"format_types_match_context", [
//===----------------------------------------------------------------------===//
// InferTypeOpInterface type inference in assembly format
//===----------------------------------------------------------------------===//
def FormatInferTypeOp : TEST_Op<"format_infer_type", [InferTypeOpInterface]> {
let results = (outs AnyType);

View File

@ -772,6 +772,7 @@ void TestDerivedAttributeDriver::runOnOperation() {
namespace {
//===----------------------------------------------------------------------===//
// Region-Block Rewrite Testing
//===----------------------------------------------------------------------===//
/// This pattern applies a signature conversion to a block inside a detached
/// region.
@ -958,6 +959,7 @@ struct TestUndoPropertiesModification : public ConversionPattern {
//===----------------------------------------------------------------------===//
// Type-Conversion Rewrite Testing
//===----------------------------------------------------------------------===//
/// This patterns erases a region operation that has had a type conversion.
struct TestDropOpSignatureConversion : public ConversionPattern {

View File

@ -19,6 +19,7 @@ class TestFormat_Op<string fmt, list<Trait> traits = []>
//===----------------------------------------------------------------------===//
// attr-dict
//===----------------------------------------------------------------------===//
// CHECK: error: 'attr-dict' directive not found
def DirectiveAttrDictInvalidA : TestFormat_Op<[{
@ -38,6 +39,7 @@ def DirectiveAttrDictInvalidD : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// custom
//===----------------------------------------------------------------------===//
// CHECK: error: expected '<' before custom directive name
def DirectiveCustomInvalidA : TestFormat_Op<[{
@ -70,6 +72,7 @@ def DirectiveCustomInvalidH : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// functional-type
//===----------------------------------------------------------------------===//
// CHECK: error: 'functional-type' is only valid as a top-level directive
def DirectiveFunctionalTypeInvalidA : TestFormat_Op<[{
@ -98,6 +101,7 @@ def DirectiveFunctionalTypeInvalidF : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// operands
//===----------------------------------------------------------------------===//
// CHECK: error: 'operands' directive creates overlap in format
def DirectiveOperandsInvalidA : TestFormat_Op<[{
@ -110,6 +114,7 @@ def DirectiveOperandsInvalidB : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// ref
//===----------------------------------------------------------------------===//
// CHECK: error: 'ref' is only valid within a `custom` directive
def DirectiveRefInvalidA : TestFormat_Op<[{
@ -193,6 +198,7 @@ def DirectiveRefInvalidO : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// regions
//===----------------------------------------------------------------------===//
// CHECK: error: 'regions' directive creates overlap in format
def DirectiveRegionsInvalidA : TestFormat_Op<[{
@ -218,6 +224,7 @@ def DirectiveRegionsInvalidD : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// results
//===----------------------------------------------------------------------===//
// CHECK: error: 'results' directive can can only be used as a child to a 'type' directive
def DirectiveResultsInvalidA : TestFormat_Op<[{
@ -226,6 +233,7 @@ def DirectiveResultsInvalidA : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// successors
//===----------------------------------------------------------------------===//
// CHECK: error: 'successors' is only valid as a top-level directive
def DirectiveSuccessorsInvalidA : TestFormat_Op<[{
@ -234,6 +242,7 @@ def DirectiveSuccessorsInvalidA : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// type
//===----------------------------------------------------------------------===//
// CHECK: error: expected '(' before argument list
def DirectiveTypeInvalidA : TestFormat_Op<[{
@ -250,6 +259,7 @@ def DirectiveTypeInvalidC : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// functional-type/type operands
//===----------------------------------------------------------------------===//
// CHECK: error: literals may only be used in the top-level section of the format
def DirectiveTypeZOperandInvalidA : TestFormat_Op<[{

View File

@ -19,6 +19,7 @@ class TestFormat_Op<string fmt, list<Trait> traits = []>
//===----------------------------------------------------------------------===//
// attr-dict
//===----------------------------------------------------------------------===//
// CHECK-NOT: error
def DirectiveAttrDictValidA : TestFormat_Op<[{
@ -30,6 +31,7 @@ def DirectiveAttrDictValidB : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// custom
//===----------------------------------------------------------------------===//
// CHECK-NOT: error
def DirectiveCustomValidA : TestFormat_Op<[{
@ -50,6 +52,7 @@ def DirectiveCustomValidE : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// functional-type
//===----------------------------------------------------------------------===//
// CHECK-NOT: error
def DirectiveFunctionalTypeValid : TestFormat_Op<[{
@ -58,6 +61,7 @@ def DirectiveFunctionalTypeValid : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// operands
//===----------------------------------------------------------------------===//
// CHECK-NOT: error:
def DirectiveOperandsValid : TestFormat_Op<[{
@ -66,6 +70,7 @@ def DirectiveOperandsValid : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// regions
//===----------------------------------------------------------------------===//
// CHECK-NOT: error:
def DirectiveRegionsValid : TestFormat_Op<[{
@ -74,6 +79,7 @@ def DirectiveRegionsValid : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// results
//===----------------------------------------------------------------------===//
// CHECK-NOT: error:
def DirectiveResultsInvalidA : TestFormat_Op<[{
@ -82,6 +88,7 @@ def DirectiveResultsInvalidA : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// successors
//===----------------------------------------------------------------------===//
// CHECK-NOT: error:
def DirectiveSuccessorsInvalidA : TestFormat_Op<[{
@ -90,6 +97,7 @@ def DirectiveSuccessorsInvalidA : TestFormat_Op<[{
//===----------------------------------------------------------------------===//
// type
//===----------------------------------------------------------------------===//
// CHECK-NOT: error:
def DirectiveTypeValid : TestFormat_Op<[{

View File

@ -16,6 +16,7 @@ class TestFormat_Op<string fmt, list<Trait> traits = []>
//===----------------------------------------------------------------------===//
// custom
//===----------------------------------------------------------------------===//
// CHECK-LABEL: CustomStringLiteralA::parse
// CHECK: parseFoo({{.*}}, parser.getBuilder().getI1Type())

View File

@ -444,6 +444,7 @@ void DefGen::emitInterfaceMethods() {
//===----------------------------------------------------------------------===//
// Builder Emission
//===----------------------------------------------------------------------===//
SmallVector<MethodParameter>
DefGen::getBuilderParams(std::initializer_list<MethodParameter> prefix) const {
@ -546,6 +547,7 @@ void DefGen::emitCheckedCustomBuilder(const AttrOrTypeBuilder &builder) {
//===----------------------------------------------------------------------===//
// Interface Method Emission
//===----------------------------------------------------------------------===//
void DefGen::emitTraitMethods(const InterfaceTrait &trait) {
// Get the set of methods that should always be declared.
@ -577,6 +579,7 @@ void DefGen::emitTraitMethod(const InterfaceMethod &method) {
//===----------------------------------------------------------------------===//
// Storage Class Emission
//===----------------------------------------------------------------------===//
void DefGen::emitStorageConstructor() {
Constructor *ctor =
@ -1079,6 +1082,7 @@ bool {0}(::mlir::Type type) {
//===----------------------------------------------------------------------===//
// AttrDef
//===----------------------------------------------------------------------===//
static llvm::cl::OptionCategory attrdefGenCat("Options for -gen-attrdef-*");
static llvm::cl::opt<std::string>
@ -1101,6 +1105,7 @@ static mlir::GenRegistration
//===----------------------------------------------------------------------===//
// TypeDef
//===----------------------------------------------------------------------===//
static llvm::cl::OptionCategory typedefGenCat("Options for -gen-typedef-*");
static llvm::cl::opt<std::string>

View File

@ -223,6 +223,7 @@ FailureOr<std::vector<FormatElement *>> FormatParser::parse() {
//===----------------------------------------------------------------------===//
// Element Parsing
//===----------------------------------------------------------------------===//
FailureOr<FormatElement *> FormatParser::parseElement(Context ctx) {
if (curToken.is(FormatToken::literal))

View File

@ -35,6 +35,7 @@ using llvm::StringMap;
//===----------------------------------------------------------------------===//
// VariableElement
//===----------------------------------------------------------------------===//
namespace {
/// This class represents an instance of an op variable element. A variable
@ -140,6 +141,7 @@ struct AttributeLikeVariable : public VariableElement {
//===----------------------------------------------------------------------===//
// DirectiveElement
//===----------------------------------------------------------------------===//
namespace {
/// This class represents the `operands` directive. This directive represents
@ -424,6 +426,7 @@ struct OperationFormat {
//===----------------------------------------------------------------------===//
// Parser Gen
//===----------------------------------------------------------------------===//
/// Returns true if we can format the given attribute as an enum in the
/// parser format.
@ -1951,6 +1954,7 @@ void OperationFormat::genParserVariadicSegmentResolution(Operator &op,
//===----------------------------------------------------------------------===//
// PrinterGen
//===----------------------------------------------------------------------===//
/// The code snippet used to generate a printer call for a region of an
// operation that has the SingleBlockImplicitTerminator trait.