Debian Codegraph @

clang/test/DebugInfo/Generic/cc.c

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