@@ -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)>,
@@ -306,22 +281,19 @@ def LLVM_GEPOp : LLVM_Op<"getelementptr", [Pure,
306
281
indices.push_back(
307
282
builder.getInt32(valueOrAttr.get<IntegerAttr>().getInt()));
308
283
}
309
- Type baseElementType = op.getSourceElementType ();
284
+ Type baseElementType = op.getElemType ();
310
285
llvm::Type *elementType = moduleTranslation.convertType(baseElementType);
311
286
$res = builder.CreateGEP(elementType, $base, indices, "", $inbounds);
312
287
}];
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 = [{
320
295
constexpr static int32_t kDynamicIndex = std::numeric_limits<int32_t>::min();
321
296
322
- /// Returns the type pointed to by the pointer argument of this GEP.
323
- Type getSourceElementType();
324
-
325
297
GEPIndicesAdaptor<ValueRange> getIndices();
326
298
}];
327
299
let hasFolder = 1;
@@ -332,7 +304,7 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
332
304
[DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
333
305
DeclareOpInterfaceMethods<PromotableMemOpInterface>,
334
306
DeclareOpInterfaceMethods<SafeMemorySlotAccessOpInterface>]> {
335
- dag args = (ins LLVM_PointerTo<LLVM_LoadableType> :$addr,
307
+ dag args = (ins LLVM_AnyPointer :$addr,
336
308
OptionalAttr<I64Attr>:$alignment,
337
309
UnitAttr:$volatile_,
338
310
UnitAttr:$nontemporal,
@@ -370,7 +342,7 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
370
342
let assemblyFormat = [{
371
343
(`volatile` $volatile_^)? $addr
372
344
(`atomic` (`syncscope` `(` $syncscope^ `)`)? $ordering^)?
373
- attr-dict `:` custom<LoadType> (type($addr), type($res) )
345
+ attr-dict `:` qualified (type($addr)) `->` type($res)
374
346
}];
375
347
string llvmBuilder = [{
376
348
auto *inst = builder.CreateLoad($_resultType, $addr, $volatile_);
@@ -391,9 +363,6 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
391
363
getLLVMSyncScope(loadInst));
392
364
}];
393
365
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
366
OpBuilder<(ins "Type":$type, "Value":$addr,
398
367
CArg<"unsigned", "0">:$alignment, CArg<"bool", "false">:$isVolatile,
399
368
CArg<"bool", "false">:$isNonTemporal,
@@ -408,7 +377,7 @@ def LLVM_StoreOp : LLVM_MemAccessOpBase<"store",
408
377
DeclareOpInterfaceMethods<PromotableMemOpInterface>,
409
378
DeclareOpInterfaceMethods<SafeMemorySlotAccessOpInterface>]> {
410
379
dag args = (ins LLVM_LoadableType:$value,
411
- LLVM_PointerTo<LLVM_LoadableType> :$addr,
380
+ LLVM_AnyPointer :$addr,
412
381
OptionalAttr<I64Attr>:$alignment,
413
382
UnitAttr:$volatile_,
414
383
UnitAttr:$nontemporal,
@@ -445,7 +414,7 @@ def LLVM_StoreOp : LLVM_MemAccessOpBase<"store",
445
414
let assemblyFormat = [{
446
415
(`volatile` $volatile_^)? $value `,` $addr
447
416
(`atomic` (`syncscope` `(` $syncscope^ `)`)? $ordering^)?
448
- attr-dict `:` custom<StoreType>( type($value), type($addr))
417
+ attr-dict `:` type($value) `,` qualified( type($addr))
449
418
}];
450
419
string llvmBuilder = [{
451
420
auto *inst = builder.CreateStore($value, $addr, $volatile_);
@@ -651,8 +620,7 @@ def LLVM_CallOp : LLVM_MemAccessOpBase<"call",
651
620
OpBuilder<(ins "LLVMFunctionType":$calleeType, "FlatSymbolRefAttr":$callee,
652
621
CArg<"ValueRange", "{}">:$args)>,
653
622
OpBuilder<(ins "LLVMFunctionType":$calleeType, "StringRef":$callee,
654
- CArg<"ValueRange", "{}">:$args)>,
655
- OpBuilder<(ins "Value":$callee, "ValueRange":$args)>
623
+ CArg<"ValueRange", "{}">:$args)>
656
624
];
657
625
let hasCustomAssemblyFormat = 1;
658
626
let extraClassDeclaration = [{
@@ -1636,7 +1604,7 @@ def LLVM_AtomicRMWOp : LLVM_MemAccessOpBase<"atomicrmw", [
1636
1604
TypesMatchWith<"result #0 and operand #1 have the same type",
1637
1605
"val", "res", "$_self">]> {
1638
1606
dag args = (ins AtomicBinOp:$bin_op,
1639
- LLVM_PointerTo<LLVM_AtomicRMWType> :$ptr,
1607
+ LLVM_AnyPointer :$ptr,
1640
1608
LLVM_AtomicRMWType:$val, AtomicOrdering:$ordering,
1641
1609
OptionalAttr<StrAttr>:$syncscope,
1642
1610
OptionalAttr<I64Attr>:$alignment,
@@ -1687,7 +1655,7 @@ def LLVM_AtomicCmpXchgOp : LLVM_MemAccessOpBase<"cmpxchg", [
1687
1655
TypesMatchWith<"result #0 has an LLVM struct type consisting of "
1688
1656
"the type of operand #2 and a bool", "val", "res",
1689
1657
"getValAndBoolStructType($_self)">]> {
1690
- dag args = (ins LLVM_PointerTo<LLVM_AtomicCmpXchgType> :$ptr,
1658
+ dag args = (ins LLVM_AnyPointer :$ptr,
1691
1659
LLVM_AtomicCmpXchgType:$cmp, LLVM_AtomicCmpXchgType:$val,
1692
1660
AtomicOrdering:$success_ordering,
1693
1661
AtomicOrdering:$failure_ordering,
0 commit comments