RuntimeLibcalls.h revision 210299
1193323Sed//===-- CodeGen/RuntimeLibcall.h - Runtime Library Calls --------*- C++ -*-===//
2193323Sed//
3193323Sed//                     The LLVM Compiler Infrastructure
4193323Sed//
5193323Sed// This file is distributed under the University of Illinois Open Source
6193323Sed// License. See LICENSE.TXT for details.
7193323Sed//
8193323Sed//===----------------------------------------------------------------------===//
9193323Sed//
10193323Sed// This file defines the enum representing the list of runtime library calls
11193323Sed// the backend may emit during code generation, and also some helper functions.
12193323Sed//
13193323Sed//===----------------------------------------------------------------------===//
14193323Sed
15193323Sed#ifndef LLVM_CODEGEN_RUNTIMELIBCALLS_H
16193323Sed#define LLVM_CODEGEN_RUNTIMELIBCALLS_H
17193323Sed
18193323Sed#include "llvm/CodeGen/ValueTypes.h"
19193323Sed
20193323Sednamespace llvm {
21193323Sednamespace RTLIB {
22193323Sed  /// RTLIB::Libcall enum - This enum defines all of the runtime library calls
23193323Sed  /// the backend can emit.  The various long double types cannot be merged,
24193323Sed  /// because 80-bit library functions use "xf" and 128-bit use "tf".
25193323Sed  ///
26193323Sed  /// When adding PPCF128 functions here, note that their names generally need
27193323Sed  /// to be overridden for Darwin with the xxx$LDBL128 form.  See
28193323Sed  /// PPCISelLowering.cpp.
29193323Sed  ///
30193323Sed  enum Libcall {
31193323Sed    // Integer
32193323Sed    SHL_I16,
33193323Sed    SHL_I32,
34193323Sed    SHL_I64,
35193323Sed    SHL_I128,
36193323Sed    SRL_I16,
37193323Sed    SRL_I32,
38193323Sed    SRL_I64,
39193323Sed    SRL_I128,
40193323Sed    SRA_I16,
41193323Sed    SRA_I32,
42193323Sed    SRA_I64,
43193323Sed    SRA_I128,
44199481Srdivacky    MUL_I8,
45193323Sed    MUL_I16,
46193323Sed    MUL_I32,
47193323Sed    MUL_I64,
48193323Sed    MUL_I128,
49199481Srdivacky    SDIV_I8,
50193323Sed    SDIV_I16,
51193323Sed    SDIV_I32,
52193323Sed    SDIV_I64,
53193323Sed    SDIV_I128,
54199481Srdivacky    UDIV_I8,
55193323Sed    UDIV_I16,
56193323Sed    UDIV_I32,
57193323Sed    UDIV_I64,
58193323Sed    UDIV_I128,
59199481Srdivacky    SREM_I8,
60193323Sed    SREM_I16,
61193323Sed    SREM_I32,
62193323Sed    SREM_I64,
63193323Sed    SREM_I128,
64199481Srdivacky    UREM_I8,
65193323Sed    UREM_I16,
66193323Sed    UREM_I32,
67193323Sed    UREM_I64,
68193323Sed    UREM_I128,
69193323Sed    NEG_I32,
70193323Sed    NEG_I64,
71193323Sed
72193323Sed    // FLOATING POINT
73193323Sed    ADD_F32,
74193323Sed    ADD_F64,
75193323Sed    ADD_F80,
76193323Sed    ADD_PPCF128,
77193323Sed    SUB_F32,
78193323Sed    SUB_F64,
79193323Sed    SUB_F80,
80193323Sed    SUB_PPCF128,
81193323Sed    MUL_F32,
82193323Sed    MUL_F64,
83193323Sed    MUL_F80,
84193323Sed    MUL_PPCF128,
85193323Sed    DIV_F32,
86193323Sed    DIV_F64,
87193323Sed    DIV_F80,
88193323Sed    DIV_PPCF128,
89193323Sed    REM_F32,
90193323Sed    REM_F64,
91193323Sed    REM_F80,
92193323Sed    REM_PPCF128,
93193323Sed    POWI_F32,
94193323Sed    POWI_F64,
95193323Sed    POWI_F80,
96193323Sed    POWI_PPCF128,
97193323Sed    SQRT_F32,
98193323Sed    SQRT_F64,
99193323Sed    SQRT_F80,
100193323Sed    SQRT_PPCF128,
101193323Sed    LOG_F32,
102193323Sed    LOG_F64,
103193323Sed    LOG_F80,
104193323Sed    LOG_PPCF128,
105193323Sed    LOG2_F32,
106193323Sed    LOG2_F64,
107193323Sed    LOG2_F80,
108193323Sed    LOG2_PPCF128,
109193323Sed    LOG10_F32,
110193323Sed    LOG10_F64,
111193323Sed    LOG10_F80,
112193323Sed    LOG10_PPCF128,
113193323Sed    EXP_F32,
114193323Sed    EXP_F64,
115193323Sed    EXP_F80,
116193323Sed    EXP_PPCF128,
117193323Sed    EXP2_F32,
118193323Sed    EXP2_F64,
119193323Sed    EXP2_F80,
120193323Sed    EXP2_PPCF128,
121193323Sed    SIN_F32,
122193323Sed    SIN_F64,
123193323Sed    SIN_F80,
124193323Sed    SIN_PPCF128,
125193323Sed    COS_F32,
126193323Sed    COS_F64,
127193323Sed    COS_F80,
128193323Sed    COS_PPCF128,
129193323Sed    POW_F32,
130193323Sed    POW_F64,
131193323Sed    POW_F80,
132193323Sed    POW_PPCF128,
133193323Sed    CEIL_F32,
134193323Sed    CEIL_F64,
135193323Sed    CEIL_F80,
136193323Sed    CEIL_PPCF128,
137193323Sed    TRUNC_F32,
138193323Sed    TRUNC_F64,
139193323Sed    TRUNC_F80,
140193323Sed    TRUNC_PPCF128,
141193323Sed    RINT_F32,
142193323Sed    RINT_F64,
143193323Sed    RINT_F80,
144193323Sed    RINT_PPCF128,
145193323Sed    NEARBYINT_F32,
146193323Sed    NEARBYINT_F64,
147193323Sed    NEARBYINT_F80,
148193323Sed    NEARBYINT_PPCF128,
149193323Sed    FLOOR_F32,
150193323Sed    FLOOR_F64,
151193323Sed    FLOOR_F80,
152193323Sed    FLOOR_PPCF128,
153205218Srdivacky    COPYSIGN_F32,
154205218Srdivacky    COPYSIGN_F64,
155205218Srdivacky    COPYSIGN_F80,
156205218Srdivacky    COPYSIGN_PPCF128,
157193323Sed
158193323Sed    // CONVERSION
159193323Sed    FPEXT_F32_F64,
160205218Srdivacky    FPEXT_F16_F32,
161205218Srdivacky    FPROUND_F32_F16,
162193323Sed    FPROUND_F64_F32,
163193323Sed    FPROUND_F80_F32,
164193323Sed    FPROUND_PPCF128_F32,
165193323Sed    FPROUND_F80_F64,
166193323Sed    FPROUND_PPCF128_F64,
167194612Sed    FPTOSINT_F32_I8,
168194612Sed    FPTOSINT_F32_I16,
169193323Sed    FPTOSINT_F32_I32,
170193323Sed    FPTOSINT_F32_I64,
171193323Sed    FPTOSINT_F32_I128,
172206083Srdivacky    FPTOSINT_F64_I8,
173206083Srdivacky    FPTOSINT_F64_I16,
174193323Sed    FPTOSINT_F64_I32,
175193323Sed    FPTOSINT_F64_I64,
176193323Sed    FPTOSINT_F64_I128,
177193323Sed    FPTOSINT_F80_I32,
178193323Sed    FPTOSINT_F80_I64,
179193323Sed    FPTOSINT_F80_I128,
180193323Sed    FPTOSINT_PPCF128_I32,
181193323Sed    FPTOSINT_PPCF128_I64,
182193323Sed    FPTOSINT_PPCF128_I128,
183194612Sed    FPTOUINT_F32_I8,
184194612Sed    FPTOUINT_F32_I16,
185193323Sed    FPTOUINT_F32_I32,
186193323Sed    FPTOUINT_F32_I64,
187193323Sed    FPTOUINT_F32_I128,
188206083Srdivacky    FPTOUINT_F64_I8,
189206083Srdivacky    FPTOUINT_F64_I16,
190193323Sed    FPTOUINT_F64_I32,
191193323Sed    FPTOUINT_F64_I64,
192193323Sed    FPTOUINT_F64_I128,
193193323Sed    FPTOUINT_F80_I32,
194193323Sed    FPTOUINT_F80_I64,
195193323Sed    FPTOUINT_F80_I128,
196193323Sed    FPTOUINT_PPCF128_I32,
197193323Sed    FPTOUINT_PPCF128_I64,
198193323Sed    FPTOUINT_PPCF128_I128,
199193323Sed    SINTTOFP_I32_F32,
200193323Sed    SINTTOFP_I32_F64,
201193323Sed    SINTTOFP_I32_F80,
202193323Sed    SINTTOFP_I32_PPCF128,
203193323Sed    SINTTOFP_I64_F32,
204193323Sed    SINTTOFP_I64_F64,
205193323Sed    SINTTOFP_I64_F80,
206193323Sed    SINTTOFP_I64_PPCF128,
207193323Sed    SINTTOFP_I128_F32,
208193323Sed    SINTTOFP_I128_F64,
209193323Sed    SINTTOFP_I128_F80,
210193323Sed    SINTTOFP_I128_PPCF128,
211193323Sed    UINTTOFP_I32_F32,
212193323Sed    UINTTOFP_I32_F64,
213193323Sed    UINTTOFP_I32_F80,
214193323Sed    UINTTOFP_I32_PPCF128,
215193323Sed    UINTTOFP_I64_F32,
216193323Sed    UINTTOFP_I64_F64,
217193323Sed    UINTTOFP_I64_F80,
218193323Sed    UINTTOFP_I64_PPCF128,
219193323Sed    UINTTOFP_I128_F32,
220193323Sed    UINTTOFP_I128_F64,
221193323Sed    UINTTOFP_I128_F80,
222193323Sed    UINTTOFP_I128_PPCF128,
223193323Sed
224193323Sed    // COMPARISON
225193323Sed    OEQ_F32,
226193323Sed    OEQ_F64,
227193323Sed    UNE_F32,
228193323Sed    UNE_F64,
229193323Sed    OGE_F32,
230193323Sed    OGE_F64,
231193323Sed    OLT_F32,
232193323Sed    OLT_F64,
233193323Sed    OLE_F32,
234193323Sed    OLE_F64,
235193323Sed    OGT_F32,
236193323Sed    OGT_F64,
237193323Sed    UO_F32,
238193323Sed    UO_F64,
239193323Sed    O_F32,
240193323Sed    O_F64,
241193323Sed
242198090Srdivacky    // MEMORY
243198090Srdivacky    MEMCPY,
244198090Srdivacky    MEMSET,
245198090Srdivacky    MEMMOVE,
246198090Srdivacky
247193323Sed    // EXCEPTION HANDLING
248193323Sed    UNWIND_RESUME,
249193323Sed
250210299Sed    // Family ATOMICs
251210299Sed    SYNC_VAL_COMPARE_AND_SWAP_1,
252210299Sed    SYNC_VAL_COMPARE_AND_SWAP_2,
253210299Sed    SYNC_VAL_COMPARE_AND_SWAP_4,
254210299Sed    SYNC_VAL_COMPARE_AND_SWAP_8,
255210299Sed    SYNC_LOCK_TEST_AND_SET_1,
256210299Sed    SYNC_LOCK_TEST_AND_SET_2,
257210299Sed    SYNC_LOCK_TEST_AND_SET_4,
258210299Sed    SYNC_LOCK_TEST_AND_SET_8,
259210299Sed    SYNC_FETCH_AND_ADD_1,
260210299Sed    SYNC_FETCH_AND_ADD_2,
261210299Sed    SYNC_FETCH_AND_ADD_4,
262210299Sed    SYNC_FETCH_AND_ADD_8,
263210299Sed    SYNC_FETCH_AND_SUB_1,
264210299Sed    SYNC_FETCH_AND_SUB_2,
265210299Sed    SYNC_FETCH_AND_SUB_4,
266210299Sed    SYNC_FETCH_AND_SUB_8,
267210299Sed    SYNC_FETCH_AND_AND_1,
268210299Sed    SYNC_FETCH_AND_AND_2,
269210299Sed    SYNC_FETCH_AND_AND_4,
270210299Sed    SYNC_FETCH_AND_AND_8,
271210299Sed    SYNC_FETCH_AND_OR_1,
272210299Sed    SYNC_FETCH_AND_OR_2,
273210299Sed    SYNC_FETCH_AND_OR_4,
274210299Sed    SYNC_FETCH_AND_OR_8,
275210299Sed    SYNC_FETCH_AND_XOR_1,
276210299Sed    SYNC_FETCH_AND_XOR_2,
277210299Sed    SYNC_FETCH_AND_XOR_4,
278210299Sed    SYNC_FETCH_AND_XOR_8,
279210299Sed    SYNC_FETCH_AND_NAND_1,
280210299Sed    SYNC_FETCH_AND_NAND_2,
281210299Sed    SYNC_FETCH_AND_NAND_4,
282210299Sed    SYNC_FETCH_AND_NAND_8,
283210299Sed
284193323Sed    UNKNOWN_LIBCALL
285193323Sed  };
286193323Sed
287193323Sed  /// getFPEXT - Return the FPEXT_*_* value for the given types, or
288193323Sed  /// UNKNOWN_LIBCALL if there is none.
289198090Srdivacky  Libcall getFPEXT(EVT OpVT, EVT RetVT);
290193323Sed
291193323Sed  /// getFPROUND - Return the FPROUND_*_* value for the given types, or
292193323Sed  /// UNKNOWN_LIBCALL if there is none.
293198090Srdivacky  Libcall getFPROUND(EVT OpVT, EVT RetVT);
294193323Sed
295193323Sed  /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
296193323Sed  /// UNKNOWN_LIBCALL if there is none.
297198090Srdivacky  Libcall getFPTOSINT(EVT OpVT, EVT RetVT);
298193323Sed
299193323Sed  /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
300193323Sed  /// UNKNOWN_LIBCALL if there is none.
301198090Srdivacky  Libcall getFPTOUINT(EVT OpVT, EVT RetVT);
302193323Sed
303193323Sed  /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
304193323Sed  /// UNKNOWN_LIBCALL if there is none.
305198090Srdivacky  Libcall getSINTTOFP(EVT OpVT, EVT RetVT);
306193323Sed
307193323Sed  /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
308193323Sed  /// UNKNOWN_LIBCALL if there is none.
309198090Srdivacky  Libcall getUINTTOFP(EVT OpVT, EVT RetVT);
310193323Sed}
311193323Sed}
312193323Sed
313193323Sed#endif
314