xref: /freebsd/contrib/llvm-project/llvm/include/llvm/CodeGen/RuntimeLibcallUtil.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
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 /// getPOW - Return the POW_* value for the given types, or
60 /// UNKNOWN_LIBCALL if there is none.
61 LLVM_ABI Libcall getPOW(EVT RetVT);
62 
63 /// getLDEXP - Return the LDEXP_* value for the given types, or
64 /// UNKNOWN_LIBCALL if there is none.
65 LLVM_ABI Libcall getLDEXP(EVT RetVT);
66 
67 /// getFREXP - Return the FREXP_* value for the given types, or
68 /// UNKNOWN_LIBCALL if there is none.
69 LLVM_ABI Libcall getFREXP(EVT RetVT);
70 
71 /// Return the SIN_* value for the given types, or UNKNOWN_LIBCALL if there is
72 /// none.
73 LLVM_ABI Libcall getSIN(EVT RetVT);
74 
75 /// Return the COS_* value for the given types, or UNKNOWN_LIBCALL if there is
76 /// none.
77 LLVM_ABI Libcall getCOS(EVT RetVT);
78 
79 /// getSINCOS - Return the SINCOS_* value for the given types, or
80 /// UNKNOWN_LIBCALL if there is none.
81 LLVM_ABI Libcall getSINCOS(EVT RetVT);
82 
83 /// getSINCOSPI - Return the SINCOSPI_* value for the given types, or
84 /// UNKNOWN_LIBCALL if there is none.
85 LLVM_ABI Libcall getSINCOSPI(EVT RetVT);
86 
87 /// getMODF - Return the MODF_* value for the given types, or
88 /// UNKNOWN_LIBCALL if there is none.
89 LLVM_ABI Libcall getMODF(EVT RetVT);
90 
91 /// Return the SYNC_FETCH_AND_* value for the given opcode and type, or
92 /// UNKNOWN_LIBCALL if there is none.
93 LLVM_ABI Libcall getSYNC(unsigned Opc, MVT VT);
94 
95 /// Return the outline atomics value for the given atomic ordering, access
96 /// size and set of libcalls for a given atomic, or UNKNOWN_LIBCALL if there
97 /// is none.
98 LLVM_ABI Libcall getOutlineAtomicHelper(const Libcall (&LC)[5][4],
99                                         AtomicOrdering Order, uint64_t MemSize);
100 
101 /// Return the outline atomics value for the given opcode, atomic ordering
102 /// and type, or UNKNOWN_LIBCALL if there is none.
103 LLVM_ABI Libcall getOUTLINE_ATOMIC(unsigned Opc, AtomicOrdering Order, MVT VT);
104 
105 /// getMEMCPY_ELEMENT_UNORDERED_ATOMIC - Return
106 /// MEMCPY_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or
107 /// UNKNOW_LIBCALL if there is none.
108 LLVM_ABI Libcall getMEMCPY_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize);
109 
110 /// getMEMMOVE_ELEMENT_UNORDERED_ATOMIC - Return
111 /// MEMMOVE_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or
112 /// UNKNOW_LIBCALL if there is none.
113 LLVM_ABI Libcall getMEMMOVE_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize);
114 
115 /// getMEMSET_ELEMENT_UNORDERED_ATOMIC - Return
116 /// MEMSET_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or
117 /// UNKNOW_LIBCALL if there is none.
118 LLVM_ABI Libcall getMEMSET_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize);
119 
120 } // namespace RTLIB
121 } // namespace llvm
122 
123 #endif
124