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 21 namespace llvm { 22 namespace RTLIB { 23 24 /// GetFPLibCall - Helper to return the right libcall for the given floating 25 /// point type, or UNKNOWN_LIBCALL if there is none. 26 Libcall getFPLibCall(EVT VT, Libcall Call_F32, Libcall Call_F64, 27 Libcall Call_F80, Libcall Call_F128, Libcall Call_PPCF128); 28 29 /// getFPEXT - Return the FPEXT_*_* value for the given types, or 30 /// UNKNOWN_LIBCALL if there is none. 31 Libcall getFPEXT(EVT OpVT, EVT RetVT); 32 33 /// getFPROUND - Return the FPROUND_*_* value for the given types, or 34 /// UNKNOWN_LIBCALL if there is none. 35 Libcall getFPROUND(EVT OpVT, EVT RetVT); 36 37 /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or 38 /// UNKNOWN_LIBCALL if there is none. 39 Libcall getFPTOSINT(EVT OpVT, EVT RetVT); 40 41 /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or 42 /// UNKNOWN_LIBCALL if there is none. 43 Libcall getFPTOUINT(EVT OpVT, EVT RetVT); 44 45 /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or 46 /// UNKNOWN_LIBCALL if there is none. 47 Libcall getSINTTOFP(EVT OpVT, EVT RetVT); 48 49 /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or 50 /// UNKNOWN_LIBCALL if there is none. 51 Libcall getUINTTOFP(EVT OpVT, EVT RetVT); 52 53 /// getPOWI - Return the POWI_* value for the given types, or 54 /// UNKNOWN_LIBCALL if there is none. 55 Libcall getPOWI(EVT RetVT); 56 57 /// getLDEXP - Return the LDEXP_* value for the given types, or 58 /// UNKNOWN_LIBCALL if there is none. 59 Libcall getLDEXP(EVT RetVT); 60 61 /// getFREXP - Return the FREXP_* value for the given types, or 62 /// UNKNOWN_LIBCALL if there is none. 63 Libcall getFREXP(EVT RetVT); 64 65 /// Return the SYNC_FETCH_AND_* value for the given opcode and type, or 66 /// UNKNOWN_LIBCALL if there is none. 67 Libcall getSYNC(unsigned Opc, MVT VT); 68 69 /// Return the outline atomics value for the given atomic ordering, access 70 /// size and set of libcalls for a given atomic, or UNKNOWN_LIBCALL if there 71 /// is none. 72 Libcall getOutlineAtomicHelper(const Libcall (&LC)[5][4], AtomicOrdering Order, 73 uint64_t MemSize); 74 75 /// Return the outline atomics value for the given opcode, atomic ordering 76 /// and type, or UNKNOWN_LIBCALL if there is none. 77 Libcall getOUTLINE_ATOMIC(unsigned Opc, AtomicOrdering Order, MVT VT); 78 79 /// getMEMCPY_ELEMENT_UNORDERED_ATOMIC - Return 80 /// MEMCPY_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or 81 /// UNKNOW_LIBCALL if there is none. 82 Libcall getMEMCPY_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize); 83 84 /// getMEMMOVE_ELEMENT_UNORDERED_ATOMIC - Return 85 /// MEMMOVE_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or 86 /// UNKNOW_LIBCALL if there is none. 87 Libcall getMEMMOVE_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize); 88 89 /// getMEMSET_ELEMENT_UNORDERED_ATOMIC - Return 90 /// MEMSET_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or 91 /// UNKNOW_LIBCALL if there is none. 92 Libcall getMEMSET_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize); 93 94 /// Initialize the default condition code on the libcalls. 95 void initCmpLibcallCCs(ISD::CondCode *CmpLibcallCCs); 96 97 } // namespace RTLIB 98 } // namespace llvm 99 100 #endif 101