[PATCH] D86218: Teach the swift calling convention about _Atomic types
Arnold Schwaighofer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 19 08:11:51 PDT 2020
aschwaighofer created this revision.
aschwaighofer added a reviewer: rjmccall.
Herald added subscribers: cfe-commits, jfb.
Herald added a project: clang.
aschwaighofer requested review of this revision.
rdar://67351073
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86218
Files:
clang/lib/CodeGen/SwiftCallingConv.cpp
clang/test/CodeGen/64bit-swiftcall.c
Index: clang/test/CodeGen/64bit-swiftcall.c
===================================================================
--- clang/test/CodeGen/64bit-swiftcall.c
+++ clang/test/CodeGen/64bit-swiftcall.c
@@ -1042,3 +1042,15 @@
// CHECK-NOT: call void @llvm.lifetime.
take_int5(return_int5());
}
+
+typedef struct {
+ unsigned long long a;
+ unsigned long long b;
+} double_word;
+
+typedef struct {
+ _Atomic(double_word) a;
+} atomic_double_word;
+
+// CHECK-LABEL: use_atomic(i64 %0, i64 %1)
+SWIFTCALL void use_atomic(atomic_double_word a) {}
Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===================================================================
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -62,9 +62,12 @@
void SwiftAggLowering::addTypedData(QualType type, CharUnits begin) {
// Deal with various aggregate types as special cases:
+ // Atomic types.
+ if (auto atomicType = type->getAs<AtomicType>()) {
+ addTypedData(atomicType->getValueType(), begin);
- // Record types.
- if (auto recType = type->getAs<RecordType>()) {
+ // Record types.
+ } else if (auto recType = type->getAs<RecordType>()) {
addTypedData(recType->getDecl(), begin);
// Array types.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86218.286563.patch
Type: text/x-patch
Size: 1244 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200819/5e410b9b/attachment.bin>
More information about the cfe-commits
mailing list