• 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 
207     // CONVERSION
208     FPEXT_F64_F128,
209     FPEXT_F32_F128,
210     FPEXT_F32_F64,
211     FPEXT_F16_F32,
212     FPROUND_F32_F16,
213     FPROUND_F64_F32,
214     FPROUND_F80_F32,
215     FPROUND_F128_F32,
216     FPROUND_PPCF128_F32,
217     FPROUND_F80_F64,
218     FPROUND_F128_F64,
219     FPROUND_PPCF128_F64,
220     FPTOSINT_F32_I8,
221     FPTOSINT_F32_I16,
222     FPTOSINT_F32_I32,
223     FPTOSINT_F32_I64,
224     FPTOSINT_F32_I128,
225     FPTOSINT_F64_I8,
226     FPTOSINT_F64_I16,
227     FPTOSINT_F64_I32,
228     FPTOSINT_F64_I64,
229     FPTOSINT_F64_I128,
230     FPTOSINT_F80_I32,
231     FPTOSINT_F80_I64,
232     FPTOSINT_F80_I128,
233     FPTOSINT_F128_I32,
234     FPTOSINT_F128_I64,
235     FPTOSINT_F128_I128,
236     FPTOSINT_PPCF128_I32,
237     FPTOSINT_PPCF128_I64,
238     FPTOSINT_PPCF128_I128,
239     FPTOUINT_F32_I8,
240     FPTOUINT_F32_I16,
241     FPTOUINT_F32_I32,
242     FPTOUINT_F32_I64,
243     FPTOUINT_F32_I128,
244     FPTOUINT_F64_I8,
245     FPTOUINT_F64_I16,
246     FPTOUINT_F64_I32,
247     FPTOUINT_F64_I64,
248     FPTOUINT_F64_I128,
249     FPTOUINT_F80_I32,
250     FPTOUINT_F80_I64,
251     FPTOUINT_F80_I128,
252     FPTOUINT_F128_I32,
253     FPTOUINT_F128_I64,
254     FPTOUINT_F128_I128,
255     FPTOUINT_PPCF128_I32,
256     FPTOUINT_PPCF128_I64,
257     FPTOUINT_PPCF128_I128,
258     SINTTOFP_I32_F32,
259     SINTTOFP_I32_F64,
260     SINTTOFP_I32_F80,
261     SINTTOFP_I32_F128,
262     SINTTOFP_I32_PPCF128,
263     SINTTOFP_I64_F32,
264     SINTTOFP_I64_F64,
265     SINTTOFP_I64_F80,
266     SINTTOFP_I64_F128,
267     SINTTOFP_I64_PPCF128,
268     SINTTOFP_I128_F32,
269     SINTTOFP_I128_F64,
270     SINTTOFP_I128_F80,
271     SINTTOFP_I128_F128,
272     SINTTOFP_I128_PPCF128,
273     UINTTOFP_I32_F32,
274     UINTTOFP_I32_F64,
275     UINTTOFP_I32_F80,
276     UINTTOFP_I32_F128,
277     UINTTOFP_I32_PPCF128,
278     UINTTOFP_I64_F32,
279     UINTTOFP_I64_F64,
280     UINTTOFP_I64_F80,
281     UINTTOFP_I64_F128,
282     UINTTOFP_I64_PPCF128,
283     UINTTOFP_I128_F32,
284     UINTTOFP_I128_F64,
285     UINTTOFP_I128_F80,
286     UINTTOFP_I128_F128,
287     UINTTOFP_I128_PPCF128,
288 
289     // COMPARISON
290     OEQ_F32,
291     OEQ_F64,
292     OEQ_F128,
293     UNE_F32,
294     UNE_F64,
295     UNE_F128,
296     OGE_F32,
297     OGE_F64,
298     OGE_F128,
299     OLT_F32,
300     OLT_F64,
301     OLT_F128,
302     OLE_F32,
303     OLE_F64,
304     OLE_F128,
305     OGT_F32,
306     OGT_F64,
307     OGT_F128,
308     UO_F32,
309     UO_F64,
310     UO_F128,
311     O_F32,
312     O_F64,
313     O_F128,
314 
315     // MEMORY
316     MEMCPY,
317     MEMSET,
318     MEMMOVE,
319 
320     // EXCEPTION HANDLING
321     UNWIND_RESUME,
322 
323     // Family ATOMICs
324     SYNC_VAL_COMPARE_AND_SWAP_1,
325     SYNC_VAL_COMPARE_AND_SWAP_2,
326     SYNC_VAL_COMPARE_AND_SWAP_4,
327     SYNC_VAL_COMPARE_AND_SWAP_8,
328     SYNC_VAL_COMPARE_AND_SWAP_16,
329     SYNC_LOCK_TEST_AND_SET_1,
330     SYNC_LOCK_TEST_AND_SET_2,
331     SYNC_LOCK_TEST_AND_SET_4,
332     SYNC_LOCK_TEST_AND_SET_8,
333     SYNC_LOCK_TEST_AND_SET_16,
334     SYNC_FETCH_AND_ADD_1,
335     SYNC_FETCH_AND_ADD_2,
336     SYNC_FETCH_AND_ADD_4,
337     SYNC_FETCH_AND_ADD_8,
338     SYNC_FETCH_AND_ADD_16,
339     SYNC_FETCH_AND_SUB_1,
340     SYNC_FETCH_AND_SUB_2,
341     SYNC_FETCH_AND_SUB_4,
342     SYNC_FETCH_AND_SUB_8,
343     SYNC_FETCH_AND_SUB_16,
344     SYNC_FETCH_AND_AND_1,
345     SYNC_FETCH_AND_AND_2,
346     SYNC_FETCH_AND_AND_4,
347     SYNC_FETCH_AND_AND_8,
348     SYNC_FETCH_AND_AND_16,
349     SYNC_FETCH_AND_OR_1,
350     SYNC_FETCH_AND_OR_2,
351     SYNC_FETCH_AND_OR_4,
352     SYNC_FETCH_AND_OR_8,
353     SYNC_FETCH_AND_OR_16,
354     SYNC_FETCH_AND_XOR_1,
355     SYNC_FETCH_AND_XOR_2,
356     SYNC_FETCH_AND_XOR_4,
357     SYNC_FETCH_AND_XOR_8,
358     SYNC_FETCH_AND_XOR_16,
359     SYNC_FETCH_AND_NAND_1,
360     SYNC_FETCH_AND_NAND_2,
361     SYNC_FETCH_AND_NAND_4,
362     SYNC_FETCH_AND_NAND_8,
363     SYNC_FETCH_AND_NAND_16,
364     SYNC_FETCH_AND_MAX_1,
365     SYNC_FETCH_AND_MAX_2,
366     SYNC_FETCH_AND_MAX_4,
367     SYNC_FETCH_AND_MAX_8,
368     SYNC_FETCH_AND_MAX_16,
369     SYNC_FETCH_AND_UMAX_1,
370     SYNC_FETCH_AND_UMAX_2,
371     SYNC_FETCH_AND_UMAX_4,
372     SYNC_FETCH_AND_UMAX_8,
373     SYNC_FETCH_AND_UMAX_16,
374     SYNC_FETCH_AND_MIN_1,
375     SYNC_FETCH_AND_MIN_2,
376     SYNC_FETCH_AND_MIN_4,
377     SYNC_FETCH_AND_MIN_8,
378     SYNC_FETCH_AND_MIN_16,
379     SYNC_FETCH_AND_UMIN_1,
380     SYNC_FETCH_AND_UMIN_2,
381     SYNC_FETCH_AND_UMIN_4,
382     SYNC_FETCH_AND_UMIN_8,
383     SYNC_FETCH_AND_UMIN_16,
384 
385     // Stack Protector Fail.
386     STACKPROTECTOR_CHECK_FAIL,
387 
388     UNKNOWN_LIBCALL
389   };
390 
391   /// getFPEXT - Return the FPEXT_*_* value for the given types, or
392   /// UNKNOWN_LIBCALL if there is none.
393   Libcall getFPEXT(EVT OpVT, EVT RetVT);
394 
395   /// getFPROUND - Return the FPROUND_*_* value for the given types, or
396   /// UNKNOWN_LIBCALL if there is none.
397   Libcall getFPROUND(EVT OpVT, EVT RetVT);
398 
399   /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
400   /// UNKNOWN_LIBCALL if there is none.
401   Libcall getFPTOSINT(EVT OpVT, EVT RetVT);
402 
403   /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
404   /// UNKNOWN_LIBCALL if there is none.
405   Libcall getFPTOUINT(EVT OpVT, EVT RetVT);
406 
407   /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
408   /// UNKNOWN_LIBCALL if there is none.
409   Libcall getSINTTOFP(EVT OpVT, EVT RetVT);
410 
411   /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
412   /// UNKNOWN_LIBCALL if there is none.
413   Libcall getUINTTOFP(EVT OpVT, EVT RetVT);
414 }
415 }
416 
417 #endif
418