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 // EXCEPTION HANDLING
339 // Note: there's two sets of atomics libcalls; see
340 // <http://llvm.org/docs/Atomics.html> for more info on the
341 // difference between them.
343 // Atomic '__sync_*' libcalls.
344 SYNC_VAL_COMPARE_AND_SWAP_1,
345 SYNC_VAL_COMPARE_AND_SWAP_2,
346 SYNC_VAL_COMPARE_AND_SWAP_4,
347 SYNC_VAL_COMPARE_AND_SWAP_8,
348 SYNC_VAL_COMPARE_AND_SWAP_16,
349 SYNC_LOCK_TEST_AND_SET_1,
350 SYNC_LOCK_TEST_AND_SET_2,
351 SYNC_LOCK_TEST_AND_SET_4,
352 SYNC_LOCK_TEST_AND_SET_8,
353 SYNC_LOCK_TEST_AND_SET_16,
354 SYNC_FETCH_AND_ADD_1,
355 SYNC_FETCH_AND_ADD_2,
356 SYNC_FETCH_AND_ADD_4,
357 SYNC_FETCH_AND_ADD_8,
358 SYNC_FETCH_AND_ADD_16,
359 SYNC_FETCH_AND_SUB_1,
360 SYNC_FETCH_AND_SUB_2,
361 SYNC_FETCH_AND_SUB_4,
362 SYNC_FETCH_AND_SUB_8,
363 SYNC_FETCH_AND_SUB_16,
364 SYNC_FETCH_AND_AND_1,
365 SYNC_FETCH_AND_AND_2,
366 SYNC_FETCH_AND_AND_4,
367 SYNC_FETCH_AND_AND_8,
368 SYNC_FETCH_AND_AND_16,
373 SYNC_FETCH_AND_OR_16,
374 SYNC_FETCH_AND_XOR_1,
375 SYNC_FETCH_AND_XOR_2,
376 SYNC_FETCH_AND_XOR_4,
377 SYNC_FETCH_AND_XOR_8,
378 SYNC_FETCH_AND_XOR_16,
379 SYNC_FETCH_AND_NAND_1,
380 SYNC_FETCH_AND_NAND_2,
381 SYNC_FETCH_AND_NAND_4,
382 SYNC_FETCH_AND_NAND_8,
383 SYNC_FETCH_AND_NAND_16,
384 SYNC_FETCH_AND_MAX_1,
385 SYNC_FETCH_AND_MAX_2,
386 SYNC_FETCH_AND_MAX_4,
387 SYNC_FETCH_AND_MAX_8,
388 SYNC_FETCH_AND_MAX_16,
389 SYNC_FETCH_AND_UMAX_1,
390 SYNC_FETCH_AND_UMAX_2,
391 SYNC_FETCH_AND_UMAX_4,
392 SYNC_FETCH_AND_UMAX_8,
393 SYNC_FETCH_AND_UMAX_16,
394 SYNC_FETCH_AND_MIN_1,
395 SYNC_FETCH_AND_MIN_2,
396 SYNC_FETCH_AND_MIN_4,
397 SYNC_FETCH_AND_MIN_8,
398 SYNC_FETCH_AND_MIN_16,
399 SYNC_FETCH_AND_UMIN_1,
400 SYNC_FETCH_AND_UMIN_2,
401 SYNC_FETCH_AND_UMIN_4,
402 SYNC_FETCH_AND_UMIN_8,
403 SYNC_FETCH_AND_UMIN_16,
405 // Atomic '__atomic_*' libcalls.
427 ATOMIC_COMPARE_EXCHANGE,
428 ATOMIC_COMPARE_EXCHANGE_1,
429 ATOMIC_COMPARE_EXCHANGE_2,
430 ATOMIC_COMPARE_EXCHANGE_4,
431 ATOMIC_COMPARE_EXCHANGE_8,
432 ATOMIC_COMPARE_EXCHANGE_16,
468 ATOMIC_FETCH_NAND_16,
470 // Stack Protector Fail.
471 STACKPROTECTOR_CHECK_FAIL,
479 /// getFPEXT - Return the FPEXT_*_* value for the given types, or
480 /// UNKNOWN_LIBCALL if there is none.
481 Libcall getFPEXT(EVT OpVT, EVT RetVT);
483 /// getFPROUND - Return the FPROUND_*_* value for the given types, or
484 /// UNKNOWN_LIBCALL if there is none.
485 Libcall getFPROUND(EVT OpVT, EVT RetVT);
487 /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
488 /// UNKNOWN_LIBCALL if there is none.
489 Libcall getFPTOSINT(EVT OpVT, EVT RetVT);
491 /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
492 /// UNKNOWN_LIBCALL if there is none.
493 Libcall getFPTOUINT(EVT OpVT, EVT RetVT);
495 /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
496 /// UNKNOWN_LIBCALL if there is none.
497 Libcall getSINTTOFP(EVT OpVT, EVT RetVT);
499 /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
500 /// UNKNOWN_LIBCALL if there is none.
501 Libcall getUINTTOFP(EVT OpVT, EVT RetVT);
503 /// Return the SYNC_FETCH_AND_* value for the given opcode and type, or
504 /// UNKNOWN_LIBCALL if there is none.
505 Libcall getSYNC(unsigned Opc, MVT VT);