• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- CodeGen/RuntimeLibcalls.h - Runtime Library Calls -------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the enum representing the list of runtime library calls
11 // the backend may emit during code generation, and also some helper functions.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CODEGEN_RUNTIMELIBCALLS_H
16 #define LLVM_CODEGEN_RUNTIMELIBCALLS_H
17 
18 #include "llvm/CodeGen/ValueTypes.h"
19 
20 namespace llvm {
21 namespace RTLIB {
22   /// RTLIB::Libcall enum - This enum defines all of the runtime library calls
23   /// the backend can emit.  The various long double types cannot be merged,
24   /// because 80-bit library functions use "xf" and 128-bit use "tf".
25   ///
26   /// When adding PPCF128 functions here, note that their names generally need
27   /// to be overridden for Darwin with the xxx$LDBL128 form.  See
28   /// PPCISelLowering.cpp.
29   ///
30   enum Libcall {
31     // Integer
32     SHL_I16,
33     SHL_I32,
34     SHL_I64,
35     SHL_I128,
36     SRL_I16,
37     SRL_I32,
38     SRL_I64,
39     SRL_I128,
40     SRA_I16,
41     SRA_I32,
42     SRA_I64,
43     SRA_I128,
44     MUL_I8,
45     MUL_I16,
46     MUL_I32,
47     MUL_I64,
48     MUL_I128,
49     MULO_I32,
50     MULO_I64,
51     MULO_I128,
52     SDIV_I8,
53     SDIV_I16,
54     SDIV_I32,
55     SDIV_I64,
56     SDIV_I128,
57     UDIV_I8,
58     UDIV_I16,
59     UDIV_I32,
60     UDIV_I64,
61     UDIV_I128,
62     SREM_I8,
63     SREM_I16,
64     SREM_I32,
65     SREM_I64,
66     SREM_I128,
67     UREM_I8,
68     UREM_I16,
69     UREM_I32,
70     UREM_I64,
71     UREM_I128,
72     SDIVREM_I8,
73     SDIVREM_I16,
74     SDIVREM_I32,
75     SDIVREM_I64,
76     SDIVREM_I128,
77     UDIVREM_I8,
78     UDIVREM_I16,
79     UDIVREM_I32,
80     UDIVREM_I64,
81     UDIVREM_I128,
82     NEG_I32,
83     NEG_I64,
84 
85     // FLOATING POINT
86     ADD_F32,
87     ADD_F64,
88     ADD_F80,
89     ADD_F128,
90     ADD_PPCF128,
91     SUB_F32,
92     SUB_F64,
93     SUB_F80,
94     SUB_F128,
95     SUB_PPCF128,
96     MUL_F32,
97     MUL_F64,
98     MUL_F80,
99     MUL_F128,
100     MUL_PPCF128,
101     DIV_F32,
102     DIV_F64,
103     DIV_F80,
104     DIV_F128,
105     DIV_PPCF128,
106     REM_F32,
107     REM_F64,
108     REM_F80,
109     REM_F128,
110     REM_PPCF128,
111     FMA_F32,
112     FMA_F64,
113     FMA_F80,
114     FMA_F128,
115     FMA_PPCF128,
116     POWI_F32,
117     POWI_F64,
118     POWI_F80,
119     POWI_F128,
120     POWI_PPCF128,
121     SQRT_F32,
122     SQRT_F64,
123     SQRT_F80,
124     SQRT_F128,
125     SQRT_PPCF128,
126     LOG_F32,
127     LOG_F64,
128     LOG_F80,
129     LOG_F128,
130     LOG_PPCF128,
131     LOG2_F32,
132     LOG2_F64,
133     LOG2_F80,
134     LOG2_F128,
135     LOG2_PPCF128,
136     LOG10_F32,
137     LOG10_F64,
138     LOG10_F80,
139     LOG10_F128,
140     LOG10_PPCF128,
141     EXP_F32,
142     EXP_F64,
143     EXP_F80,
144     EXP_F128,
145     EXP_PPCF128,
146     EXP2_F32,
147     EXP2_F64,
148     EXP2_F80,
149     EXP2_F128,
150     EXP2_PPCF128,
151     SIN_F32,
152     SIN_F64,
153     SIN_F80,
154     SIN_F128,
155     SIN_PPCF128,
156     COS_F32,
157     COS_F64,
158     COS_F80,
159     COS_F128,
160     COS_PPCF128,
161     SINCOS_F32,
162     SINCOS_F64,
163     SINCOS_F80,
164     SINCOS_F128,
165     SINCOS_PPCF128,
166     POW_F32,
167     POW_F64,
168     POW_F80,
169     POW_F128,
170     POW_PPCF128,
171     CEIL_F32,
172     CEIL_F64,
173     CEIL_F80,
174     CEIL_F128,
175     CEIL_PPCF128,
176     TRUNC_F32,
177     TRUNC_F64,
178     TRUNC_F80,
179     TRUNC_F128,
180     TRUNC_PPCF128,
181     RINT_F32,
182     RINT_F64,
183     RINT_F80,
184     RINT_F128,
185     RINT_PPCF128,
186     NEARBYINT_F32,
187     NEARBYINT_F64,
188     NEARBYINT_F80,
189     NEARBYINT_F128,
190     NEARBYINT_PPCF128,
191     ROUND_F32,
192     ROUND_F64,
193     ROUND_F80,
194     ROUND_F128,
195     ROUND_PPCF128,
196     FLOOR_F32,
197     FLOOR_F64,
198     FLOOR_F80,
199     FLOOR_F128,
200     FLOOR_PPCF128,
201     COPYSIGN_F32,
202     COPYSIGN_F64,
203     COPYSIGN_F80,
204     COPYSIGN_F128,
205     COPYSIGN_PPCF128,
206     FMIN_F32,
207     FMIN_F64,
208     FMIN_F80,
209     FMIN_F128,
210     FMIN_PPCF128,
211     FMAX_F32,
212     FMAX_F64,
213     FMAX_F80,
214     FMAX_F128,
215     FMAX_PPCF128,
216 
217     // CONVERSION
218     FPEXT_F64_F128,
219     FPEXT_F32_F128,
220     FPEXT_F32_F64,
221     FPEXT_F16_F32,
222     FPROUND_F32_F16,
223     FPROUND_F64_F16,
224     FPROUND_F80_F16,
225     FPROUND_F128_F16,
226     FPROUND_PPCF128_F16,
227     FPROUND_F64_F32,
228     FPROUND_F80_F32,
229     FPROUND_F128_F32,
230     FPROUND_PPCF128_F32,
231     FPROUND_F80_F64,
232     FPROUND_F128_F64,
233     FPROUND_PPCF128_F64,
234     FPTOSINT_F32_I32,
235     FPTOSINT_F32_I64,
236     FPTOSINT_F32_I128,
237     FPTOSINT_F64_I32,
238     FPTOSINT_F64_I64,
239     FPTOSINT_F64_I128,
240     FPTOSINT_F80_I32,
241     FPTOSINT_F80_I64,
242     FPTOSINT_F80_I128,
243     FPTOSINT_F128_I32,
244     FPTOSINT_F128_I64,
245     FPTOSINT_F128_I128,
246     FPTOSINT_PPCF128_I32,
247     FPTOSINT_PPCF128_I64,
248     FPTOSINT_PPCF128_I128,
249     FPTOUINT_F32_I32,
250     FPTOUINT_F32_I64,
251     FPTOUINT_F32_I128,
252     FPTOUINT_F64_I32,
253     FPTOUINT_F64_I64,
254     FPTOUINT_F64_I128,
255     FPTOUINT_F80_I32,
256     FPTOUINT_F80_I64,
257     FPTOUINT_F80_I128,
258     FPTOUINT_F128_I32,
259     FPTOUINT_F128_I64,
260     FPTOUINT_F128_I128,
261     FPTOUINT_PPCF128_I32,
262     FPTOUINT_PPCF128_I64,
263     FPTOUINT_PPCF128_I128,
264     SINTTOFP_I32_F32,
265     SINTTOFP_I32_F64,
266     SINTTOFP_I32_F80,
267     SINTTOFP_I32_F128,
268     SINTTOFP_I32_PPCF128,
269     SINTTOFP_I64_F32,
270     SINTTOFP_I64_F64,
271     SINTTOFP_I64_F80,
272     SINTTOFP_I64_F128,
273     SINTTOFP_I64_PPCF128,
274     SINTTOFP_I128_F32,
275     SINTTOFP_I128_F64,
276     SINTTOFP_I128_F80,
277     SINTTOFP_I128_F128,
278     SINTTOFP_I128_PPCF128,
279     UINTTOFP_I32_F32,
280     UINTTOFP_I32_F64,
281     UINTTOFP_I32_F80,
282     UINTTOFP_I32_F128,
283     UINTTOFP_I32_PPCF128,
284     UINTTOFP_I64_F32,
285     UINTTOFP_I64_F64,
286     UINTTOFP_I64_F80,
287     UINTTOFP_I64_F128,
288     UINTTOFP_I64_PPCF128,
289     UINTTOFP_I128_F32,
290     UINTTOFP_I128_F64,
291     UINTTOFP_I128_F80,
292     UINTTOFP_I128_F128,
293     UINTTOFP_I128_PPCF128,
294 
295     // COMPARISON
296     OEQ_F32,
297     OEQ_F64,
298     OEQ_F128,
299     UNE_F32,
300     UNE_F64,
301     UNE_F128,
302     OGE_F32,
303     OGE_F64,
304     OGE_F128,
305     OLT_F32,
306     OLT_F64,
307     OLT_F128,
308     OLE_F32,
309     OLE_F64,
310     OLE_F128,
311     OGT_F32,
312     OGT_F64,
313     OGT_F128,
314     UO_F32,
315     UO_F64,
316     UO_F128,
317     O_F32,
318     O_F64,
319     O_F128,
320 
321     // MEMORY
322     MEMCPY,
323     MEMSET,
324     MEMMOVE,
325 
326     // EXCEPTION HANDLING
327     UNWIND_RESUME,
328 
329     // Family ATOMICs
330     SYNC_VAL_COMPARE_AND_SWAP_1,
331     SYNC_VAL_COMPARE_AND_SWAP_2,
332     SYNC_VAL_COMPARE_AND_SWAP_4,
333     SYNC_VAL_COMPARE_AND_SWAP_8,
334     SYNC_VAL_COMPARE_AND_SWAP_16,
335     SYNC_LOCK_TEST_AND_SET_1,
336     SYNC_LOCK_TEST_AND_SET_2,
337     SYNC_LOCK_TEST_AND_SET_4,
338     SYNC_LOCK_TEST_AND_SET_8,
339     SYNC_LOCK_TEST_AND_SET_16,
340     SYNC_FETCH_AND_ADD_1,
341     SYNC_FETCH_AND_ADD_2,
342     SYNC_FETCH_AND_ADD_4,
343     SYNC_FETCH_AND_ADD_8,
344     SYNC_FETCH_AND_ADD_16,
345     SYNC_FETCH_AND_SUB_1,
346     SYNC_FETCH_AND_SUB_2,
347     SYNC_FETCH_AND_SUB_4,
348     SYNC_FETCH_AND_SUB_8,
349     SYNC_FETCH_AND_SUB_16,
350     SYNC_FETCH_AND_AND_1,
351     SYNC_FETCH_AND_AND_2,
352     SYNC_FETCH_AND_AND_4,
353     SYNC_FETCH_AND_AND_8,
354     SYNC_FETCH_AND_AND_16,
355     SYNC_FETCH_AND_OR_1,
356     SYNC_FETCH_AND_OR_2,
357     SYNC_FETCH_AND_OR_4,
358     SYNC_FETCH_AND_OR_8,
359     SYNC_FETCH_AND_OR_16,
360     SYNC_FETCH_AND_XOR_1,
361     SYNC_FETCH_AND_XOR_2,
362     SYNC_FETCH_AND_XOR_4,
363     SYNC_FETCH_AND_XOR_8,
364     SYNC_FETCH_AND_XOR_16,
365     SYNC_FETCH_AND_NAND_1,
366     SYNC_FETCH_AND_NAND_2,
367     SYNC_FETCH_AND_NAND_4,
368     SYNC_FETCH_AND_NAND_8,
369     SYNC_FETCH_AND_NAND_16,
370     SYNC_FETCH_AND_MAX_1,
371     SYNC_FETCH_AND_MAX_2,
372     SYNC_FETCH_AND_MAX_4,
373     SYNC_FETCH_AND_MAX_8,
374     SYNC_FETCH_AND_MAX_16,
375     SYNC_FETCH_AND_UMAX_1,
376     SYNC_FETCH_AND_UMAX_2,
377     SYNC_FETCH_AND_UMAX_4,
378     SYNC_FETCH_AND_UMAX_8,
379     SYNC_FETCH_AND_UMAX_16,
380     SYNC_FETCH_AND_MIN_1,
381     SYNC_FETCH_AND_MIN_2,
382     SYNC_FETCH_AND_MIN_4,
383     SYNC_FETCH_AND_MIN_8,
384     SYNC_FETCH_AND_MIN_16,
385     SYNC_FETCH_AND_UMIN_1,
386     SYNC_FETCH_AND_UMIN_2,
387     SYNC_FETCH_AND_UMIN_4,
388     SYNC_FETCH_AND_UMIN_8,
389     SYNC_FETCH_AND_UMIN_16,
390 
391     // Stack Protector Fail.
392     STACKPROTECTOR_CHECK_FAIL,
393 
394     UNKNOWN_LIBCALL
395   };
396 
397   /// getFPEXT - Return the FPEXT_*_* value for the given types, or
398   /// UNKNOWN_LIBCALL if there is none.
399   Libcall getFPEXT(EVT OpVT, EVT RetVT);
400 
401   /// getFPROUND - Return the FPROUND_*_* value for the given types, or
402   /// UNKNOWN_LIBCALL if there is none.
403   Libcall getFPROUND(EVT OpVT, EVT RetVT);
404 
405   /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
406   /// UNKNOWN_LIBCALL if there is none.
407   Libcall getFPTOSINT(EVT OpVT, EVT RetVT);
408 
409   /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
410   /// UNKNOWN_LIBCALL if there is none.
411   Libcall getFPTOUINT(EVT OpVT, EVT RetVT);
412 
413   /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
414   /// UNKNOWN_LIBCALL if there is none.
415   Libcall getSINTTOFP(EVT OpVT, EVT RetVT);
416 
417   /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
418   /// UNKNOWN_LIBCALL if there is none.
419   Libcall getUINTTOFP(EVT OpVT, EVT RetVT);
420 
421   /// Return the SYNC_FETCH_AND_* value for the given opcode and type, or
422   /// UNKNOWN_LIBCALL if there is none.
423   Libcall getATOMIC(unsigned Opc, MVT VT);
424 }
425 }
426 
427 #endif
428