48 [&]() {
return parser.
parseInteger(values.emplace_back()); });
49 if (listResult.failed())
63 UnitAttr isInverted, UnitAttr isAll) {
72 [&](int64_t value) { printer << value; });
80 bool inverted,
bool all) {
84 <<
"cannot request both 'all' and 'inverted' values in the list";
88 <<
"cannot both request 'all' and specific values in the list";
91 if (!all && raw.empty()) {
92 return op->
emitOpError() <<
"must request specific values in the list if "
93 "'all' is not specified";
96 auto *it = llvm::unique(rawVector);
97 if (it != rawVector.end())
98 return op->
emitOpError() <<
"expected the listed values to be unique";
106 assert(maxNumber > 0 &&
"expected size to be positive");
107 assert(!(isAll && isInverted) &&
"cannot invert all");
109 result = llvm::to_vector(llvm::seq<int64_t>(0, maxNumber));
114 llvm::SmallDenseSet<int64_t> visited;
115 expanded.reserve(rawList.size());
117 for (int64_t raw : rawList) {
118 int64_t updated = raw < 0 ? maxNumber + raw : raw;
119 if (updated >= maxNumber) {
121 <<
"position overflow " << updated <<
" (updated from " << raw
122 <<
") for maximum " << maxNumber;
126 <<
" (updated from " << raw <<
")";
128 if (!visited.insert(updated).second) {
130 <<
" (updated from " << raw <<
")";
132 target.push_back(updated);
138 result.reserve(result.size() + (maxNumber - expanded.size()));
139 for (int64_t candidate : llvm::seq<int64_t>(0, maxNumber)) {
140 if (llvm::is_contained(expanded, candidate))
142 result.push_back(candidate);
152 #include "mlir/Dialect/Transform/Interfaces/MatchInterfaces.cpp.inc"
constexpr static const llvm::StringLiteral kDimAllKeyword
Keyword syntax for full inclusion in positional specification.
constexpr static const llvm::StringLiteral kDimExceptKeyword
Keyword syntax for positional specification inversion.
virtual ParseResult parseCommaSeparatedList(Delimiter delimiter, function_ref< ParseResult()> parseElementFn, StringRef contextMessage=StringRef())=0
Parse a list of comma-separated items with an optional delimiter.
virtual Builder & getBuilder() const =0
Return a builder which provides useful access to MLIRContext, global objects like types and attribute...
virtual ParseResult parseOptionalKeyword(StringRef keyword)=0
Parse the given keyword if present.
virtual ParseResult parseRParen()=0
Parse a ) token.
ParseResult parseInteger(IntT &result)
Parse an integer value from the stream.
virtual ParseResult parseLParen()=0
Parse a ( token.
virtual raw_ostream & getStream() const
Return the raw output stream used by this printer.
This class is a general helper class for creating context-global objects like types,...
DenseI64ArrayAttr getDenseI64ArrayAttr(ArrayRef< int64_t > values)
The result of a transform IR operation application.
static DiagnosedSilenceableFailure success()
Constructs a DiagnosedSilenceableFailure in the success state.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
The OpAsmParser has methods for interacting with the asm parser: parsing things from it,...
This is a pure-virtual base class that exposes the asmprinter hooks necessary to implement a custom p...
Operation is the basic unit of execution within MLIR.
InFlightDiagnostic emitOpError(const Twine &message={})
Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers.
Base class for DenseArrayAttr that is instantiated and specialized for each supported element type be...
ArrayRef< T > asArrayRef() const
Include the generated interface declarations.
DiagnosedSilenceableFailure emitSilenceableFailure(Location loc, const Twine &message={})
Emits a silenceable failure with the given message.