//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_INTERFACES_AFFINEMEMORYOPINTERFACES_H_
-#define MLIR_INTERFACES_AFFINEMEMORYOPINTERFACES_H_
+#ifndef MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPDIALECT_H_
+#define MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPDIALECT_H_
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc"
} // namespace mlir
-#endif // MLIR_INTERFACES_AFFINEMEMORYOPINTERFACES_H_
+#endif // MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPDIALECT_H_
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_AFFINEMEMORYOPINTERFACES
-#define MLIR_AFFINEMEMORYOPINTERFACES
+#ifndef AFFINEMEMORYOPINTERFACES
+#define AFFINEMEMORYOPINTERFACES
include "mlir/IR/OpBase.td"
let methods = [
InterfaceMethod<
- /*desc=*/[{ Returns the memref operand to read from. }],
+ /*desc=*/"Returns the memref operand to read from.",
/*retTy=*/"Value",
/*methodName=*/"getMemRef",
/*args=*/(ins),
}]
>,
InterfaceMethod<
- /*desc=*/[{ Returns the type of the memref operand. }],
+ /*desc=*/"Returns the type of the memref operand.",
/*retTy=*/"MemRefType",
/*methodName=*/"getMemRefType",
/*args=*/(ins),
}]
>,
InterfaceMethod<
- /*desc=*/[{ Returns affine map operands. }],
+ /*desc=*/"Returns affine map operands.",
/*retTy=*/"Operation::operand_range",
/*methodName=*/"getMapOperands",
/*args=*/(ins),
}]
>,
InterfaceMethod<
- /*desc=*/[{ Returns the affine map used to index the memref for this
- operation. }],
+ /*desc=*/[{
+ Returns the affine map used to index the memref for this operation.
+ }],
/*retTy=*/"AffineMap",
/*methodName=*/"getAffineMap",
/*args=*/(ins),
let methods = [
InterfaceMethod<
- /*desc=*/[{ Returns the memref operand to write to. }],
+ /*desc=*/"Returns the memref operand to write to.",
/*retTy=*/"Value",
/*methodName=*/"getMemRef",
/*args=*/(ins),
}]
>,
InterfaceMethod<
- /*desc=*/[{ Returns the type of the memref operand. }],
+ /*desc=*/"Returns the type of the memref operand.",
/*retTy=*/"MemRefType",
/*methodName=*/"getMemRefType",
/*args=*/(ins),
}]
>,
InterfaceMethod<
- /*desc=*/[{ Returns affine map operands. }],
+ /*desc=*/"Returns affine map operands.",
/*retTy=*/"Operation::operand_range",
/*methodName=*/"getMapOperands",
/*args=*/(ins),
}]
>,
InterfaceMethod<
- /*desc=*/[{ Returns the affine map used to index the memref for this
- operation. }],
+ /*desc=*/[{
+ Returns the affine map used to index the memref for this operation.
+ }],
/*retTy=*/"AffineMap",
/*methodName=*/"getAffineMap",
/*args=*/(ins),
];
}
-#endif // MLIR_AFFINEMEMORYOPINTERFACES
+#endif // AFFINEMEMORYOPINTERFACES
add_mlir_dialect(AffineOps affine)
add_mlir_doc(AffineOps -gen-op-doc AffineOps Dialects/)
-set(LLVM_TARGET_DEFINITIONS AffineMemoryOpInterfaces.td)
-mlir_tablegen(AffineMemoryOpInterfaces.h.inc -gen-op-interface-decls)
-mlir_tablegen(AffineMemoryOpInterfaces.cpp.inc -gen-op-interface-defs)
-add_public_tablegen_target(MLIRAffineMemoryOpInterfacesIncGen)
-add_dependencies(mlir-generic-headers MLIRAffineMemoryOpInterfacesIncGen)
-
+add_mlir_interface(AffineMemoryOpInterfaces)
add_dependencies(MLIRAffineOpsIncGen MLIRAffineMemoryOpInterfacesIncGen)
void MemRefAccess::getAccessMap(AffineValueMap *accessMap) const {
// Get affine map from AffineLoad/Store.
AffineMap map;
- if (auto loadOp = dyn_cast<AffineReadOpInterface>(opInst)) {
+ if (auto loadOp = dyn_cast<AffineReadOpInterface>(opInst))
map = loadOp.getAffineMap();
- } else {
- auto storeOp = cast<AffineWriteOpInterface>(opInst);
- map = storeOp.getAffineMap();
- }
+ else
+ map = cast<AffineWriteOpInterface>(opInst).getAffineMap();
+
SmallVector<Value, 8> operands(indices.begin(), indices.end());
fullyComposeAffineMapAndOperands(&map, &operands);
map = simplifyAffineMap(map);