[llvm] 42b707e - [DWARF][M68k] Add new DW_CC for the new M68kRTD calling convention
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 15 16:14:54 PDT 2023
Author: Min-Yih Hsu
Date: 2023-10-15T16:13:05-07:00
New Revision: 42b707e5b438be538e3560429d0b4afcd7ca05be
URL: https://github.com/llvm/llvm-project/commit/42b707e5b438be538e3560429d0b4afcd7ca05be
DIFF: https://github.com/llvm/llvm-project/commit/42b707e5b438be538e3560429d0b4afcd7ca05be.diff
LOG: [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
Added:
llvm/test/DebugInfo/M68k/calling-convention.ll
llvm/test/DebugInfo/M68k/lit.local.cfg
Modified:
llvm/include/llvm/BinaryFormat/Dwarf.def
llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def
index 40d958c867de9b3..fb328a025773252 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.def
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -1036,6 +1036,7 @@ HANDLE_DW_CC(0xc8, LLVM_Swift)
HANDLE_DW_CC(0xc9, LLVM_PreserveMost)
HANDLE_DW_CC(0xca, LLVM_PreserveAll)
HANDLE_DW_CC(0xcb, LLVM_X86RegCall)
+HANDLE_DW_CC(0xcc, LLVM_M68kRTD)
// From GCC source code (include/dwarf2.h): This DW_CC_ value is not currently
// generated by any toolchain. It is used internally to GDB to indicate OpenCL
// C functions that have been compiled with the IBM XL C for OpenCL compiler and
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
index c474de60762653d..5a5ac28f1822115 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
@@ -620,6 +620,9 @@ void DWARFTypePrinter::appendSubroutineNameAfter(
case CallingConvention::DW_CC_LLVM_X86RegCall:
OS << " __attribute__((regcall))";
break;
+ case CallingConvention::DW_CC_LLVM_M68kRTD:
+ OS << " __attribute__((m68k_rtd))";
+ break;
}
}
diff --git a/llvm/test/DebugInfo/M68k/calling-convention.ll b/llvm/test/DebugInfo/M68k/calling-convention.ll
new file mode 100644
index 000000000000000..c6e8049771e4213
--- /dev/null
+++ b/llvm/test/DebugInfo/M68k/calling-convention.ll
@@ -0,0 +1,21 @@
+; RUN: llc --mtriple=m68k -filetype=obj %s -o %t
+; RUN: llvm-dwarfdump -v %t | FileCheck %s
+
+; CHECK-LABEL: DW_TAG_subprogram
+; CHECK: DW_AT_calling_convention [DW_FORM_data1] (DW_CC_LLVM_M68kRTD)
+define m68k_rtdcc void @foo() !dbg !3 {
+entry:
+ ret void
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2}
+
+!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)
+!1 = !DIFile(filename: "foo.c", directory: "/path/to/file")
+!2 = !{i32 2, !"Debug Info Version", i32 3}
+!3 = distinct !DISubprogram(name: "foo", scope: !4, file: !4, line: 4, type: !5, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !7)
+!4 = !DIFile(filename: "./foo.c", directory: "/path/to/file")
+!5 = !DISubroutineType(cc: DW_CC_LLVM_M68kRTD, types: !6)
+!6 = !{null}
+!7 = !{}
diff --git a/llvm/test/DebugInfo/M68k/lit.local.cfg b/llvm/test/DebugInfo/M68k/lit.local.cfg
new file mode 100644
index 000000000000000..dd33fe312cdd28b
--- /dev/null
+++ b/llvm/test/DebugInfo/M68k/lit.local.cfg
@@ -0,0 +1,2 @@
+if not "M68k" in config.root.targets:
+ config.unsupported = True
More information about the llvm-commits
mailing list