1 | // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=LINUX |
2 | // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=WINDOWS |
3 | // RUN: %clang_cc1 -triple i386-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=LINUX32 |
4 | // RUN: %clang_cc1 -triple armv7--linux-gnueabihf -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=ARM |
5 | |
6 | // enum CallingConv { |
7 | // CC_C, // __attribute__((cdecl)) |
8 | // CC_X86StdCall, // __attribute__((stdcall)) |
9 | // CC_X86FastCall, // __attribute__((fastcall)) |
10 | // CC_X86ThisCall, // __attribute__((thiscall)) |
11 | // CC_X86VectorCall, // __attribute__((vectorcall)) |
12 | // CC_X86Pascal, // __attribute__((pascal)) |
13 | // CC_Win64, // __attribute__((ms_abi)) |
14 | // CC_X86_64SysV, // __attribute__((sysv_abi)) |
15 | // CC_X86RegCall, // __attribute__((regcall)) |
16 | // CC_AAPCS, // __attribute__((pcs("aapcs"))) |
17 | // CC_AAPCS_VFP, // __attribute__((pcs("aapcs-vfp"))) |
18 | // CC_IntelOclBicc, // __attribute__((intel_ocl_bicc)) |
19 | // CC_SpirFunction, // default for OpenCL functions on SPIR target |
20 | // CC_OpenCLKernel, // inferred for OpenCL kernels |
21 | // CC_Swift, // __attribute__((swiftcall)) |
22 | // CC_PreserveMost, // __attribute__((preserve_most)) |
23 | // CC_PreserveAll, // __attribute__((preserve_all)) |
24 | // }; |
25 | |
26 | #ifdef __x86_64__ |
27 | |
28 | #ifdef __linux__ |
29 | // LINUX: !DISubprogram({{.*}}"add_msabi", {{.*}}type: ![[FTY:[0-9]+]] |
30 | // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Win64, |
31 | __attribute__((ms_abi)) int add_msabi(int a, int b) { |
32 | return a+b; |
33 | } |
34 | |
35 | // LINUX: !DISubprogram({{.*}}"add_regcall", {{.*}}type: ![[FTY:[0-9]+]] |
36 | // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86RegCall, |
37 | __attribute__((regcall)) int add_regcall(int a, int b) { |
38 | return a+b; |
39 | } |
40 | |
41 | // LINUX: !DISubprogram({{.*}}"add_preserve_most", {{.*}}type: ![[FTY:[0-9]+]] |
42 | // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveMost, |
43 | __attribute__((preserve_most)) int add_preserve_most(int a, int b) { |
44 | return a+b; |
45 | } |
46 | |
47 | // LINUX: !DISubprogram({{.*}}"add_preserve_all", {{.*}}type: ![[FTY:[0-9]+]] |
48 | // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveAll, |
49 | __attribute__((preserve_all)) int add_preserve_all(int a, int b) { |
50 | return a+b; |
51 | } |
52 | |
53 | // LINUX: !DISubprogram({{.*}}"add_swiftcall", {{.*}}type: ![[FTY:[0-9]+]] |
54 | // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Swift, |
55 | __attribute__((swiftcall)) int add_swiftcall(int a, int b) { |
56 | return a+b; |
57 | } |
58 | |
59 | // LINUX: !DISubprogram({{.*}}"add_inteloclbicc", {{.*}}type: ![[FTY:[0-9]+]] |
60 | // LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_IntelOclBicc, |
61 | __attribute__((intel_ocl_bicc)) int add_inteloclbicc(int a, int b) { |
62 | return a+b; |
63 | } |
64 | #endif |
65 | |
66 | #ifdef _WIN64 |
67 | // WINDOWS: !DISubprogram({{.*}}"add_sysvabi", {{.*}}type: ![[FTY:[0-9]+]] |
68 | // WINDOWS: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86_64SysV, |
69 | __attribute__((sysv_abi)) int add_sysvabi(int a, int b) { |
70 | return a+b; |
71 | } |
72 | #endif |
73 | |
74 | #endif |
75 | |
76 | #ifdef __i386__ |
77 | // LINUX32: !DISubprogram({{.*}}"add_stdcall", {{.*}}type: ![[FTY:[0-9]+]] |
78 | // LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_stdcall, |
79 | __attribute__((stdcall)) int add_stdcall(int a, int b) { |
80 | return a+b; |
81 | } |
82 | |
83 | // LINUX32: !DISubprogram({{.*}}"add_fastcall", {{.*}}type: ![[FTY:[0-9]+]] |
84 | // LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_msfastcall, |
85 | __attribute__((fastcall)) int add_fastcall(int a, int b) { |
86 | return a+b; |
87 | } |
88 | |
89 | // LINUX32: !DISubprogram({{.*}}"add_thiscall", {{.*}}type: ![[FTY:[0-9]+]] |
90 | // LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_thiscall, |
91 | __attribute__((thiscall)) int add_thiscall(int a, int b) { |
92 | return a+b; |
93 | } |
94 | |
95 | // LINUX32: !DISubprogram({{.*}}"add_vectorcall", {{.*}}type: ![[FTY:[0-9]+]] |
96 | // LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_vectorcall, |
97 | __attribute__((vectorcall)) int add_vectorcall(int a, int b) { |
98 | return a+b; |
99 | } |
100 | |
101 | // LINUX32: !DISubprogram({{.*}}"add_pascal", {{.*}}type: ![[FTY:[0-9]+]] |
102 | // LINUX32: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_pascal, |
103 | __attribute__((pascal)) int add_pascal(int a, int b) { |
104 | return a+b; |
105 | } |
106 | #endif |
107 | |
108 | #ifdef __arm__ |
109 | // ARM: !DISubprogram({{.*}}"add_aapcs", {{.*}}type: ![[FTY:[0-9]+]] |
110 | // ARM: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_AAPCS, |
111 | __attribute__((pcs("aapcs"))) int add_aapcs(int a, int b) { |
112 | return a+b; |
113 | } |
114 | |
115 | // ARM: !DISubprogram({{.*}}"add_aapcs_vfp", {{.*}}type: ![[FTY:[0-9]+]] |
116 | // ARM: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_AAPCS_VFP, |
117 | __attribute__((pcs("aapcs-vfp"))) int add_aapcs_vfp(int a, int b) { |
118 | return a+b; |
119 | } |
120 | #endif |
121 | |