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