From: Jeff Niu Date: Tue, 6 Dec 2022 21:00:01 +0000 (-0800) Subject: [mlir][ods] Make Operator.h comments triple forward slash (NFC)Depends on D139447 X-Git-Tag: upstream/17.0.6~24647 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=81af171112aec5a4e38fcbc5415b7b10ee31f359;p=platform%2Fupstream%2Fllvm.git [mlir][ods] Make Operator.h comments triple forward slash (NFC)Depends on D139447 Depends on D139447 Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D139470 --- diff --git a/mlir/include/mlir/TableGen/Operator.h b/mlir/include/mlir/TableGen/Operator.h index 6deeca7..ad906e4 100644 --- a/mlir/include/mlir/TableGen/Operator.h +++ b/mlir/include/mlir/TableGen/Operator.h @@ -37,35 +37,35 @@ class StringInit; namespace mlir { namespace tblgen { -// Wrapper class that contains a MLIR op's information (e.g., operands, -// attributes) defined in TableGen and provides helper methods for -// accessing them. +/// Wrapper class that contains a MLIR op's information (e.g., operands, +/// attributes) defined in TableGen and provides helper methods for +/// accessing them. class Operator { public: explicit Operator(const llvm::Record &def); explicit Operator(const llvm::Record *def) : Operator(*def) {} - // Returns this op's dialect name. + /// Returns this op's dialect name. StringRef getDialectName() const; - // Returns the operation name. The name will follow the "." - // format if its dialect name is not empty. + /// Returns the operation name. The name will follow the "." + /// format if its dialect name is not empty. std::string getOperationName() const; - // Returns this op's C++ class name. + /// Returns this op's C++ class name. StringRef getCppClassName() const; - // Returns this op's C++ class name prefixed with namespaces. + /// Returns this op's C++ class name prefixed with namespaces. std::string getQualCppClassName() const; - // Returns this op's C++ namespace. + /// Returns this op's C++ namespace. StringRef getCppNamespace() const; - // Returns the name of op's adaptor C++ class. + /// Returns the name of op's adaptor C++ class. std::string getAdaptorName() const; - // Check invariants (like no duplicated or conflicted names) and abort the - // process if any invariant is broken. + /// Check invariants (like no duplicated or conflicted names) and abort the + /// process if any invariant is broken. void assertInvariants() const; /// A class used to represent the decorators of an operator variable, i.e. @@ -76,11 +76,11 @@ public: const llvm::Record &getDef() const { return *def; } protected: - // The TableGen definition of this decorator. + /// The TableGen definition of this decorator. const llvm::Record *def; }; - // A utility iterator over a list of variable decorators. + /// A utility iterator over a list of variable decorators. struct VariableDecoratorIterator : public llvm::mapped_iterator { @@ -99,37 +99,37 @@ public: using value_range = llvm::iterator_range; using const_value_range = llvm::iterator_range; - // Returns true if this op has variable length operands or results. + /// Returns true if this op has variable length operands or results. bool isVariadic() const; - // Returns true if default builders should not be generated. + /// Returns true if default builders should not be generated. bool skipDefaultBuilders() const; - // Op result iterators. + /// Op result iterators. const_value_iterator result_begin() const; const_value_iterator result_end() const; const_value_range getResults() const; - // Returns the number of results this op produces. + /// Returns the number of results this op produces. int getNumResults() const; - // Returns the op result at the given `index`. + /// Returns the op result at the given `index`. NamedTypeConstraint &getResult(int index) { return results[index]; } const NamedTypeConstraint &getResult(int index) const { return results[index]; } - // Returns the `index`-th result's type constraint. + /// Returns the `index`-th result's type constraint. TypeConstraint getResultTypeConstraint(int index) const; - // Returns the `index`-th result's name. + /// Returns the `index`-th result's name. StringRef getResultName(int index) const; - // Returns the `index`-th result's decorators. + /// Returns the `index`-th result's decorators. var_decorator_range getResultDecorators(int index) const; - // Returns the number of variable length results in this operation. + /// Returns the number of variable length results in this operation. unsigned getNumVariableLengthResults() const; - // Op attribute iterators. + /// Op attribute iterators. using attribute_iterator = const NamedAttribute *; attribute_iterator attribute_begin() const; attribute_iterator attribute_end() const; @@ -138,13 +138,13 @@ public: int getNumAttributes() const { return attributes.size(); } int getNumNativeAttributes() const { return numNativeAttributes; } - // Op attribute accessors. + /// Op attribute accessors. NamedAttribute &getAttribute(int index) { return attributes[index]; } const NamedAttribute &getAttribute(int index) const { return attributes[index]; } - // Op operand iterators. + /// Op operand iterators. const_value_iterator operand_begin() const; const_value_iterator operand_end() const; const_value_range getOperands() const; @@ -155,68 +155,68 @@ public: return operands[index]; } - // Returns the number of variadic operands in this operation. + /// Returns the number of variadic operands in this operation. unsigned getNumVariableLengthOperands() const; - // Returns the total number of arguments. + /// Returns the total number of arguments. int getNumArgs() const { return arguments.size(); } - // Returns true of the operation has a single variadic arg. + /// Returns true of the operation has a single variadic arg. bool hasSingleVariadicArg() const; - // Returns true if the operation has a single variadic result. + /// Returns true if the operation has a single variadic result. bool hasSingleVariadicResult() const { return getNumResults() == 1 && getResult(0).isVariadic(); } - // Returns true of the operation has no variadic regions. + /// Returns true of the operation has no variadic regions. bool hasNoVariadicRegions() const { return getNumVariadicRegions() == 0; } using arg_iterator = const Argument *; using arg_range = llvm::iterator_range; - // Op argument (attribute or operand) iterators. + /// Op argument (attribute or operand) iterators. arg_iterator arg_begin() const; arg_iterator arg_end() const; arg_range getArgs() const; - // Op argument (attribute or operand) accessors. + /// Op argument (attribute or operand) accessors. Argument getArg(int index) const; StringRef getArgName(int index) const; var_decorator_range getArgDecorators(int index) const; - // Returns the trait wrapper for the given MLIR C++ `trait`. + /// Returns the trait wrapper for the given MLIR C++ `trait`. const Trait *getTrait(llvm::StringRef trait) const; - // Regions. + /// Regions. using const_region_iterator = const NamedRegion *; const_region_iterator region_begin() const; const_region_iterator region_end() const; llvm::iterator_range getRegions() const; - // Returns the number of regions. + /// Returns the number of regions. unsigned getNumRegions() const; - // Returns the `index`-th region. + /// Returns the `index`-th region. const NamedRegion &getRegion(unsigned index) const; - // Returns the number of variadic regions in this operation. + /// Returns the number of variadic regions in this operation. unsigned getNumVariadicRegions() const; - // Successors. + /// Successors. using const_successor_iterator = const NamedSuccessor *; const_successor_iterator successor_begin() const; const_successor_iterator successor_end() const; llvm::iterator_range getSuccessors() const; - // Returns the number of successors. + /// Returns the number of successors. unsigned getNumSuccessors() const; - // Returns the `index`-th successor. + /// Returns the `index`-th successor. const NamedSuccessor &getSuccessor(unsigned index) const; - // Returns the number of variadic successors in this operation. + /// Returns the number of variadic successors in this operation. unsigned getNumVariadicSuccessors() const; - // Trait. + /// Trait. using const_trait_iterator = const Trait *; const_trait_iterator trait_begin() const; const_trait_iterator trait_end() const; @@ -224,40 +224,40 @@ public: ArrayRef getLoc() const; - // Query functions for the documentation of the operator. + /// Query functions for the documentation of the operator. bool hasDescription() const; StringRef getDescription() const; bool hasSummary() const; StringRef getSummary() const; - // Query functions for the assembly format of the operator. + /// Query functions for the assembly format of the operator. bool hasAssemblyFormat() const; StringRef getAssemblyFormat() const; - // Returns this op's extra class declaration code. + /// Returns this op's extra class declaration code. StringRef getExtraClassDeclaration() const; - // Returns this op's extra class definition code. + /// Returns this op's extra class definition code. StringRef getExtraClassDefinition() const; - // Returns the Tablegen definition this operator was constructed from. - // TODO: do not expose the TableGen record, this is a temporary solution to - // OpEmitter requiring a Record because Operator does not provide enough - // methods. + /// Returns the Tablegen definition this operator was constructed from. + /// TODO: do not expose the TableGen record, this is a temporary solution to + /// OpEmitter requiring a Record because Operator does not provide enough + /// methods. const llvm::Record &getDef() const; - // Returns the dialect of the op. + /// Returns the dialect of the op. const Dialect &getDialect() const { return dialect; } - // Prints the contents in this operator to the given `os`. This is used for - // debugging purposes. + /// Prints the contents in this operator to the given `os`. This is used for + /// debugging purposes. void print(llvm::raw_ostream &os) const; - // Return whether all the result types are known. + /// Return whether all the result types are known. bool allResultTypesKnown() const { return allResultsHaveKnownTypes; }; - // Pair representing either a index to an argument or a type constraint. Only - // one of these entries should have the non-default value. + /// Pair representing either a index to an argument or a type constraint. Only + /// one of these entries should have the non-default value. struct ArgOrType { explicit ArgOrType(int index) : index(index), constraint(std::nullopt) {} explicit ArgOrType(TypeConstraint constraint) @@ -279,11 +279,11 @@ public: std::optional constraint; }; - // Return all arguments or type constraints with same type as result[index]. - // Requires: all result types are known. + /// Return all arguments or type constraints with same type as result[index]. + /// Requires: all result types are known. ArrayRef getSameTypeAsResult(int index) const; - // Pair consisting kind of argument and index into operands or attributes. + /// Pair consisting kind of argument and index into operands or attributes. struct OperandOrAttribute { enum class Kind { Operand, Attribute }; OperandOrAttribute(Kind kind, int index) { @@ -296,77 +296,77 @@ public: int packed; }; - // Returns the OperandOrAttribute corresponding to the index. + /// Returns the OperandOrAttribute corresponding to the index. OperandOrAttribute getArgToOperandOrAttribute(int index) const; - // Returns the builders of this operation. + /// Returns the builders of this operation. ArrayRef getBuilders() const { return builders; } - // Returns the getter name for the accessor of `name`. + /// Returns the getter name for the accessor of `name`. std::string getGetterName(StringRef name) const; - // Returns the setter name for the accessor of `name`. + /// Returns the setter name for the accessor of `name`. std::string getSetterName(StringRef name) const; private: - // Populates the vectors containing operands, attributes, results and traits. + /// Populates the vectors containing operands, attributes, results and traits. void populateOpStructure(); - // Populates type inference info (mostly equality) with input a mapping from - // names to indices for arguments and results. + /// Populates type inference info (mostly equality) with input a mapping from + /// names to indices for arguments and results. void populateTypeInferenceInfo( const llvm::StringMap &argumentsAndResultsIndex); - // The dialect of this op. + /// The dialect of this op. Dialect dialect; - // The unqualified C++ class name of the op. + /// The unqualified C++ class name of the op. StringRef cppClassName; - // The C++ namespace for this op. + /// The C++ namespace for this op. StringRef cppNamespace; - // The operands of the op. + /// The operands of the op. SmallVector operands; - // The attributes of the op. Contains native attributes (corresponding to the - // actual stored attributed of the operation) followed by derived attributes - // (corresponding to dynamic properties of the operation that are computed - // upon request). + /// The attributes of the op. Contains native attributes (corresponding to + /// the actual stored attributed of the operation) followed by derived + /// attributes (corresponding to dynamic properties of the operation that are + /// computed upon request). SmallVector attributes; - // The arguments of the op (operands and native attributes). + /// The arguments of the op (operands and native attributes). SmallVector arguments; - // The results of the op. + /// The results of the op. SmallVector results; - // The successors of this op. + /// The successors of this op. SmallVector successors; - // The traits of the op. + /// The traits of the op. SmallVector traits; - // The regions of this op. + /// The regions of this op. SmallVector regions; - // The argument with the same type as the result. + /// The argument with the same type as the result. SmallVector, 4> resultTypeMapping; - // Map from argument to attribute or operand number. + /// Map from argument to attribute or operand number. SmallVector attrOrOperandMapping; - // The builders of this operator. + /// The builders of this operator. SmallVector builders; - // The number of native attributes stored in the leading positions of - // `attributes`. + /// The number of native attributes stored in the leading positions of + /// `attributes`. int numNativeAttributes; - // The TableGen definition of this op. + /// The TableGen definition of this op. const llvm::Record &def; - // Whether the type of all results are known. + /// Whether the type of all results are known. bool allResultsHaveKnownTypes; };