| 1 | //===-- CodeGen/RuntimeLibcallUtil.h - Runtime Library Calls ----*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file defines some helper functions for runtime library calls. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_CODEGEN_RUNTIMELIBCALLS_H |
| 14 | #define LLVM_CODEGEN_RUNTIMELIBCALLS_H |
| 15 | |
| 16 | #include "llvm/CodeGen/ISDOpcodes.h" |
| 17 | #include "llvm/CodeGen/ValueTypes.h" |
| 18 | #include "llvm/IR/RuntimeLibcalls.h" |
| 19 | #include "llvm/Support/AtomicOrdering.h" |
| 20 | #include "llvm/Support/Compiler.h" |
| 21 | |
| 22 | namespace llvm { |
| 23 | namespace RTLIB { |
| 24 | |
| 25 | /// GetFPLibCall - Helper to return the right libcall for the given floating |
| 26 | /// point type, or UNKNOWN_LIBCALL if there is none. |
| 27 | LLVM_ABI Libcall getFPLibCall(EVT VT, Libcall Call_F32, Libcall Call_F64, |
| 28 | Libcall Call_F80, Libcall Call_F128, |
| 29 | Libcall Call_PPCF128); |
| 30 | |
| 31 | /// getFPEXT - Return the FPEXT_*_* value for the given types, or |
| 32 | /// UNKNOWN_LIBCALL if there is none. |
| 33 | LLVM_ABI Libcall getFPEXT(EVT OpVT, EVT RetVT); |
| 34 | |
| 35 | /// getFPROUND - Return the FPROUND_*_* value for the given types, or |
| 36 | /// UNKNOWN_LIBCALL if there is none. |
| 37 | LLVM_ABI Libcall getFPROUND(EVT OpVT, EVT RetVT); |
| 38 | |
| 39 | /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or |
| 40 | /// UNKNOWN_LIBCALL if there is none. |
| 41 | LLVM_ABI Libcall getFPTOSINT(EVT OpVT, EVT RetVT); |
| 42 | |
| 43 | /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or |
| 44 | /// UNKNOWN_LIBCALL if there is none. |
| 45 | LLVM_ABI Libcall getFPTOUINT(EVT OpVT, EVT RetVT); |
| 46 | |
| 47 | /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or |
| 48 | /// UNKNOWN_LIBCALL if there is none. |
| 49 | LLVM_ABI Libcall getSINTTOFP(EVT OpVT, EVT RetVT); |
| 50 | |
| 51 | /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or |
| 52 | /// UNKNOWN_LIBCALL if there is none. |
| 53 | LLVM_ABI Libcall getUINTTOFP(EVT OpVT, EVT RetVT); |
| 54 | |
| 55 | /// getPOWI - Return the POWI_* value for the given types, or |
| 56 | /// UNKNOWN_LIBCALL if there is none. |
| 57 | LLVM_ABI Libcall getPOWI(EVT RetVT); |
| 58 | |
| 59 | /// getLDEXP - Return the LDEXP_* value for the given types, or |
| 60 | /// UNKNOWN_LIBCALL if there is none. |
| 61 | LLVM_ABI Libcall getLDEXP(EVT RetVT); |
| 62 | |
| 63 | /// getFREXP - Return the FREXP_* value for the given types, or |
| 64 | /// UNKNOWN_LIBCALL if there is none. |
| 65 | LLVM_ABI Libcall getFREXP(EVT RetVT); |
| 66 | |
| 67 | /// getSINCOS - Return the SINCOS_* value for the given types, or |
| 68 | /// UNKNOWN_LIBCALL if there is none. |
| 69 | LLVM_ABI Libcall getSINCOS(EVT RetVT); |
| 70 | |
| 71 | /// getSINCOSPI - Return the SINCOSPI_* value for the given types, or |
| 72 | /// UNKNOWN_LIBCALL if there is none. |
| 73 | LLVM_ABI Libcall getSINCOSPI(EVT RetVT); |
| 74 | |
| 75 | /// getMODF - Return the MODF_* value for the given types, or |
| 76 | /// UNKNOWN_LIBCALL if there is none. |
| 77 | LLVM_ABI Libcall getMODF(EVT RetVT); |
| 78 | |
| 79 | /// Return the SYNC_FETCH_AND_* value for the given opcode and type, or |
| 80 | /// UNKNOWN_LIBCALL if there is none. |
| 81 | LLVM_ABI Libcall getSYNC(unsigned Opc, MVT VT); |
| 82 | |
| 83 | /// Return the outline atomics value for the given atomic ordering, access |
| 84 | /// size and set of libcalls for a given atomic, or UNKNOWN_LIBCALL if there |
| 85 | /// is none. |
| 86 | LLVM_ABI Libcall getOutlineAtomicHelper(const Libcall (&LC)[5][4], |
| 87 | AtomicOrdering Order, uint64_t MemSize); |
| 88 | |
| 89 | /// Return the outline atomics value for the given opcode, atomic ordering |
| 90 | /// and type, or UNKNOWN_LIBCALL if there is none. |
| 91 | LLVM_ABI Libcall getOUTLINE_ATOMIC(unsigned Opc, AtomicOrdering Order, MVT VT); |
| 92 | |
| 93 | /// getMEMCPY_ELEMENT_UNORDERED_ATOMIC - Return |
| 94 | /// MEMCPY_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or |
| 95 | /// UNKNOW_LIBCALL if there is none. |
| 96 | LLVM_ABI Libcall getMEMCPY_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize); |
| 97 | |
| 98 | /// getMEMMOVE_ELEMENT_UNORDERED_ATOMIC - Return |
| 99 | /// MEMMOVE_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or |
| 100 | /// UNKNOW_LIBCALL if there is none. |
| 101 | LLVM_ABI Libcall getMEMMOVE_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize); |
| 102 | |
| 103 | /// getMEMSET_ELEMENT_UNORDERED_ATOMIC - Return |
| 104 | /// MEMSET_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or |
| 105 | /// UNKNOW_LIBCALL if there is none. |
| 106 | LLVM_ABI Libcall getMEMSET_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize); |
| 107 | |
| 108 | /// Initialize the default condition code on the libcalls. |
| 109 | LLVM_ABI void initCmpLibcallCCs(ISD::CondCode *CmpLibcallCCs); |
| 110 | |
| 111 | } // namespace RTLIB |
| 112 | } // namespace llvm |
| 113 | |
| 114 | #endif |
| 115 | |