summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2018-01-05 01:13:37 +0000
committerAdrian Prantl <aprantl@apple.com>2018-01-05 01:13:37 +0000
commita29aac7b774d1fec7033f6d0fdfaf919e97e8492 (patch)
tree5e587194de1e42c151a402551dd4539375bb90be /llvm/lib/CodeGen
parent0429ebfabc4275a0f4cc120bb69e2ea317af3cfa (diff)
downloadbcm5719-llvm-a29aac7b774d1fec7033f6d0fdfaf919e97e8492.tar.gz
bcm5719-llvm-a29aac7b774d1fec7033f6d0fdfaf919e97e8492.zip
Debug Info: Support DW_AT_calling_convention on composite types.
This implements the DWARF 5 feature described at http://www.dwarfstd.org/ShowIssue.php?issue=141215.1 This allows a consumer to understand whether a composite data type is trivially copyable and thus should be passed by value instead of by reference. The canonical example is being able to distinguish the following two types: // S is not trivially copyable because of the explicit destructor. struct S { ~S() {} }; // T is a POD type. struct T { ~T() = default; }; This patch adds two new (DI)flags to LLVM metadata: TypePassByValue and TypePassByReference. <rdar://problem/36034922> Differential Revision: https://reviews.llvm.org/D41743 llvm-svn: 321844
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 911e4623578..8a9d95c1e04 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -975,6 +975,15 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type)
addTemplateParams(Buffer, CTy->getTemplateParams());
+ // Add the type's non-standard calling convention.
+ uint8_t CC = 0;
+ if (CTy->isTypePassByValue())
+ CC = dwarf::DW_CC_pass_by_value;
+ else if (CTy->isTypePassByReference())
+ CC = dwarf::DW_CC_pass_by_reference;
+ if (CC)
+ addUInt(Buffer, dwarf::DW_AT_calling_convention, dwarf::DW_FORM_data1,
+ CC);
break;
}
default:
OpenPOWER on IntegriCloud