@@ -129,12 +129,14 @@ class FloatArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
129
129
//
130
130
// %0 = alloclike(%m)[%s] : memref<8x?xf32, (d0, d1)[s0] -> ((d0 + s0), d1)>
131
131
//
132
- class AllocLikeOp<string mnemonic, list<OpTrait> traits = []> :
132
+ class AllocLikeOp<string mnemonic,
133
+ list<OpVariableDecorator> resultDecorators = [],
134
+ list<OpTrait> traits = []> :
133
135
Std_Op<mnemonic, traits> {
134
136
135
137
let arguments = (ins Variadic<Index>:$value,
136
138
Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$alignment);
137
- let results = (outs AnyMemRef);
139
+ let results = (outs Arg< AnyMemRef, "", resultDecorators> );
138
140
139
141
let builders = [OpBuilder<
140
142
"Builder *builder, OperationState &result, MemRefType memrefType", [{
@@ -276,7 +278,7 @@ def AddIOp : IntArithmeticOp<"addi", [Commutative]> {
276
278
// AllocOp
277
279
//===----------------------------------------------------------------------===//
278
280
279
- def AllocOp : AllocLikeOp<"alloc"> {
281
+ def AllocOp : AllocLikeOp<"alloc", [MemAlloc], [MemoryEffects<[MemAlloc]>] > {
280
282
let summary = "memory allocation operation";
281
283
let description = [{
282
284
The `alloc` operation allocates a region of memory, as specified by its
@@ -1253,7 +1255,7 @@ def CosOp : FloatUnaryOp<"cos"> {
1253
1255
// DeallocOp
1254
1256
//===----------------------------------------------------------------------===//
1255
1257
1256
- def DeallocOp : Std_Op<"dealloc"> {
1258
+ def DeallocOp : Std_Op<"dealloc", [MemoryEffects<[MemFree]>] > {
1257
1259
let summary = "memory deallocation operation";
1258
1260
let description = [{
1259
1261
The `dealloc` operation frees the region of memory referenced by a memref
@@ -1269,7 +1271,7 @@ def DeallocOp : Std_Op<"dealloc"> {
1269
1271
```
1270
1272
}];
1271
1273
1272
- let arguments = (ins AnyMemRef:$memref);
1274
+ let arguments = (ins Arg< AnyMemRef, "", [MemFree]> :$memref);
1273
1275
1274
1276
let hasCanonicalizer = 1;
1275
1277
let hasFolder = 1;
0 commit comments