17#ifndef LLVM_ADT_STLFORWARDCOMPAT_H
18#define LLVM_ADT_STLFORWARDCOMPAT_H
35template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
36inline constexpr T e_v =
T(0x1.5bf0a8b145769P+1);
37template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
39template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
40inline constexpr T ln2_v =
T(0x1.62e42fefa39efP-1);
41template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
42inline constexpr T ln10_v =
T(0x1.26bb1bbb55516P+1);
43template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
44inline constexpr T log2e_v =
T(0x1.71547652b82feP+0);
45template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
47template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
48inline constexpr T pi_v =
T(0x1.921fb54442d18P+1);
49template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
51template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
53template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
54inline constexpr T sqrt2_v =
T(0x1.6a09e667f3bcdP+0);
55template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
57template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
58inline constexpr T sqrt3_v =
T(0x1.bb67ae8584caaP+0);
59template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
61template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
62inline constexpr T phi_v =
T(0x1.9e3779b97f4a8P+0);
84 using type = std::remove_cv_t<std::remove_reference_t<T>>;
105template <
class,
template <
class...>
class Op,
class... Args>
struct detector {
108template <
template <
class...>
class Op,
class... Args>
128template <
template <
class...>
class Op,
class... Args>
135 template <
typename T>
constexpr T &&
operator()(
T &&self)
const noexcept {
136 return std::forward<T>(self);
147template <
class Ptr>
auto to_address(
const Ptr &
P) {
return P.operator->(); }
149 static_assert(!std::is_function_v<T>);
155template <
typename FnT,
typename... ArgsT>
156constexpr std::invoke_result_t<
FnT, ArgsT...>
158 return std::apply(std::forward<FnT>(Fn),
159 std::forward_as_tuple(std::forward<ArgsT>(Args)...));
165template <
typename ForwardIterator,
typename Cmp = std::less<>>
170 ForwardIterator Prev =
First;
171 for (ForwardIterator
I = std::next(
First);
I !=
Last; ++
I) {
187std::optional<std::invoke_result_t<Function, Value>>
190 return F(*std::forward<Optional>(O));
197template <
typename Enum>
199 return static_cast<std::underlying_type_t<Enum>
>(
E);
222 template <
typename FnArgT>
231 constexpr decltype(
auto)
get()
const {
return ConstFn; }
238template <
bool BindFront,
typename BoundArgsTupleT,
typename FnStorageT,
242template <
bool BindFront,
typename BoundArgsTupleT,
typename FnStorageT,
245 std::index_sequence<Indices...>> {
246 BoundArgsTupleT BoundArgs;
252 template <
typename FnArgT,
typename... BoundArgsArgT>
254 : BoundArgs(
std::forward<BoundArgsArgT>(Args)...),
255 FnStorage(
std::forward<FnArgT>(
F)) {}
258 template <
typename... BoundArgsArgT>
260 : BoundArgs(
std::forward<BoundArgsArgT>(Args)...), FnStorage() {}
262 template <
typename... CallArgsT>
263 constexpr decltype(
auto)
operator()(CallArgsT &&...CallArgs) {
264 if constexpr (BindFront)
265 return llvm::invoke(FnStorage.get(), std::get<Indices>(BoundArgs)...,
266 std::forward<CallArgsT>(CallArgs)...);
268 return llvm::invoke(FnStorage.get(), std::forward<CallArgsT>(CallArgs)...,
269 std::get<Indices>(BoundArgs)...);
272 template <
typename... CallArgsT>
273 constexpr decltype(
auto)
operator()(CallArgsT &&...CallArgs)
const {
274 if constexpr (BindFront)
275 return llvm::invoke(FnStorage.get(), std::get<Indices>(BoundArgs)...,
276 std::forward<CallArgsT>(CallArgs)...);
278 return llvm::invoke(FnStorage.get(), std::forward<CallArgsT>(CallArgs)...,
279 std::get<Indices>(BoundArgs)...);
287template <
typename FnT,
typename... BindArgsT>
289 BindArgsT &&...BindArgs) {
291 std::tuple<std::decay_t<BindArgsT>...>,
293 std::index_sequence_for<BindArgsT...>>(
295 std::forward<BindArgsT>(BindArgs)...);
300template <
auto ConstFn,
typename... BindArgsT>
303 if constexpr (std::is_pointer_v<
decltype(ConstFn)> ||
304 std::is_member_pointer_v<
decltype(ConstFn)>)
305 static_assert(ConstFn !=
nullptr);
308 true, std::tuple<std::decay_t<BindArgsT>...>,
316template <
typename FnT,
typename... BindArgsT>
318 BindArgsT &&...BindArgs) {
320 std::tuple<std::decay_t<BindArgsT>...>,
322 std::index_sequence_for<BindArgsT...>>(
324 std::forward<BindArgsT>(BindArgs)...);
329template <
auto ConstFn,
typename... BindArgsT>
332 if constexpr (std::is_pointer_v<
decltype(ConstFn)> ||
333 std::is_member_pointer_v<
decltype(ConstFn)>)
334 static_assert(ConstFn !=
nullptr);
337 false, std::tuple<std::decay_t<BindArgsT>...>,
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_NO_UNIQUE_ADDRESS
LLVM Value Representation.
constexpr BindStorage(RuntimeFnTag, FnArgT &&F, BoundArgsArgT &&...Args)
constexpr decltype(auto) operator()(CallArgsT &&...CallArgs)
constexpr BindStorage(ConstantFnTag, BoundArgsArgT &&...Args)
@ C
The default llvm calling convention, compatible with C.
constexpr double inv_sqrt2
constexpr double inv_sqrt3
constexpr double inv_sqrtpi
This is an optimization pass for GlobalISel generic memory operations.
constexpr from_range_t from_range
constexpr std::invoke_result_t< FnT, ArgsT... > invoke(FnT &&Fn, ArgsT &&...Args)
C++20 constexpr invoke.
constexpr auto bind_back(FnT &&Fn, BindArgsT &&...BindArgs)
C++23 bind_back.
constexpr auto bind_front(FnT &&Fn, BindArgsT &&...BindArgs)
C++20 bind_front.
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
constexpr bool is_sorted_constexpr(R &&Range, Cmp C=Cmp{})
Check if elements in a range R are sorted with respect to a comparator C.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
DWARFExpression::Operation Op
auto to_address(const Ptr &P)
Returns a raw pointer that represents the same address as the argument.
typename detail::detector< void, Op, Args... >::value_t is_detected
Detects if a given trait holds for some set of arguments 'Args'.
std::optional< std::invoke_result_t< Function, Value > > transformOptional(Optional &&O, Function &&F)
Implement std::hash so that hash_code can be used in STL containers.
Holds a compile-time constant callable (empty storage).
constexpr decltype(auto) get() const
Stores a callable as a data member.
constexpr const FnT & get() const
constexpr FnHolder(FnArgT &&F)
constexpr T && operator()(T &&self) const noexcept
std::remove_cv_t< std::remove_reference_t< T > > type