@@ -184,16 +184,14 @@ def LLVM_AllocaOp : LLVM_Op<"alloca",
184
184
LLVM_MemOpPatterns {
185
185
let arguments = (ins AnyInteger:$arraySize,
186
186
OptionalAttr<I64Attr>:$alignment,
187
- OptionalAttr< TypeAttr> :$elem_type,
187
+ TypeAttr:$elem_type,
188
188
UnitAttr:$inalloca);
189
189
let results = (outs Res<LLVM_AnyPointer, "",
190
190
[MemAlloc<AutomaticAllocationScopeResource>]>:$res);
191
191
string llvmInstName = "Alloca";
192
192
string llvmBuilder = [{
193
193
auto addrSpace = $_resultType->getPointerAddressSpace();
194
- llvm::Type *elementType = moduleTranslation.convertType(
195
- $elem_type ? *$elem_type
196
- : ::llvm::cast<LLVMPointerType>(op.getType()).getElementType());
194
+ llvm::Type *elementType = moduleTranslation.convertType($elem_type);
197
195
auto *inst = builder.CreateAlloca(elementType, addrSpace, $arraySize);
198
196
}] # setAlignmentCode # [{
199
197
inst->setUsedWithInAlloca($inalloca);
@@ -207,31 +205,16 @@ def LLVM_AllocaOp : LLVM_Op<"alloca",
207
205
$res = $_builder.create<LLVM::AllocaOp>(
208
206
$_location, $_resultType, $arraySize,
209
207
alignment == 0 ? IntegerAttr() : $_builder.getI64IntegerAttr(alignment),
210
- TypeAttr::get( allocatedType) , allocaInst->isUsedWithInAlloca());
208
+ allocatedType, allocaInst->isUsedWithInAlloca());
211
209
}];
212
210
let builders = [
213
- DeprecatedOpBuilder<"the usage of typed pointers is deprecated",
214
- (ins "Type":$resultType, "Value":$arraySize,
215
- "unsigned":$alignment),
216
- [{
217
- assert(!::llvm::cast<LLVMPointerType>(resultType).isOpaque() &&
218
- "pass the allocated type explicitly if opaque pointers are used");
219
- if (alignment == 0)
220
- return build($_builder, $_state, resultType, arraySize, IntegerAttr(),
221
- TypeAttr(), false);
222
- build($_builder, $_state, resultType, arraySize,
223
- $_builder.getI64IntegerAttr(alignment), TypeAttr(), false);
224
- }]>,
225
211
OpBuilder<(ins "Type":$resultType, "Type":$elementType, "Value":$arraySize,
226
212
CArg<"unsigned", "0">:$alignment),
227
213
[{
228
- TypeAttr elemTypeAttr =
229
- ::llvm::cast<LLVMPointerType>(resultType).isOpaque() ?
230
- TypeAttr::get(elementType) : TypeAttr();
231
214
build($_builder, $_state, resultType, arraySize,
232
215
alignment == 0 ? IntegerAttr()
233
216
: $_builder.getI64IntegerAttr(alignment),
234
- elemTypeAttr , false);
217
+ elementType , false);
235
218
236
219
}]>
237
220
];
@@ -247,7 +230,7 @@ def LLVM_GEPOp : LLVM_Op<"getelementptr", [Pure,
247
230
let arguments = (ins LLVM_ScalarOrVectorOf<LLVM_AnyPointer>:$base,
248
231
Variadic<LLVM_ScalarOrVectorOf<AnyInteger>>:$dynamicIndices,
249
232
DenseI32ArrayAttr:$rawConstantIndices,
250
- OptionalAttr< TypeAttr> :$elem_type,
233
+ TypeAttr:$elem_type,
251
234
UnitAttr:$inbounds);
252
235
let results = (outs LLVM_ScalarOrVectorOf<LLVM_AnyPointer>:$res);
253
236
let skipDefaultBuilders = 1;
@@ -282,14 +265,6 @@ def LLVM_GEPOp : LLVM_Op<"getelementptr", [Pure,
282
265
OpBuilder<(ins "Type":$resultType, "Type":$basePtrType, "Value":$basePtr,
283
266
"ValueRange":$indices, CArg<"bool", "false">:$inbounds,
284
267
CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)>,
285
- DeprecatedOpBuilder<"the usage of typed pointers is deprecated",
286
- (ins "Type":$resultType, "Value":$basePtr,
287
- "ValueRange":$indices, CArg<"bool", "false">:$inbounds,
288
- CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)>,
289
- DeprecatedOpBuilder<"the usage of typed pointers is deprecated",
290
- (ins "Type":$resultType, "Value":$basePtr,
291
- "ArrayRef<GEPArg>":$indices, CArg<"bool", "false">:$inbounds,
292
- CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)>,
293
268
OpBuilder<(ins "Type":$resultType, "Type":$basePtrType, "Value":$basePtr,
294
269
"ArrayRef<GEPArg>":$indices, CArg<"bool", "false">:$inbounds,
295
270
CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)>,
@@ -313,7 +288,7 @@ def LLVM_GEPOp : LLVM_Op<"getelementptr", [Pure,
313
288
let assemblyFormat = [{
314
289
(`inbounds` $inbounds^)?
315
290
$base `[` custom<GEPIndices>($dynamicIndices, $rawConstantIndices) `]` attr-dict
316
- `:` functional-type(operands, results) ( `,` $elem_type^)?
291
+ `:` functional-type(operands, results) `,` $elem_type
317
292
}];
318
293
319
294
let extraClassDeclaration = [{
@@ -332,7 +307,7 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
332
307
[DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
333
308
DeclareOpInterfaceMethods<PromotableMemOpInterface>,
334
309
DeclareOpInterfaceMethods<SafeMemorySlotAccessOpInterface>]> {
335
- dag args = (ins LLVM_PointerTo<LLVM_LoadableType> :$addr,
310
+ dag args = (ins LLVM_AnyPointer :$addr,
336
311
OptionalAttr<I64Attr>:$alignment,
337
312
UnitAttr:$volatile_,
338
313
UnitAttr:$nontemporal,
@@ -370,7 +345,8 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
370
345
let assemblyFormat = [{
371
346
(`volatile` $volatile_^)? $addr
372
347
(`atomic` (`syncscope` `(` $syncscope^ `)`)? $ordering^)?
373
- attr-dict `:` custom<LoadType>(type($addr), type($res))
348
+ attr-dict `:` qualified(type($addr)) `->` type($res)
349
+
374
350
}];
375
351
string llvmBuilder = [{
376
352
auto *inst = builder.CreateLoad($_resultType, $addr, $volatile_);
@@ -391,9 +367,6 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
391
367
getLLVMSyncScope(loadInst));
392
368
}];
393
369
let builders = [
394
- DeprecatedOpBuilder<"the usage of typed pointers is deprecated",
395
- (ins "Value":$addr, CArg<"unsigned", "0">:$alignment,
396
- CArg<"bool", "false">:$isVolatile, CArg<"bool", "false">:$isNonTemporal)>,
397
370
OpBuilder<(ins "Type":$type, "Value":$addr,
398
371
CArg<"unsigned", "0">:$alignment, CArg<"bool", "false">:$isVolatile,
399
372
CArg<"bool", "false">:$isNonTemporal,
@@ -408,7 +381,7 @@ def LLVM_StoreOp : LLVM_MemAccessOpBase<"store",
408
381
DeclareOpInterfaceMethods<PromotableMemOpInterface>,
409
382
DeclareOpInterfaceMethods<SafeMemorySlotAccessOpInterface>]> {
410
383
dag args = (ins LLVM_LoadableType:$value,
411
- LLVM_PointerTo<LLVM_LoadableType> :$addr,
384
+ LLVM_AnyPointer :$addr,
412
385
OptionalAttr<I64Attr>:$alignment,
413
386
UnitAttr:$volatile_,
414
387
UnitAttr:$nontemporal,
@@ -445,7 +418,7 @@ def LLVM_StoreOp : LLVM_MemAccessOpBase<"store",
445
418
let assemblyFormat = [{
446
419
(`volatile` $volatile_^)? $value `,` $addr
447
420
(`atomic` (`syncscope` `(` $syncscope^ `)`)? $ordering^)?
448
- attr-dict `:` custom<StoreType>( type($value), type($addr))
421
+ attr-dict `:` type($value) `,` qualified( type($addr))
449
422
}];
450
423
string llvmBuilder = [{
451
424
auto *inst = builder.CreateStore($value, $addr, $volatile_);
@@ -651,8 +624,7 @@ def LLVM_CallOp : LLVM_MemAccessOpBase<"call",
651
624
OpBuilder<(ins "LLVMFunctionType":$calleeType, "FlatSymbolRefAttr":$callee,
652
625
CArg<"ValueRange", "{}">:$args)>,
653
626
OpBuilder<(ins "LLVMFunctionType":$calleeType, "StringRef":$callee,
654
- CArg<"ValueRange", "{}">:$args)>,
655
- OpBuilder<(ins "Value":$callee, "ValueRange":$args)>
627
+ CArg<"ValueRange", "{}">:$args)>
656
628
];
657
629
let hasCustomAssemblyFormat = 1;
658
630
let extraClassDeclaration = [{
@@ -1636,7 +1608,7 @@ def LLVM_AtomicRMWOp : LLVM_MemAccessOpBase<"atomicrmw", [
1636
1608
TypesMatchWith<"result #0 and operand #1 have the same type",
1637
1609
"val", "res", "$_self">]> {
1638
1610
dag args = (ins AtomicBinOp:$bin_op,
1639
- LLVM_PointerTo<LLVM_AtomicRMWType> :$ptr,
1611
+ LLVM_AnyPointer :$ptr,
1640
1612
LLVM_AtomicRMWType:$val, AtomicOrdering:$ordering,
1641
1613
OptionalAttr<StrAttr>:$syncscope,
1642
1614
OptionalAttr<I64Attr>:$alignment,
@@ -1687,7 +1659,7 @@ def LLVM_AtomicCmpXchgOp : LLVM_MemAccessOpBase<"cmpxchg", [
1687
1659
TypesMatchWith<"result #0 has an LLVM struct type consisting of "
1688
1660
"the type of operand #2 and a bool", "val", "res",
1689
1661
"getValAndBoolStructType($_self)">]> {
1690
- dag args = (ins LLVM_PointerTo<LLVM_AtomicCmpXchgType> :$ptr,
1662
+ dag args = (ins LLVM_AnyPointer :$ptr,
1691
1663
LLVM_AtomicCmpXchgType:$cmp, LLVM_AtomicCmpXchgType:$val,
1692
1664
AtomicOrdering:$success_ordering,
1693
1665
AtomicOrdering:$failure_ordering,
0 commit comments