diff --git a/mlir/include/mlir/StandardOps/Ops.h b/mlir/include/mlir/StandardOps/Ops.h index dee0045d3e76..b9e4aa767a8d 100644 --- a/mlir/include/mlir/StandardOps/Ops.h +++ b/mlir/include/mlir/StandardOps/Ops.h @@ -138,7 +138,7 @@ public: } /// Get the argument operands to the called function. - llvm::iterator_range getArgOperands() { + operand_range getArgOperands() { return {arg_operand_begin(), arg_operand_end()}; } @@ -171,7 +171,7 @@ public: Value *getCallee() { return getOperand(0); } /// Get the argument operands to the called function. - llvm::iterator_range getArgOperands() { + operand_range getArgOperands() { return {arg_operand_begin(), arg_operand_end()}; } @@ -314,7 +314,7 @@ public: operand_iterator true_operand_end() { return true_operand_begin() + getNumTrueOperands(); } - llvm::iterator_range getTrueOperands() { + operand_range getTrueOperands() { return {true_operand_begin(), true_operand_end()}; } @@ -337,7 +337,7 @@ public: operand_iterator false_operand_end() { return false_operand_begin() + getNumFalseOperands(); } - llvm::iterator_range getFalseOperands() { + operand_range getFalseOperands() { return {false_operand_begin(), false_operand_end()}; } @@ -557,7 +557,7 @@ public: return getSrcMemRef()->getType().cast().getRank(); } // Returns the source memerf indices for this DMA operation. - llvm::iterator_range getSrcIndices() { + operand_range getSrcIndices() { return {getOperation()->operand_begin() + 1, getOperation()->operand_begin() + 1 + getSrcMemRefRank()}; } @@ -576,7 +576,7 @@ public: } // Returns the destination memref indices for this DMA operation. - llvm::iterator_range getDstIndices() { + operand_range getDstIndices() { return {getOperation()->operand_begin() + 1 + getSrcMemRefRank() + 1, getOperation()->operand_begin() + 1 + getSrcMemRefRank() + 1 + getDstMemRefRank()}; @@ -597,7 +597,7 @@ public: } // Returns the tag memref index for this DMA operation. - llvm::iterator_range getTagIndices() { + operand_range getTagIndices() { unsigned tagIndexStartPos = 1 + getSrcMemRefRank() + 1 + getDstMemRefRank() + 1 + 1; return {getOperation()->operand_begin() + tagIndexStartPos, @@ -677,7 +677,7 @@ public: Value *getTagMemRef() { return getOperand(0); } // Returns the tag memref index for this DMA operation. - llvm::iterator_range getTagIndices() { + operand_range getTagIndices() { return {getOperation()->operand_begin() + 1, getOperation()->operand_begin() + 1 + getTagMemRefRank()}; } @@ -718,7 +718,7 @@ public: Value *getAggregate() { return getOperand(0); } - llvm::iterator_range getIndices() { + operand_range getIndices() { return {getOperation()->operand_begin() + 1, getOperation()->operand_end()}; } @@ -754,7 +754,7 @@ public: return getMemRef()->getType().cast(); } - llvm::iterator_range getIndices() { + operand_range getIndices() { return {getOperation()->operand_begin() + 1, getOperation()->operand_end()}; } @@ -878,7 +878,7 @@ public: return getMemRef()->getType().cast(); } - llvm::iterator_range getIndices() { + operand_range getIndices() { return {getOperation()->operand_begin() + 2, getOperation()->operand_end()}; } diff --git a/mlir/include/mlir/Support/Functional.h b/mlir/include/mlir/Support/Functional.h index a9988941d9bd..edc5e1dac637 100644 --- a/mlir/include/mlir/Support/Functional.h +++ b/mlir/include/mlir/Support/Functional.h @@ -100,7 +100,7 @@ void zipApply(Fn fun, ContainerType1 input1, ContainerType2 input2) { /// Unwraps a pointer type to another type (possibly the same). /// Used in particular to allow easier compositions of -/// llvm::iterator_range types. +/// Operation::operand_range types. template inline std::function makePtrDynCaster() { return [](T *val) { return llvm::dyn_cast(val); }; diff --git a/mlir/include/mlir/VectorOps/VectorOps.h b/mlir/include/mlir/VectorOps/VectorOps.h index e5d53e03af74..6b75933c1ce7 100644 --- a/mlir/include/mlir/VectorOps/VectorOps.h +++ b/mlir/include/mlir/VectorOps/VectorOps.h @@ -110,7 +110,7 @@ public: MemRefType getMemRefType() { return getMemRef()->getType().cast(); } - llvm::iterator_range getIndices(); + operand_range getIndices(); Optional getPaddingValue(); AffineMap getPermutationMap(); @@ -172,7 +172,7 @@ public: MemRefType getMemRefType() { return getMemRef()->getType().cast(); } - llvm::iterator_range getIndices(); + operand_range getIndices(); AffineMap getPermutationMap(); static bool parse(OpAsmParser *parser, OperationState *result); diff --git a/mlir/lib/Analysis/VectorAnalysis.cpp b/mlir/lib/Analysis/VectorAnalysis.cpp index 761308b99848..b45ac001be47 100644 --- a/mlir/lib/Analysis/VectorAnalysis.cpp +++ b/mlir/lib/Analysis/VectorAnalysis.cpp @@ -108,7 +108,7 @@ Optional> mlir::shapeRatio(VectorType superVectorType, /// Examples can be found in the documentation of `makePermutationMap`, in the /// header file. static AffineMap makePermutationMap( - llvm::iterator_range operands, + Operation::operand_range operands, const DenseMap &enclosingLoopToVectorDim) { if (enclosingLoopToVectorDim.empty()) return AffineMap(); diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp index c3f4c8db06e1..16e7c1eee38c 100644 --- a/mlir/lib/IR/Operation.cpp +++ b/mlir/lib/IR/Operation.cpp @@ -817,9 +817,8 @@ LogicalResult OpTrait::impl::verifySameOperandsAndResultType(Operation *op) { return success(); } -static LogicalResult -verifyBBArguments(llvm::iterator_range operands, - Block *destBB, Operation *op) { +static LogicalResult verifyBBArguments(Operation::operand_range operands, + Block *destBB, Operation *op) { unsigned operandCount = std::distance(operands.begin(), operands.end()); if (operandCount != destBB->getNumArguments()) return op->emitError("branch has " + Twine(operandCount) + diff --git a/mlir/lib/Transforms/DialectConversion.cpp b/mlir/lib/Transforms/DialectConversion.cpp index 49fb9373d1fd..587b7d866f5e 100644 --- a/mlir/lib/Transforms/DialectConversion.cpp +++ b/mlir/lib/Transforms/DialectConversion.cpp @@ -49,8 +49,7 @@ private: // Utility that looks up a list of value in the value remapping table. Returns // an empty vector if one of the values is not mapped yet. - SmallVector lookupValues( - const llvm::iterator_range &operands); + SmallVector lookupValues(Operation::operand_range operands); // Converts the given function to the dialect using hooks defined in // `dialectConversion`. Returns the converted function or `nullptr` on error. @@ -106,8 +105,8 @@ private: } // end namespace impl } // end namespace mlir -SmallVector impl::FunctionConversion::lookupValues( - const llvm::iterator_range &operands) { +SmallVector +impl::FunctionConversion::lookupValues(Operation::operand_range operands) { SmallVector remapped; remapped.reserve(llvm::size(operands)); for (Value *operand : operands) { diff --git a/mlir/lib/VectorOps/VectorOps.cpp b/mlir/lib/VectorOps/VectorOps.cpp index 7c49edb34b0e..263a0b359ba4 100644 --- a/mlir/lib/VectorOps/VectorOps.cpp +++ b/mlir/lib/VectorOps/VectorOps.cpp @@ -85,8 +85,7 @@ void VectorTransferReadOp::build(Builder *builder, OperationState *result, result->addTypes(vectorType); } -llvm::iterator_range -VectorTransferReadOp::getIndices() { +auto VectorTransferReadOp::getIndices() -> operand_range { auto begin = getOperation()->operand_begin() + Offsets::FirstIndexOffset; auto end = begin + getMemRefType().getRank(); return {begin, end}; @@ -264,8 +263,7 @@ void VectorTransferWriteOp::build(Builder *builder, OperationState *result, builder->getAffineMapAttr(permutationMap)); } -llvm::iterator_range -VectorTransferWriteOp::getIndices() { +auto VectorTransferWriteOp::getIndices() -> operand_range { auto begin = getOperation()->operand_begin() + Offsets::FirstIndexOffset; auto end = begin + getMemRefType().getRank(); return {begin, end};