@@ -83,11 +83,10 @@ def PromotableAllocationOpInterface
83
83
def PromotableMemOpInterface : OpInterface<"PromotableMemOpInterface"> {
84
84
let description = [{
85
85
Describes an operation that can load from memory slots and/or store
86
- to memory slots. Loads and stores must be of whole values of the same
87
- type as the slot itself.
86
+ to memory slots.
88
87
89
- For a memory operation on a slot to be valid, it must operate on the slot
90
- pointer *only as a pointer to an element of the type of the slot* .
88
+ For a memory operation on a slot to be valid, it must strictly operate
89
+ within the bounds of the slot.
91
90
92
91
If the same operation does both loads and stores on the same slot, the
93
92
load must semantically happen first.
@@ -142,7 +141,8 @@ def PromotableMemOpInterface : OpInterface<"PromotableMemOpInterface"> {
142
141
}], "bool", "canUsesBeRemoved",
143
142
(ins "const ::mlir::MemorySlot &":$slot,
144
143
"const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &":$blockingUses,
145
- "::llvm::SmallVectorImpl<::mlir::OpOperand *> &":$newBlockingUses)
144
+ "::llvm::SmallVectorImpl<::mlir::OpOperand *> &":$newBlockingUses,
145
+ "const ::mlir::DataLayout &":$datalayout)
146
146
>,
147
147
InterfaceMethod<[{
148
148
Transforms IR to ensure that the current operation does not use the
@@ -197,7 +197,8 @@ def PromotableOpInterface : OpInterface<"PromotableOpInterface"> {
197
197
No IR mutation is allowed in this method.
198
198
}], "bool", "canUsesBeRemoved",
199
199
(ins "const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &":$blockingUses,
200
- "::llvm::SmallVectorImpl<::mlir::OpOperand *> &":$newBlockingUses)
200
+ "::llvm::SmallVectorImpl<::mlir::OpOperand *> &":$newBlockingUses,
201
+ "const ::mlir::DataLayout &":$datalayout)
201
202
>,
202
203
InterfaceMethod<[{
203
204
Transforms IR to ensure that the current operation does not use the
@@ -285,29 +286,28 @@ def DestructurableAllocationOpInterface
285
286
def SafeMemorySlotAccessOpInterface
286
287
: OpInterface<"SafeMemorySlotAccessOpInterface"> {
287
288
let description = [{
288
- Describes operations using memory slots in a type- safe manner.
289
+ Describes operations using memory slots in a safe manner.
289
290
}];
290
291
let cppNamespace = "::mlir";
291
292
292
293
let methods = [
293
294
InterfaceMethod<[{
294
295
Returns whether all accesses in this operation to the provided slot are
295
- done in a type-safe manner. To be type-safe, the access must only load
296
- the value in this type as the type of the slot, and without assuming any
297
- context around the slot. For example, a type-safe load must not load
298
- outside the bounds of the slot.
296
+ done in a safe manner. To be safe, the access most only access the slot
297
+ inside the bounds that its type implies.
299
298
300
- If the type- safety of the accesses depends on the type- safety of the
301
- accesses to further memory slots, the result of this method will be
302
- conditioned to the type- safety of the accesses to the slots added by
303
- this method to `mustBeSafelyUsed`.
299
+ If the safety of the accesses depends on the safety of the accesses to
300
+ further memory slots, the result of this method will be conditioned to
301
+ the safety of the accesses to the slots added by this method to
302
+ `mustBeSafelyUsed`.
304
303
305
304
No IR mutation is allowed in this method.
306
305
}],
307
306
"::mlir::LogicalResult",
308
307
"ensureOnlySafeAccesses",
309
308
(ins "const ::mlir::MemorySlot &":$slot,
310
- "::mlir::SmallVectorImpl<::mlir::MemorySlot> &":$mustBeSafelyUsed)
309
+ "::mlir::SmallVectorImpl<::mlir::MemorySlot> &":$mustBeSafelyUsed,
310
+ "const ::mlir::DataLayout &":$dataLayout)
311
311
>
312
312
];
313
313
}
@@ -323,21 +323,21 @@ def DestructurableAccessorOpInterface
323
323
InterfaceMethod<[{
324
324
For a given destructurable memory slot, returns whether this operation can
325
325
rewire its uses of the slot to use the slots generated after
326
- destructuring. This may involve creating new operations, and usually
327
- amounts to checking if the pointer types match.
326
+ destructuring. This may involve creating new operations.
328
327
329
328
This method must also register the indices it will access within the
330
329
`usedIndices` set. If the accessor generates new slots mapping to
331
330
subelements, they must be registered in `mustBeSafelyUsed` to ensure
332
- they are used in a locally type- safe manner.
331
+ they are used in a safe manner.
333
332
334
333
No IR mutation is allowed in this method.
335
334
}],
336
335
"bool",
337
336
"canRewire",
338
337
(ins "const ::mlir::DestructurableMemorySlot &":$slot,
339
338
"::llvm::SmallPtrSetImpl<::mlir::Attribute> &":$usedIndices,
340
- "::mlir::SmallVectorImpl<::mlir::MemorySlot> &":$mustBeSafelyUsed)
339
+ "::mlir::SmallVectorImpl<::mlir::MemorySlot> &":$mustBeSafelyUsed,
340
+ "const ::mlir::DataLayout &":$dataLayout)
341
341
>,
342
342
InterfaceMethod<[{
343
343
Rewires the use of a slot to the generated subslots, without deleting
@@ -351,7 +351,8 @@ def DestructurableAccessorOpInterface
351
351
"rewire",
352
352
(ins "const ::mlir::DestructurableMemorySlot &":$slot,
353
353
"::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &":$subslots,
354
- "::mlir::RewriterBase &":$rewriter)
354
+ "::mlir::RewriterBase &":$rewriter,
355
+ "const ::mlir::DataLayout &":$dataLayout)
355
356
>
356
357
];
357
358
}
0 commit comments