[Mlir-commits] [mlir] [mlir][Ptr] Add the `MemorySpaceAttrInterface` interface and dependencies. (PR #86870)
Fabian Mora
llvmlistbot at llvm.org
Tue Aug 20 06:30:05 PDT 2024
================
@@ -316,6 +316,54 @@ static ParseResult parseCustomFloatAttr(AsmParser &p, StringAttr &typeStrAttr,
return success();
}
+//===----------------------------------------------------------------------===//
+// TestConstMemorySpaceAttr
+//===----------------------------------------------------------------------===//
+
+ptr::MemorySpaceAttrInterface
+TestConstMemorySpaceAttr::getDefaultMemorySpace() const {
+ return TestConstMemorySpaceAttr::get(getContext(), 0);
+}
+
+LogicalResult TestConstMemorySpaceAttr::isValidLoad(
+ Type type, mlir::ptr::AtomicOrdering ordering, IntegerAttr alignment,
+ function_ref<InFlightDiagnostic()> emitError) const {
+ return success();
+}
+
+LogicalResult TestConstMemorySpaceAttr::isValidStore(
+ Type type, mlir::ptr::AtomicOrdering ordering, IntegerAttr alignment,
+ function_ref<InFlightDiagnostic()> emitError) const {
+ return emitError ? (emitError() << "memory space is read-only") : failure();
----------------
fabianmcg wrote:
Properly testing, yes we need at least one op (next patch).
Minimal testing, I could add an unit test.
https://github.com/llvm/llvm-project/pull/86870
More information about the Mlir-commits
mailing list