@@ -286,8 +286,7 @@ def fir_FreeMemOp : fir_Op<"freemem", [MemoryEffects<[MemFree]>]> {
286286 let assemblyFormat = "$heapref attr-dict `:` qualified(type($heapref))";
287287}
288288
289- def fir_LoadOp : fir_OneResultOp<"load", [FirAliasTagOpInterface,
290- DeclareOpInterfaceMethods<MemoryEffectsOpInterface>]> {
289+ def fir_LoadOp : fir_OneResultOp<"load", [FirAliasTagOpInterface]> {
291290 let summary = "load a value from a memory reference";
292291 let description = [{
293292 Load a value from a memory reference into an ssa-value (virtual register).
@@ -303,7 +302,7 @@ def fir_LoadOp : fir_OneResultOp<"load", [FirAliasTagOpInterface,
303302 or null.
304303 }];
305304
306- let arguments = (ins AnyReferenceLike:$memref,
305+ let arguments = (ins Arg< AnyReferenceLike, "", [MemRead]> :$memref,
307306 OptionalAttr<LLVM_TBAATagArrayAttr>:$tbaa);
308307
309308 let builders = [OpBuilder<(ins "mlir::Value":$refVal)>,
@@ -316,8 +315,7 @@ def fir_LoadOp : fir_OneResultOp<"load", [FirAliasTagOpInterface,
316315 }];
317316}
318317
319- def fir_StoreOp : fir_Op<"store", [FirAliasTagOpInterface,
320- DeclareOpInterfaceMethods<MemoryEffectsOpInterface>]> {
318+ def fir_StoreOp : fir_Op<"store", [FirAliasTagOpInterface]> {
321319 let summary = "store an SSA-value to a memory location";
322320
323321 let description = [{
@@ -337,7 +335,7 @@ def fir_StoreOp : fir_Op<"store", [FirAliasTagOpInterface,
337335 }];
338336
339337 let arguments = (ins AnyType:$value,
340- AnyReferenceLike:$memref,
338+ Arg< AnyReferenceLike, "", [MemWrite]> :$memref,
341339 OptionalAttr<LLVM_TBAATagArrayAttr>:$tbaa);
342340
343341 let builders = [OpBuilder<(ins "mlir::Value":$value, "mlir::Value":$memref)>];
@@ -350,7 +348,7 @@ def fir_StoreOp : fir_Op<"store", [FirAliasTagOpInterface,
350348 }];
351349}
352350
353- def fir_CopyOp : fir_Op<"copy", [DeclareOpInterfaceMethods<MemoryEffectsOpInterface> ]> {
351+ def fir_CopyOp : fir_Op<"copy", []> {
354352 let summary = "copy constant size memory";
355353
356354 let description = [{
@@ -371,8 +369,8 @@ def fir_CopyOp : fir_Op<"copy", [DeclareOpInterfaceMethods<MemoryEffectsOpInterf
371369 TODO: add FirAliasTagOpInterface to carry TBAA.
372370 }];
373371
374- let arguments = (ins AnyRefOfConstantSizeAggregateType:$source,
375- AnyRefOfConstantSizeAggregateType:$destination,
372+ let arguments = (ins Arg< AnyRefOfConstantSizeAggregateType, "", [MemRead]> :$source,
373+ Arg< AnyRefOfConstantSizeAggregateType, "", [MemWrite]> :$destination,
376374 OptionalAttr<UnitAttr>:$no_overlap);
377375
378376 let builders = [OpBuilder<(ins "mlir::Value":$source,
@@ -1375,8 +1373,7 @@ def fir_BoxTypeDescOp : fir_SimpleOneResultOp<"box_tdesc", [NoMemoryEffect]> {
13751373// !- Merge the new and old values into the memory for "A"
13761374// array_merge_store <updated A> to <A's address>
13771375
1378- def fir_ArrayLoadOp : fir_Op<"array_load", [AttrSizedOperandSegments,
1379- DeclareOpInterfaceMethods<MemoryEffectsOpInterface>]> {
1376+ def fir_ArrayLoadOp : fir_Op<"array_load", [AttrSizedOperandSegments]> {
13801377
13811378 let summary = "Load an array as a value.";
13821379
@@ -1415,7 +1412,7 @@ def fir_ArrayLoadOp : fir_Op<"array_load", [AttrSizedOperandSegments,
14151412 }];
14161413
14171414 let arguments = (ins
1418- AnyRefOrBox:$memref,
1415+ Arg< AnyRefOrBox, "", [MemRead]> :$memref,
14191416 Optional<AnyShapeOrShiftType>:$shape,
14201417 Optional<fir_SliceType>:$slice,
14211418 Variadic<AnyIntegerType>:$typeparams
@@ -1627,7 +1624,7 @@ def fir_ArrayAccessOp : fir_Op<"array_access", [AttrSizedOperandSegments,
16271624
16281625 It is only possible to use `array_access` on an `array_load` result value or
16291626 a value that can be trace back transitively to an `array_load` as the
1630- dominating source. Other array operations such as `array_amend` can be in
1627+ dominating source. Other array operation such as `array_amend` can be in
16311628 between.
16321629
16331630 TODO: The above restriction is not enforced. The design of the operation
@@ -1688,7 +1685,7 @@ def fir_ArrayAmendOp : fir_Op<"array_amend", [NoMemoryEffect]> {
16881685}
16891686
16901687def fir_ArrayMergeStoreOp : fir_Op<"array_merge_store",
1691- [AttrSizedOperandSegments, DeclareOpInterfaceMethods<MemoryEffectsOpInterface> ]> {
1688+ [AttrSizedOperandSegments]> {
16921689
16931690 let summary = "Store merged array value to memory.";
16941691
@@ -1717,7 +1714,7 @@ def fir_ArrayMergeStoreOp : fir_Op<"array_merge_store",
17171714 let arguments = (ins
17181715 fir_SequenceType:$original,
17191716 fir_SequenceType:$sequence,
1720- AnyRefOrBox:$memref,
1717+ Arg< AnyRefOrBox, "", [MemWrite]> :$memref,
17211718 Optional<fir_SliceType>:$slice,
17221719 Variadic<AnyIntegerType>:$typeparams
17231720 );
@@ -2755,22 +2752,6 @@ def fir_AddrOfOp : fir_OneResultOp<"address_of", [NoMemoryEffect]> {
27552752 let assemblyFormat = "`(` $symbol `)` attr-dict `:` type($resTy)";
27562753}
27572754
2758- def fir_VolatileCastOp : fir_SimpleOneResultOp<"volatile_cast", [NoMemoryEffect]> {
2759- let summary = "cast between volatile and non-volatile types";
2760- let description = [{
2761- Cast between volatile and non-volatile types. The types must be otherwise
2762- identical. A value's volatility cannot be changed by a fir.convert operation.
2763- Reinterpreting a value as volatile must be done explicitly using this operation.
2764- }];
2765- let arguments = (ins AnyRefOrBox:$value);
2766- let results = (outs AnyRefOrBox:$res);
2767- let assemblyFormat = [{
2768- $value attr-dict `:` functional-type($value, results)
2769- }];
2770- let hasVerifier = 1;
2771- let hasFolder = 1;
2772- }
2773-
27742755def fir_ConvertOp : fir_SimpleOneResultOp<"convert", [NoMemoryEffect]> {
27752756 let summary = "encapsulates all Fortran entity type conversions";
27762757
0 commit comments