NFC: Replace usages of iterator_range<operand_iterator> with operand_range.

--

PiperOrigin-RevId: 242031201
This commit is contained in:
River Riddle
2019-04-04 16:24:10 -07:00
committed by Mehdi Amini
parent 64f10da5ee
commit c4a5386e48
7 changed files with 22 additions and 26 deletions

View File

@@ -138,7 +138,7 @@ public:
}
/// Get the argument operands to the called function.
llvm::iterator_range<operand_iterator> 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<operand_iterator> 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<operand_iterator> 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<operand_iterator> getFalseOperands() {
operand_range getFalseOperands() {
return {false_operand_begin(), false_operand_end()};
}
@@ -557,7 +557,7 @@ public:
return getSrcMemRef()->getType().cast<MemRefType>().getRank();
}
// Returns the source memerf indices for this DMA operation.
llvm::iterator_range<Operation::operand_iterator> 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<Operation::operand_iterator> 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<Operation::operand_iterator> 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<Operation::operand_iterator> 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<Operation::operand_iterator> getIndices() {
operand_range getIndices() {
return {getOperation()->operand_begin() + 1, getOperation()->operand_end()};
}
@@ -754,7 +754,7 @@ public:
return getMemRef()->getType().cast<MemRefType>();
}
llvm::iterator_range<Operation::operand_iterator> getIndices() {
operand_range getIndices() {
return {getOperation()->operand_begin() + 1, getOperation()->operand_end()};
}
@@ -878,7 +878,7 @@ public:
return getMemRef()->getType().cast<MemRefType>();
}
llvm::iterator_range<Operation::operand_iterator> getIndices() {
operand_range getIndices() {
return {getOperation()->operand_begin() + 2, getOperation()->operand_end()};
}

View File

@@ -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<ForInst::operand_iterator> types.
/// Operation::operand_range types.
template <typename T, typename ToType = T>
inline std::function<ToType *(T *)> makePtrDynCaster() {
return [](T *val) { return llvm::dyn_cast<ToType>(val); };

View File

@@ -110,7 +110,7 @@ public:
MemRefType getMemRefType() {
return getMemRef()->getType().cast<MemRefType>();
}
llvm::iterator_range<Operation::operand_iterator> getIndices();
operand_range getIndices();
Optional<Value *> getPaddingValue();
AffineMap getPermutationMap();
@@ -172,7 +172,7 @@ public:
MemRefType getMemRefType() {
return getMemRef()->getType().cast<MemRefType>();
}
llvm::iterator_range<Operation::operand_iterator> getIndices();
operand_range getIndices();
AffineMap getPermutationMap();
static bool parse(OpAsmParser *parser, OperationState *result);

View File

@@ -108,7 +108,7 @@ Optional<SmallVector<unsigned, 4>> mlir::shapeRatio(VectorType superVectorType,
/// Examples can be found in the documentation of `makePermutationMap`, in the
/// header file.
static AffineMap makePermutationMap(
llvm::iterator_range<Operation::operand_iterator> operands,
Operation::operand_range operands,
const DenseMap<Operation *, unsigned> &enclosingLoopToVectorDim) {
if (enclosingLoopToVectorDim.empty())
return AffineMap();

View File

@@ -817,9 +817,8 @@ LogicalResult OpTrait::impl::verifySameOperandsAndResultType(Operation *op) {
return success();
}
static LogicalResult
verifyBBArguments(llvm::iterator_range<Operation::operand_iterator> 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) +

View File

@@ -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<Value *, 4> lookupValues(
const llvm::iterator_range<Operation::operand_iterator> &operands);
SmallVector<Value *, 4> 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<Value *, 4> impl::FunctionConversion::lookupValues(
const llvm::iterator_range<Operation::operand_iterator> &operands) {
SmallVector<Value *, 4>
impl::FunctionConversion::lookupValues(Operation::operand_range operands) {
SmallVector<Value *, 4> remapped;
remapped.reserve(llvm::size(operands));
for (Value *operand : operands) {

View File

@@ -85,8 +85,7 @@ void VectorTransferReadOp::build(Builder *builder, OperationState *result,
result->addTypes(vectorType);
}
llvm::iterator_range<Operation::operand_iterator>
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<Operation::operand_iterator>
VectorTransferWriteOp::getIndices() {
auto VectorTransferWriteOp::getIndices() -> operand_range {
auto begin = getOperation()->operand_begin() + Offsets::FirstIndexOffset;
auto end = begin + getMemRefType().getRank();
return {begin, end};