Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DebugInfo] convert btf_tag attrs to DI annotations for DISubprograms
Generate btf_tag annotations for DISubprograms. The annotations are represented as an DINodeArray in DebugInfo. Differential Revision: https://reviews.llvm.org/D106618
- Loading branch information
1 parent
a8125bf
commit 2de051b
Showing
3 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// REQUIRES: x86-registered-target | ||
// RUN: %clang -target x86_64 -g -S -O2 -emit-llvm -o - %s | FileCheck %s | ||
|
||
#define __tag1 __attribute__((btf_tag("tag1"))) | ||
#define __tag2 __attribute__((btf_tag("tag2"))) | ||
|
||
struct t1 { | ||
int a; | ||
}; | ||
|
||
extern int __tag1 __tag2 foo(struct t1 *); | ||
int foo2(struct t1 *arg) { | ||
return foo(arg); | ||
} | ||
|
||
// CHECK: ![[#]] = !DISubprogram(name: "foo", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: ![[#]], annotations: ![[ANNOT:[0-9]+]]) | ||
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]} | ||
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"} | ||
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// REQUIRES: x86-registered-target | ||
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s | ||
|
||
#define __tag1 __attribute__((btf_tag("tag1"))) | ||
#define __tag2 __attribute__((btf_tag("tag2"))) | ||
|
||
struct t1 { | ||
int a; | ||
}; | ||
|
||
int __tag1 __tag2 foo(struct t1 *arg) { | ||
return arg->a; | ||
} | ||
|
||
// CHECK: distinct !DISubprogram(name: "foo", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], scopeLine: [[#]], flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: ![[#]], retainedNodes: ![[#]], annotations: ![[ANNOT:[0-9]+]]) | ||
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]} | ||
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"} | ||
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"} | ||
|
||
int __tag1 __tag2 foo2(struct t1 *arg); | ||
int foo2(struct t1 *arg) { | ||
return arg->a; | ||
} | ||
|
||
// CHECK: distinct !DISubprogram(name: "foo2", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], scopeLine: [[#]], flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: ![[#]], retainedNodes: ![[#]], annotations: ![[ANNOT]]) | ||
|
||
int __tag1 foo3(struct t1 *arg); | ||
int __tag2 foo3(struct t1 *arg) { | ||
return arg->a; | ||
} | ||
|
||
// CHECK: distinct !DISubprogram(name: "foo3", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], scopeLine: [[#]], flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: ![[#]], retainedNodes: ![[#]], annotations: ![[ANNOT]]) | ||
|
||
int __tag1 foo4(struct t1 *arg); | ||
int __tag2 foo4(struct t1 *arg); | ||
int foo4(struct t1 *arg) { | ||
return arg->a; | ||
} | ||
|
||
// CHECK: distinct !DISubprogram(name: "foo4", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], scopeLine: [[#]], flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: ![[#]], retainedNodes: ![[#]], annotations: ![[ANNOT]]) |