1//===-- CodeGen/RuntimeLibcalls.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 the enum representing the list of runtime library calls
10// the backend may emit during code generation, and also some helper functions.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_RUNTIMELIBCALLS_H
15#define LLVM_CODEGEN_RUNTIMELIBCALLS_H
16
17#include "llvm/CodeGen/ValueTypes.h"
18
19namespace llvm {
20namespace RTLIB {
21  /// RTLIB::Libcall enum - This enum defines all of the runtime library calls
22  /// the backend can emit.  The various long double types cannot be merged,
23  /// because 80-bit library functions use "xf" and 128-bit use "tf".
24  ///
25  /// When adding PPCF128 functions here, note that their names generally need
26  /// to be overridden for Darwin with the xxx$LDBL128 form.  See
27  /// PPCISelLowering.cpp.
28  ///
29  enum Libcall {
30#define HANDLE_LIBCALL(code, name) code,
31    #include "llvm/IR/RuntimeLibcalls.def"
32#undef HANDLE_LIBCALL
33  };
34
35  /// getFPEXT - Return the FPEXT_*_* value for the given types, or
36  /// UNKNOWN_LIBCALL if there is none.
37  Libcall getFPEXT(EVT OpVT, EVT RetVT);
38
39  /// getFPROUND - Return the FPROUND_*_* value for the given types, or
40  /// UNKNOWN_LIBCALL if there is none.
41  Libcall getFPROUND(EVT OpVT, EVT RetVT);
42
43  /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
44  /// UNKNOWN_LIBCALL if there is none.
45  Libcall getFPTOSINT(EVT OpVT, EVT RetVT);
46
47  /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
48  /// UNKNOWN_LIBCALL if there is none.
49  Libcall getFPTOUINT(EVT OpVT, EVT RetVT);
50
51  /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
52  /// UNKNOWN_LIBCALL if there is none.
53  Libcall getSINTTOFP(EVT OpVT, EVT RetVT);
54
55  /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
56  /// UNKNOWN_LIBCALL if there is none.
57  Libcall getUINTTOFP(EVT OpVT, EVT RetVT);
58
59  /// Return the SYNC_FETCH_AND_* value for the given opcode and type, or
60  /// UNKNOWN_LIBCALL if there is none.
61  Libcall getSYNC(unsigned Opc, MVT VT);
62
63  /// getMEMCPY_ELEMENT_UNORDERED_ATOMIC - Return
64  /// MEMCPY_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or
65  /// UNKNOW_LIBCALL if there is none.
66  Libcall getMEMCPY_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize);
67
68  /// getMEMMOVE_ELEMENT_UNORDERED_ATOMIC - Return
69  /// MEMMOVE_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or
70  /// UNKNOW_LIBCALL if there is none.
71  Libcall getMEMMOVE_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize);
72
73  /// getMEMSET_ELEMENT_UNORDERED_ATOMIC - Return
74  /// MEMSET_ELEMENT_UNORDERED_ATOMIC_* value for the given element size or
75  /// UNKNOW_LIBCALL if there is none.
76  Libcall getMEMSET_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize);
77
78}
79}
80
81#endif
82