| 1 |
// RUN: %clang_cc1 -triple x86_64-unknown-windows -emit-llvm -target-cpu core2 -o - %s | FileCheck %s |
| 2 |
|
| 3 |
#define SWIFTCALL __attribute__((swiftcall)) |
| 4 |
#define OUT __attribute__((swift_indirect_result)) |
| 5 |
#define ERROR __attribute__((swift_error_result)) |
| 6 |
#define CONTEXT __attribute__((swift_context)) |
| 7 |
|
| 8 |
/*****************************************************************************/ |
| 9 |
/****************************** PARAMETER ABIS *******************************/ |
| 10 |
/*****************************************************************************/ |
| 11 |
|
| 12 |
// Swift doesn't use inalloca like windows x86 normally does. |
| 13 |
struct NonTrivial { |
| 14 |
NonTrivial(); |
| 15 |
NonTrivial(const NonTrivial &); |
| 16 |
int o; |
| 17 |
}; |
| 18 |
|
| 19 |
SWIFTCALL int receiveNonTrivial(NonTrivial o) { return o.o; } |
| 20 |
|
| 21 |
// CHECK-LABEL: define dso_local swiftcc noundef i32 @"?receiveNonTrivial@@YSHUNonTrivial@@@Z"(ptr dead_on_return noundef %o) |
| 22 |
|
| 23 |
int passNonTrivial() { |
| 24 |
return receiveNonTrivial({}); |
| 25 |
} |
| 26 |
|
| 27 |
// CHECK-LABEL: define dso_local noundef i32 @"?passNonTrivial@@YAHXZ"() |
| 28 |
// CHECK-NOT: stacksave |
| 29 |
// CHECK: call swiftcc noundef i32 @"?receiveNonTrivial@@YSHUNonTrivial@@@Z"(ptr dead_on_return noundef %{{.*}}) |