summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Dialect/AffineOps/AffineOps.cpp
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-12-06 20:06:48 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-12-06 20:07:23 -0800
commit9d1a0c72b4ae54b97809966257bd1b9cb3140dfe (patch)
treefcbbbae63f398d3ed68ea4e3c788c4639fc7a15e /mlir/lib/Dialect/AffineOps/AffineOps.cpp
parentd27bc1db6a64b6caaf7f64d62a459a595773906b (diff)
downloadbcm5719-llvm-9d1a0c72b4ae54b97809966257bd1b9cb3140dfe.tar.gz
bcm5719-llvm-9d1a0c72b4ae54b97809966257bd1b9cb3140dfe.zip
Add a new ValueRange class.
This class represents a generic abstraction over the different ways to represent a range of Values: ArrayRef<Value *>, operand_range, result_range. This class will allow for removing the many instances of explicit SmallVector<Value *, N> construction. It has the same memory cost as ArrayRef, and only suffers cost from indexing(if+elsing the different underlying representations). This change only updates a few of the existing usages, with more to be changed in followups; e.g. 'build' API. PiperOrigin-RevId: 284307996
Diffstat (limited to 'mlir/lib/Dialect/AffineOps/AffineOps.cpp')
-rw-r--r--mlir/lib/Dialect/AffineOps/AffineOps.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/mlir/lib/Dialect/AffineOps/AffineOps.cpp b/mlir/lib/Dialect/AffineOps/AffineOps.cpp
index 7232c6eb28c..689207c92b1 100644
--- a/mlir/lib/Dialect/AffineOps/AffineOps.cpp
+++ b/mlir/lib/Dialect/AffineOps/AffineOps.cpp
@@ -863,14 +863,11 @@ void AffineDmaStartOp::build(Builder *builder, OperationState &result,
void AffineDmaStartOp::print(OpAsmPrinter &p) {
p << "affine.dma_start " << *getSrcMemRef() << '[';
- SmallVector<Value *, 8> operands(getSrcIndices());
- p.printAffineMapOfSSAIds(getSrcMapAttr(), operands);
+ p.printAffineMapOfSSAIds(getSrcMapAttr(), getSrcIndices());
p << "], " << *getDstMemRef() << '[';
- operands.assign(getDstIndices().begin(), getDstIndices().end());
- p.printAffineMapOfSSAIds(getDstMapAttr(), operands);
+ p.printAffineMapOfSSAIds(getDstMapAttr(), getDstIndices());
p << "], " << *getTagMemRef() << '[';
- operands.assign(getTagIndices().begin(), getTagIndices().end());
- p.printAffineMapOfSSAIds(getTagMapAttr(), operands);
+ p.printAffineMapOfSSAIds(getTagMapAttr(), getTagIndices());
p << "], " << *getNumElements();
if (isStrided()) {
p << ", " << *getStride();
@@ -1827,11 +1824,8 @@ ParseResult AffineLoadOp::parse(OpAsmParser &parser, OperationState &result) {
void AffineLoadOp::print(OpAsmPrinter &p) {
p << "affine.load " << *getMemRef() << '[';
- AffineMapAttr mapAttr = getAttrOfType<AffineMapAttr>(getMapAttrName());
- if (mapAttr) {
- SmallVector<Value *, 2> operands(getMapOperands());
- p.printAffineMapOfSSAIds(mapAttr, operands);
- }
+ if (AffineMapAttr mapAttr = getAttrOfType<AffineMapAttr>(getMapAttrName()))
+ p.printAffineMapOfSSAIds(mapAttr, getMapOperands());
p << ']';
p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{getMapAttrName()});
p << " : " << getMemRefType();
@@ -1922,11 +1916,8 @@ ParseResult AffineStoreOp::parse(OpAsmParser &parser, OperationState &result) {
void AffineStoreOp::print(OpAsmPrinter &p) {
p << "affine.store " << *getValueToStore();
p << ", " << *getMemRef() << '[';
- AffineMapAttr mapAttr = getAttrOfType<AffineMapAttr>(getMapAttrName());
- if (mapAttr) {
- SmallVector<Value *, 2> operands(getMapOperands());
- p.printAffineMapOfSSAIds(mapAttr, operands);
- }
+ if (AffineMapAttr mapAttr = getAttrOfType<AffineMapAttr>(getMapAttrName()))
+ p.printAffineMapOfSSAIds(mapAttr, getMapOperands());
p << ']';
p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{getMapAttrName()});
p << " : " << getMemRefType();
OpenPOWER on IntegriCloud