Skip to content

Commit 42b707e

Browse files
committed
[DWARF][M68k] Add new DW_CC for the new M68kRTD calling convention
Add `DW_CC_M68kRTD` to model the new `llvm::CallingConv::M68kRTD`. Differential Revision: https://reviews.llvm.org/D152587
1 parent fd84b1a commit 42b707e

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

llvm/include/llvm/BinaryFormat/Dwarf.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ HANDLE_DW_CC(0xc8, LLVM_Swift)
10361036
HANDLE_DW_CC(0xc9, LLVM_PreserveMost)
10371037
HANDLE_DW_CC(0xca, LLVM_PreserveAll)
10381038
HANDLE_DW_CC(0xcb, LLVM_X86RegCall)
1039+
HANDLE_DW_CC(0xcc, LLVM_M68kRTD)
10391040
// From GCC source code (include/dwarf2.h): This DW_CC_ value is not currently
10401041
// generated by any toolchain. It is used internally to GDB to indicate OpenCL
10411042
// C functions that have been compiled with the IBM XL C for OpenCL compiler and

llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,9 @@ void DWARFTypePrinter::appendSubroutineNameAfter(
620620
case CallingConvention::DW_CC_LLVM_X86RegCall:
621621
OS << " __attribute__((regcall))";
622622
break;
623+
case CallingConvention::DW_CC_LLVM_M68kRTD:
624+
OS << " __attribute__((m68k_rtd))";
625+
break;
623626
}
624627
}
625628

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc --mtriple=m68k -filetype=obj %s -o %t
2+
; RUN: llvm-dwarfdump -v %t | FileCheck %s
3+
4+
; CHECK-LABEL: DW_TAG_subprogram
5+
; CHECK: DW_AT_calling_convention [DW_FORM_data1] (DW_CC_LLVM_M68kRTD)
6+
define m68k_rtdcc void @foo() !dbg !3 {
7+
entry:
8+
ret void
9+
}
10+
11+
!llvm.dbg.cu = !{!0}
12+
!llvm.module.flags = !{!2}
13+
14+
!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 17.0.0 (https://github.com/llvm/llvm-project.git)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
15+
!1 = !DIFile(filename: "foo.c", directory: "/path/to/file")
16+
!2 = !{i32 2, !"Debug Info Version", i32 3}
17+
!3 = distinct !DISubprogram(name: "foo", scope: !4, file: !4, line: 4, type: !5, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !7)
18+
!4 = !DIFile(filename: "./foo.c", directory: "/path/to/file")
19+
!5 = !DISubroutineType(cc: DW_CC_LLVM_M68kRTD, types: !6)
20+
!6 = !{null}
21+
!7 = !{}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if not "M68k" in config.root.targets:
2+
config.unsupported = True

0 commit comments

Comments
 (0)