[PATCH] D78619: Extended Alloc and Dealloc operations with memory-effect traits.

Julian Gross via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 04:17:10 PDT 2020


dfki-jugr updated this revision to Diff 259229.
dfki-jugr added a comment.

Updated commit message and added a short summary.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78619/new/

https://reviews.llvm.org/D78619

Files:
  mlir/include/mlir/Dialect/StandardOps/IR/Ops.td


Index: mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
===================================================================
--- mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
+++ mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
@@ -128,12 +128,14 @@
 //
 //   %0 = alloclike(%m)[%s] : memref<8x?xf32, (d0, d1)[s0] -> ((d0 + s0), d1)>
 //
-class AllocLikeOp<string mnemonic, list<OpTrait> traits = []> :
+class AllocLikeOp<string mnemonic,
+                  list<OpVariableDecorator> resultDecorators = [],
+                  list<OpTrait> traits = []> :
     Std_Op<mnemonic, traits> {
 
   let arguments = (ins Variadic<Index>:$value,
                    Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$alignment);
-  let results = (outs AnyMemRef);
+  let results = (outs Arg<AnyMemRef, "", resultDecorators>);
 
   let builders = [OpBuilder<
     "Builder *builder, OperationState &result, MemRefType memrefType", [{
@@ -275,7 +277,7 @@
 // AllocOp
 //===----------------------------------------------------------------------===//
 
-def AllocOp : AllocLikeOp<"alloc"> {
+def AllocOp : AllocLikeOp<"alloc", [MemAlloc], [MemoryEffects<[MemAlloc]>]> {
   let summary = "memory allocation operation";
   let description = [{
     The `alloc` operation allocates a region of memory, as specified by its
@@ -1248,7 +1250,7 @@
 // DeallocOp
 //===----------------------------------------------------------------------===//
 
-def DeallocOp : Std_Op<"dealloc"> {
+def DeallocOp : Std_Op<"dealloc", [MemoryEffects<[MemFree]>]> {
   let summary = "memory deallocation operation";
   let description = [{
     The `dealloc` operation frees the region of memory referenced by a memref
@@ -1264,7 +1266,7 @@
     ```
   }];
 
-  let arguments = (ins AnyMemRef:$memref);
+  let arguments = (ins Arg<AnyMemRef, "", [MemFree]>:$memref);
 
   let hasCanonicalizer = 1;
   let hasFolder = 1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78619.259229.patch
Type: text/x-patch
Size: 1881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200422/1d5416d3/attachment.bin>


More information about the llvm-commits mailing list