1 //===-- CodeGen/RuntimeLibcalls.h - Runtime Library Calls -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_RUNTIMELIBCALLS_H
16 #define LLVM_CODEGEN_RUNTIMELIBCALLS_H
18 #include "llvm/CodeGen/ValueTypes.h"
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".
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.
248 FPTOSINT_PPCF128_I32,
249 FPTOSINT_PPCF128_I64,
250 FPTOSINT_PPCF128_I128,
263 FPTOUINT_PPCF128_I32,
264 FPTOUINT_PPCF128_I64,
265 FPTOUINT_PPCF128_I128,
270 SINTTOFP_I32_PPCF128,
275 SINTTOFP_I64_PPCF128,
280 SINTTOFP_I128_PPCF128,
285 UINTTOFP_I32_PPCF128,
290 UINTTOFP_I64_PPCF128,
295 UINTTOFP_I128_PPCF128,
336 // ELEMENT-WISE ATOMIC MEMORY
337 MEMCPY_ELEMENT_ATOMIC_1,
338 MEMCPY_ELEMENT_ATOMIC_2,
339 MEMCPY_ELEMENT_ATOMIC_4,
340 MEMCPY_ELEMENT_ATOMIC_8,
341 MEMCPY_ELEMENT_ATOMIC_16,
343 // EXCEPTION HANDLING
346 // Note: there's two sets of atomics libcalls; see
347 // <http://llvm.org/docs/Atomics.html> for more info on the
348 // difference between them.
350 // Atomic '__sync_*' libcalls.
351 SYNC_VAL_COMPARE_AND_SWAP_1,
352 SYNC_VAL_COMPARE_AND_SWAP_2,
353 SYNC_VAL_COMPARE_AND_SWAP_4,
354 SYNC_VAL_COMPARE_AND_SWAP_8,
355 SYNC_VAL_COMPARE_AND_SWAP_16,
356 SYNC_LOCK_TEST_AND_SET_1,
357 SYNC_LOCK_TEST_AND_SET_2,
358 SYNC_LOCK_TEST_AND_SET_4,
359 SYNC_LOCK_TEST_AND_SET_8,
360 SYNC_LOCK_TEST_AND_SET_16,
361 SYNC_FETCH_AND_ADD_1,
362 SYNC_FETCH_AND_ADD_2,
363 SYNC_FETCH_AND_ADD_4,
364 SYNC_FETCH_AND_ADD_8,
365 SYNC_FETCH_AND_ADD_16,
366 SYNC_FETCH_AND_SUB_1,
367 SYNC_FETCH_AND_SUB_2,
368 SYNC_FETCH_AND_SUB_4,
369 SYNC_FETCH_AND_SUB_8,
370 SYNC_FETCH_AND_SUB_16,
371 SYNC_FETCH_AND_AND_1,
372 SYNC_FETCH_AND_AND_2,
373 SYNC_FETCH_AND_AND_4,
374 SYNC_FETCH_AND_AND_8,
375 SYNC_FETCH_AND_AND_16,
380 SYNC_FETCH_AND_OR_16,
381 SYNC_FETCH_AND_XOR_1,
382 SYNC_FETCH_AND_XOR_2,
383 SYNC_FETCH_AND_XOR_4,
384 SYNC_FETCH_AND_XOR_8,
385 SYNC_FETCH_AND_XOR_16,
386 SYNC_FETCH_AND_NAND_1,
387 SYNC_FETCH_AND_NAND_2,
388 SYNC_FETCH_AND_NAND_4,
389 SYNC_FETCH_AND_NAND_8,
390 SYNC_FETCH_AND_NAND_16,
391 SYNC_FETCH_AND_MAX_1,
392 SYNC_FETCH_AND_MAX_2,
393 SYNC_FETCH_AND_MAX_4,
394 SYNC_FETCH_AND_MAX_8,
395 SYNC_FETCH_AND_MAX_16,
396 SYNC_FETCH_AND_UMAX_1,
397 SYNC_FETCH_AND_UMAX_2,
398 SYNC_FETCH_AND_UMAX_4,
399 SYNC_FETCH_AND_UMAX_8,
400 SYNC_FETCH_AND_UMAX_16,
401 SYNC_FETCH_AND_MIN_1,
402 SYNC_FETCH_AND_MIN_2,
403 SYNC_FETCH_AND_MIN_4,
404 SYNC_FETCH_AND_MIN_8,
405 SYNC_FETCH_AND_MIN_16,
406 SYNC_FETCH_AND_UMIN_1,
407 SYNC_FETCH_AND_UMIN_2,
408 SYNC_FETCH_AND_UMIN_4,
409 SYNC_FETCH_AND_UMIN_8,
410 SYNC_FETCH_AND_UMIN_16,
412 // Atomic '__atomic_*' libcalls.
434 ATOMIC_COMPARE_EXCHANGE,
435 ATOMIC_COMPARE_EXCHANGE_1,
436 ATOMIC_COMPARE_EXCHANGE_2,
437 ATOMIC_COMPARE_EXCHANGE_4,
438 ATOMIC_COMPARE_EXCHANGE_8,
439 ATOMIC_COMPARE_EXCHANGE_16,
475 ATOMIC_FETCH_NAND_16,
477 // Stack Protector Fail.
478 STACKPROTECTOR_CHECK_FAIL,
486 /// getFPEXT - Return the FPEXT_*_* value for the given types, or
487 /// UNKNOWN_LIBCALL if there is none.
488 Libcall getFPEXT(EVT OpVT, EVT RetVT);
490 /// getFPROUND - Return the FPROUND_*_* value for the given types, or
491 /// UNKNOWN_LIBCALL if there is none.
492 Libcall getFPROUND(EVT OpVT, EVT RetVT);
494 /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
495 /// UNKNOWN_LIBCALL if there is none.
496 Libcall getFPTOSINT(EVT OpVT, EVT RetVT);
498 /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
499 /// UNKNOWN_LIBCALL if there is none.
500 Libcall getFPTOUINT(EVT OpVT, EVT RetVT);
502 /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
503 /// UNKNOWN_LIBCALL if there is none.
504 Libcall getSINTTOFP(EVT OpVT, EVT RetVT);
506 /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
507 /// UNKNOWN_LIBCALL if there is none.
508 Libcall getUINTTOFP(EVT OpVT, EVT RetVT);
510 /// Return the SYNC_FETCH_AND_* value for the given opcode and type, or
511 /// UNKNOWN_LIBCALL if there is none.
512 Libcall getSYNC(unsigned Opc, MVT VT);
514 /// getMEMCPY_ELEMENT_ATOMIC - Return MEMCPY_ELEMENT_ATOMIC_* value for the
515 /// given element size or UNKNOW_LIBCALL if there is none.
516 Libcall getMEMCPY_ELEMENT_ATOMIC(uint64_t ElementSize);