LLVM: include/llvm/ADT/STLForwardCompat.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#ifndef LLVM_ADT_STLFORWARDCOMPAT_H
18#define LLVM_ADT_STLFORWARDCOMPAT_H
19
20#include
21#include <type_traits>
22#include
23
24namespace llvm {
25
26
27
28
29
31
32template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
33inline constexpr T e_v = T(0x1.5bf0a8b145769P+1);
34template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
35inline constexpr T egamma_v = T(0x1.2788cfc6fb619P-1);
36template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
37inline constexpr T ln2_v = T(0x1.62e42fefa39efP-1);
38template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
39inline constexpr T ln10_v = T(0x1.26bb1bbb55516P+1);
40template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
41inline constexpr T log2e_v = T(0x1.71547652b82feP+0);
42template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
43inline constexpr T log10e_v = T(0x1.bcb7b1526e50eP-2);
44template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
45inline constexpr T pi_v = T(0x1.921fb54442d18P+1);
46template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
47inline constexpr T inv_pi_v = T(0x1.45f306dc9c883P-2);
48template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
49inline constexpr T inv_sqrtpi_v = T(0x1.20dd750429b6dP-1);
50template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
51inline constexpr T sqrt2_v = T(0x1.6a09e667f3bcdP+0);
52template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
53inline constexpr T inv_sqrt2_v = T(0x1.6a09e667f3bcdP-1);
54template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
55inline constexpr T sqrt3_v = T(0x1.bb67ae8584caaP+0);
56template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
57inline constexpr T inv_sqrt3_v = T(0x1.279a74590331cP-1);
58template <typename T, typename = std::enable_if_t<std::is_floating_point_v>>
59inline constexpr T phi_v = T(0x1.9e3779b97f4a8P+0);
60
75
76}
77
78template
83
84template
85using remove_cvref_t
87
88
89template
94
95
96
97template
98using type_identity_t
100
102template <class, template <class...> class Op, class... Args> struct detector {
104};
105template <template <class...> class Op, class... Args>
109}
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125template <template <class...> class Op, class... Args>
127
129{
131
132 template constexpr T &&operator()(T &&self) const noexcept {
133 return std::forward(self);
134 }
135};
136
137
138
139
140
141
142
143
144template auto to_address(const Ptr &P) { return P.operator->(); }
146 static_assert(!std::is_function_v);
147 return P;
148}
149
150
151
152
153
154
155
156template <typename Optional, typename Function,
158std::optional<std::invoke_result_t<Function, Value>>
160 if (O) {
161 return F(*std::forward(O));
162 }
163 return std::nullopt;
164}
165
166
167
168template
169[[nodiscard]] constexpr std::underlying_type_t to_underlying(Enum E) {
170 return static_cast<std::underlying_type_t>(E);
171}
172
173
178}
179
180#endif
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Mathematical constants.
Definition STLForwardCompat.h:30
constexpr T log10e_v
Definition STLForwardCompat.h:43
constexpr double sqrt2
Definition STLForwardCompat.h:70
constexpr double inv_sqrt2
Definition STLForwardCompat.h:71
constexpr T e_v
Definition STLForwardCompat.h:33
constexpr double inv_pi
Definition STLForwardCompat.h:68
constexpr T log2e_v
Definition STLForwardCompat.h:41
constexpr T egamma_v
Definition STLForwardCompat.h:35
constexpr T sqrt3_v
Definition STLForwardCompat.h:55
constexpr double ln2
Definition STLForwardCompat.h:63
constexpr double inv_sqrt3
Definition STLForwardCompat.h:73
constexpr double egamma
Definition STLForwardCompat.h:62
constexpr T sqrt2_v
Definition STLForwardCompat.h:51
constexpr T inv_sqrt3_v
Definition STLForwardCompat.h:57
constexpr T inv_sqrtpi_v
Definition STLForwardCompat.h:49
constexpr double ln10
Definition STLForwardCompat.h:64
constexpr double inv_sqrtpi
Definition STLForwardCompat.h:69
constexpr T ln10_v
Definition STLForwardCompat.h:39
constexpr double e
Definition STLForwardCompat.h:61
constexpr double phi
Definition STLForwardCompat.h:74
constexpr T pi_v
Definition STLForwardCompat.h:45
constexpr double sqrt3
Definition STLForwardCompat.h:72
constexpr T phi_v
Definition STLForwardCompat.h:59
constexpr double log10e
Definition STLForwardCompat.h:66
constexpr double log2e
Definition STLForwardCompat.h:65
constexpr T ln2_v
Definition STLForwardCompat.h:37
constexpr T inv_pi_v
Definition STLForwardCompat.h:47
constexpr T inv_sqrt2_v
Definition STLForwardCompat.h:53
constexpr double pi
Definition STLForwardCompat.h:67
This is an optimization pass for GlobalISel generic memory operations.
constexpr from_range_t from_range
Definition STLForwardCompat.h:177
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
Definition STLForwardCompat.h:169
DWARFExpression::Operation Op
auto to_address(const Ptr &P)
Returns a raw pointer that represents the same address as the argument.
Definition STLForwardCompat.h:144
typename detail::detector< void, Op, Args... >::value_t is_detected
Detects if a given trait holds for some set of arguments 'Args'.
Definition STLForwardCompat.h:126
std::optional< std::invoke_result_t< Function, Value > > transformOptional(Optional &&O, Function &&F)
Definition STLForwardCompat.h:159
Implement std::hash so that hash_code can be used in STL containers.
std::true_type value_t
Definition STLForwardCompat.h:107
Definition STLForwardCompat.h:102
std::false_type value_t
Definition STLForwardCompat.h:103
Definition STLForwardCompat.h:174
Definition STLForwardCompat.h:129
constexpr T && operator()(T &&self) const noexcept
Definition STLForwardCompat.h:132
void is_transparent
Definition STLForwardCompat.h:130
Definition STLForwardCompat.h:80
std::remove_cv_t< std::remove_reference_t< T > > type
Definition STLForwardCompat.h:81
Definition STLForwardCompat.h:91
T type
Definition STLForwardCompat.h:92