Skip to content

Commit f16964c

Browse files
varungandhi-appleetcwilde
authored andcommitted
[CodeGen] Introduce DWARF tag for SwiftTail and emit it in CodeGen.
swifttailcc is a new calling convention in LLVM introduced in https://reviews.llvm.org/D95443. We add a new DWARF tag to capture this in debuginfo. Differential Revision: https://reviews.llvm.org/D95704 (cherry-pick to apple/stable/20210107 from not-yet-merged revision)
1 parent 7ab4b18 commit f16964c

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,8 +1320,7 @@ static unsigned getDwarfCC(CallingConv CC) {
13201320
case CC_Swift:
13211321
return llvm::dwarf::DW_CC_LLVM_Swift;
13221322
case CC_SwiftAsync:
1323-
// [FIXME: swiftasynccc] Update to SwiftAsync once LLVM support lands.
1324-
return llvm::dwarf::DW_CC_LLVM_Swift;
1323+
return llvm::dwarf::DW_CC_LLVM_SwiftTail;
13251324
case CC_PreserveMost:
13261325
return llvm::dwarf::DW_CC_LLVM_PreserveMost;
13271326
case CC_PreserveAll:

clang/test/CodeGen/debug-info-cc.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ __attribute__((swiftcall)) int add_swiftcall(int a, int b) {
5757
return a+b;
5858
}
5959

60-
// [FIXME: swiftasynccc] Update debuginfo tag to SwiftAsync once LLVM support lands.
6160
// LINUX: !DISubprogram({{.*}}"add_swiftasynccall", {{.*}}type: ![[FTY:[0-9]+]]
62-
// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Swift,
63-
__attribute__((swiftasynccall)) int add_swiftasynccall(int a, int b, int c) {
64-
return a+b+c;
61+
// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_SwiftTail,
62+
__attribute__((swiftasynccall)) int add_swiftasynccall(int a, int b) {
63+
return a+b;
6564
}
6665

6766
// LINUX: !DISubprogram({{.*}}"add_inteloclbicc", {{.*}}type: ![[FTY:[0-9]+]]

llvm/include/llvm/BinaryFormat/Dwarf.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,7 @@ HANDLE_DW_CC(0xc8, LLVM_Swift)
993993
HANDLE_DW_CC(0xc9, LLVM_PreserveMost)
994994
HANDLE_DW_CC(0xca, LLVM_PreserveAll)
995995
HANDLE_DW_CC(0xcb, LLVM_X86RegCall)
996+
HANDLE_DW_CC(0xcc, LLVM_SwiftTail)
996997
// From GCC source code (include/dwarf2.h): This DW_CC_ value is not currently
997998
// generated by any toolchain. It is used internally to GDB to indicate OpenCL
998999
// C functions that have been compiled with the IBM XL C for OpenCL compiler and

0 commit comments

Comments
 (0)