-
Notifications
You must be signed in to change notification settings - Fork 15.9k
[MLIR] Translate DIStringType. #94480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ba73e5e
cc9afc0
ba8bc45
f9ea69f
9e1f856
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -676,6 +676,21 @@ def LLVM_DILabelAttr : LLVM_Attr<"DILabel", "di_label", | |
| let assemblyFormat = "`<` struct(params) `>`"; | ||
| } | ||
|
|
||
| def LLVM_DIStringTypeAttr : LLVM_Attr<"DIStringType", "di_string_type", | ||
| /*traits=*/[], "DITypeAttr"> { | ||
| let parameters = (ins | ||
| LLVM_DITagParameter:$tag, | ||
| "StringAttr":$name, | ||
| OptionalParameter<"uint64_t">:$sizeInBits, | ||
| OptionalParameter<"uint64_t">:$alignInBits, | ||
abidh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| OptionalParameter<"DINodeAttr">:$stringLength, | ||
|
||
| OptionalParameter<"DIExpressionAttr">:$stringLengthExp, | ||
| OptionalParameter<"DIExpressionAttr">:$stringLocationExp, | ||
| LLVM_DIEncodingParameter:$encoding | ||
| ); | ||
| let assemblyFormat = "`<` struct(params) `>`"; | ||
| } | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // MemoryEffectsAttr | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -761,3 +761,35 @@ define void @class_field(ptr %arg1) !dbg !18 { | |
| !11 = !{!6, !7, !8} ; C -> A, B, C | ||
|
|
||
| !18 = distinct !DISubprogram(name: "SP", scope: !3, file: !2, spFlags: DISPFlagDefinition, unit: !1) | ||
|
|
||
| ; // ----- | ||
|
|
||
| ; Verify the string type is handled correctly | ||
|
|
||
| define void @string_type(ptr %arg1) { | ||
| call void @llvm.dbg.value(metadata ptr %arg1, metadata !4, metadata !DIExpression()), !dbg !10 | ||
| call void @llvm.dbg.value(metadata ptr %arg1, metadata !9, metadata !DIExpression()), !dbg !10 | ||
| ret void | ||
| } | ||
|
|
||
| !llvm.dbg.cu = !{!1} | ||
| !llvm.module.flags = !{!0} | ||
| !0 = !{i32 2, !"Debug Info Version", i32 3} | ||
| !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2) | ||
| !2 = !DIFile(filename: "debug-info.ll", directory: "/") | ||
| !3 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) | ||
| !4 = !DILocalVariable(scope: !5, name: "string_size", file: !2, type: !3); | ||
| !5 = distinct !DISubprogram(name: "class_field", scope: !2, file: !2, spFlags: DISPFlagDefinition, unit: !1) | ||
| !6 = !DIStringType(name: "character(*)", stringLength: !4, size: 32, align: 8, stringLengthExpression: !8, stringLocationExpression: !7) | ||
| !7 = !DIExpression(DW_OP_push_object_address, DW_OP_deref) | ||
| !8 = !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 8) | ||
| !9 = !DILocalVariable(scope: !5, name: "str", file: !2, type: !6); | ||
| !10 = !DILocation(line: 1, column: 2, scope: !5) | ||
|
|
||
| ; CHECK: #[[VAR:.+]] = #llvm.di_local_variable<{{.*}}name = "string_size"{{.*}}> | ||
| ; CHECK: #llvm.di_string_type<tag = DW_TAG_string_type, name = "character(*)" | ||
| ; CHECK-SAME: sizeInBits = 32 | ||
| ; CHECK-SAME: alignInBits = 8 | ||
| ; CHECK-SAME: stringLength = #[[VAR]] | ||
| ; CHECK-SAME: stringLengthExp = <[DW_OP_push_object_address, DW_OP_plus_uconst(8)]> | ||
| ; CHECK-SAME: stringLocationExp = <[DW_OP_push_object_address, DW_OP_deref]>> | ||
|
||
Uh oh!
There was an error while loading. Please reload this page.