@@ -271,7 +271,7 @@ def LLVM_DILanguageParameter : LLVM_DIParameter<
271
271
>;
272
272
273
273
def LLVM_DITagParameter : LLVM_DIParameter<
274
- "tag", /*default=*/"", "Tag", /*errorCase=*/"llvm::dwarf::DW_TAG_invalid"
274
+ "tag", /*default=*/"0 ", "Tag", /*errorCase=*/"llvm::dwarf::DW_TAG_invalid"
275
275
>;
276
276
277
277
def LLVM_DIOperationEncodingParameter : LLVM_DIParameter<
@@ -375,14 +375,17 @@ def LLVM_DICompositeTypeAttr : LLVM_Attr<"DICompositeType", "di_composite_type",
375
375
[LLVM_DIRecursiveTypeAttrInterface],
376
376
"DITypeAttr"> {
377
377
let parameters = (ins
378
- LLVM_DITagParameter:$tag,
378
+ // DIRecursiveTypeAttrInterface specific parameters.
379
379
OptionalParameter<"DistinctAttr">:$recId,
380
+ OptionalParameter<"bool">:$isRecSelf,
381
+ // DICompositeType specific parameters.
382
+ LLVM_DITagParameter:$tag,
380
383
OptionalParameter<"StringAttr">:$name,
381
384
OptionalParameter<"DIFileAttr">:$file,
382
385
OptionalParameter<"uint32_t">:$line,
383
386
OptionalParameter<"DIScopeAttr">:$scope,
384
387
OptionalParameter<"DITypeAttr">:$baseType,
385
- OptionalParameter<"DIFlags", "DIFlags::Zero" >:$flags,
388
+ OptionalParameter<"DIFlags">:$flags,
386
389
OptionalParameter<"uint64_t">:$sizeInBits,
387
390
OptionalParameter<"uint64_t">:$alignInBits,
388
391
OptionalArrayRefParameter<"DINodeAttr">:$elements,
@@ -391,14 +394,26 @@ def LLVM_DICompositeTypeAttr : LLVM_Attr<"DICompositeType", "di_composite_type",
391
394
OptionalParameter<"DIExpressionAttr">:$allocated,
392
395
OptionalParameter<"DIExpressionAttr">:$associated
393
396
);
397
+ let builders = [
398
+ AttrBuilder<(ins
399
+ "unsigned":$tag, "StringAttr":$name, "DIFileAttr":$file,
400
+ "uint32_t":$line, "DIScopeAttr":$scope, "DITypeAttr":$baseType,
401
+ "DIFlags":$flags, "uint64_t":$sizeInBits, "uint64_t":$alignInBits,
402
+ "ArrayRef<DINodeAttr>":$elements, "DIExpressionAttr":$dataLocation,
403
+ "DIExpressionAttr":$rank, "DIExpressionAttr":$allocated,
404
+ "DIExpressionAttr":$associated
405
+ ), [{
406
+ return $_get($_ctxt, /*recId=*/nullptr, /*isRecSelf=*/nullptr,
407
+ tag, name, file, line, scope, baseType, flags, sizeInBits,
408
+ alignInBits, elements, dataLocation, rank, allocated,
409
+ associated);
410
+ }]>
411
+ ];
394
412
let assemblyFormat = "`<` struct(params) `>`";
395
413
let extraClassDeclaration = [{
396
414
/// Requirements of DIRecursiveTypeAttrInterface.
397
415
/// @{
398
416
399
- /// Get whether this attr describes a recursive self reference.
400
- bool isRecSelf() { return getTag() == 0; }
401
-
402
417
/// Get a copy of this type attr but with the recursive ID set to `recId`.
403
418
DIRecursiveTypeAttrInterface withRecId(DistinctAttr recId);
404
419
@@ -557,8 +572,11 @@ def LLVM_DISubprogramAttr : LLVM_Attr<"DISubprogram", "di_subprogram",
557
572
[LLVM_DIRecursiveTypeAttrInterface],
558
573
"DIScopeAttr"> {
559
574
let parameters = (ins
560
- OptionalParameter<"DistinctAttr">:$id,
575
+ // DIRecursiveTypeAttrInterface specific parameters.
561
576
OptionalParameter<"DistinctAttr">:$recId,
577
+ OptionalParameter<"bool">:$isRecSelf,
578
+ // DISubprogramAttr specific parameters.
579
+ OptionalParameter<"DistinctAttr">:$id,
562
580
OptionalParameter<"DICompileUnitAttr">:$compileUnit,
563
581
OptionalParameter<"DIScopeAttr">:$scope,
564
582
OptionalParameter<"StringAttr">:$name,
@@ -571,28 +589,23 @@ def LLVM_DISubprogramAttr : LLVM_Attr<"DISubprogram", "di_subprogram",
571
589
OptionalArrayRefParameter<"DINodeAttr">:$retainedNodes
572
590
);
573
591
let builders = [
574
- AttrBuilderWithInferredContext <(ins
592
+ AttrBuilder <(ins
575
593
"DistinctAttr":$id, "DICompileUnitAttr":$compileUnit,
576
- "DIScopeAttr":$scope, "StringRef ":$name, "StringRef ":$linkageName,
594
+ "DIScopeAttr":$scope, "StringAttr ":$name, "StringAttr ":$linkageName,
577
595
"DIFileAttr":$file, "unsigned":$line, "unsigned":$scopeLine,
578
596
"DISubprogramFlags":$subprogramFlags, "DISubroutineTypeAttr":$type,
579
597
"ArrayRef<DINodeAttr>":$retainedNodes
580
598
), [{
581
- MLIRContext *ctx = file.getContext();
582
- return $_get(ctx, id, /*recId=*/nullptr, compileUnit, scope,
583
- StringAttr::get(ctx, name),
584
- StringAttr::get(ctx, linkageName), file, line,
585
- scopeLine, subprogramFlags, type, retainedNodes);
599
+ return $_get($_ctxt, /*recId=*/nullptr, /*isRecSelf=*/false, id, compileUnit,
600
+ scope, name, linkageName, file, line, scopeLine,
601
+ subprogramFlags, type, retainedNodes);
586
602
}]>
587
603
];
588
604
let assemblyFormat = "`<` struct(params) `>`";
589
605
let extraClassDeclaration = [{
590
606
/// Requirements of DIRecursiveTypeAttrInterface.
591
607
/// @{
592
608
593
- /// Get whether this attr describes a recursive self reference.
594
- bool isRecSelf() { return !getScope(); }
595
-
596
609
/// Get a copy of this type attr but with the recursive ID set to `recId`.
597
610
DIRecursiveTypeAttrInterface withRecId(DistinctAttr recId);
598
611
0 commit comments