LLVM
17.0.0git
|
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/identity.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Config/abi-breaking.h"
#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <limits>
#include <memory>
#include <optional>
#include <tuple>
#include <type_traits>
#include <utility>
Go to the source code of this file.
Namespaces | |
llvm | |
This is an optimization pass for GlobalISel generic memory operations. | |
llvm::detail | |
llvm::callable_detail | |
llvm::adl_detail | |
std | |
Typedefs | |
template<typename RangeT > | |
using | llvm::detail::IterOfRange = decltype(std::begin(std::declval< RangeT & >())) |
template<typename RangeT > | |
using | llvm::detail::ValueOfRange = std::remove_reference_t< decltype(*std::begin(std::declval< RangeT & >()))> |
template<template< class... > class Op, class... Args> | |
using | llvm::is_detected = typename detail::detector< void, Op, Args... >::value_t |
Detects if a given trait holds for some set of arguments 'Args'. More... | |
template<typename T , typename... Ts> | |
using | llvm::is_one_of = std::disjunction< std::is_same< T, Ts >... > |
traits class for checking whether type T is one of any of the given types in the variadic list. More... | |
template<typename T , typename... Ts> | |
using | llvm::are_base_of = std::conjunction< std::is_base_of< T, Ts >... > |
traits class for checking whether type T is a base class for all the given types in the variadic list. More... | |
template<size_t I, typename... Ts> | |
using | llvm::TypeAtIndex = std::tuple_element_t< I, std::tuple< Ts... > > |
Find the type at a given index in a list of types. More... | |
template<typename WrappedIteratorT , typename PredicateT > | |
using | llvm::filter_iterator = filter_iterator_impl< WrappedIteratorT, PredicateT, typename detail::fwd_or_bidi_tag< WrappedIteratorT >::type > |
Defines filter_iterator to a suitable specialization of filter_iterator_impl, based on the underlying iterator's category. More... | |
template<typename ZipType , typename... Iters> | |
using | llvm::detail::zip_traits = iterator_facade_base< ZipType, std::common_type_t< std::bidirectional_iterator_tag, typename std::iterator_traits< Iters >::iterator_category... >, typename ZipTupleType< Iters... >::type, typename std::iterator_traits< std::tuple_element_t< 0, std::tuple< Iters... > >>::difference_type, typename ZipTupleType< Iters... >::type *, typename ZipTupleType< Iters... >::type > |
template<typename T > | |
using | llvm::detail::sort_trivially_copyable = std::conjunction< std::is_pointer< T >, std::is_trivially_copyable< typename std::iterator_traits< T >::value_type > > |
Functions | |
template<typename EnumTy1 , typename EnumTy2 , typename UT1 = std::enable_if_t<std::is_enum<EnumTy1>::value, std::underlying_type_t<EnumTy1>>, typename UT2 = std::enable_if_t<std::is_enum<EnumTy2>::value, std::underlying_type_t<EnumTy2>>> | |
constexpr auto | llvm::addEnumValues (EnumTy1 LHS, EnumTy2 RHS) |
Helper which adds two underlying types of enumeration type. More... | |
template<typename ContainerTy > | |
decltype(auto) | llvm::adl_detail::adl_begin (ContainerTy &&container) |
template<typename ContainerTy > | |
decltype(auto) | llvm::adl_detail::adl_end (ContainerTy &&container) |
template<typename T > | |
void | llvm::adl_detail::adl_swap (T &&lhs, T &&rhs) noexcept(noexcept(swap(std::declval< T >(), std::declval< T >()))) |
template<typename ContainerTy > | |
decltype(auto) | llvm::adl_begin (ContainerTy &&container) |
template<typename ContainerTy > | |
decltype(auto) | llvm::adl_end (ContainerTy &&container) |
template<typename T > | |
void | llvm::adl_swap (T &&lhs, T &&rhs) noexcept(noexcept(adl_detail::adl_swap(std::declval< T >(), std::declval< T >()))) |
template<typename ContainerTy > | |
bool | llvm::hasSingleElement (ContainerTy &&C) |
Returns true if the given container only contains a single element. More... | |
template<typename T > | |
auto | llvm::drop_begin (T &&RangeOrContainer, size_t N=1) |
Return a range covering RangeOrContainer with the first N elements excluded. More... | |
template<typename T > | |
auto | llvm::drop_end (T &&RangeOrContainer, size_t N=1) |
Return a range covering RangeOrContainer with the last N elements excluded. More... | |
template<class ItTy , class FuncTy > | |
mapped_iterator< ItTy, FuncTy > | llvm::map_iterator (ItTy I, FuncTy F) |
template<class ContainerTy , class FuncTy > | |
auto | llvm::map_range (ContainerTy &&C, FuncTy F) |
template<typename ContainerTy > | |
auto | llvm::reverse (ContainerTy &&C) |
template<typename RangeT , typename PredicateT > | |
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > | llvm::make_filter_range (RangeT &&Range, PredicateT Pred) |
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator range. More... | |
template<typename RangeT > | |
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > | llvm::make_early_inc_range (RangeT &&Range) |
Make a range that does early increment to allow mutation of the underlying range without disrupting iteration. More... | |
template<typename R , typename UnaryPredicate > | |
bool | llvm::all_of (R &&Range, UnaryPredicate P) |
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename UnaryPredicate > | |
bool | llvm::any_of (R &&Range, UnaryPredicate P) |
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename T > | |
bool | llvm::all_equal (std::initializer_list< T > Values) |
Returns true if all Values in the initializer lists are equal or the list. More... | |
template<typename T , typename U , typename... Args> | |
detail::zippy< detail::zip_shortest, T, U, Args... > | llvm::zip (T &&t, U &&u, Args &&...args) |
zip iterator for two or more iteratable types. More... | |
template<typename T , typename U , typename... Args> | |
detail::zippy< detail::zip_first, T, U, Args... > | llvm::zip_equal (T &&t, U &&u, Args &&...args) |
zip iterator that assumes that all iteratees have the same length. More... | |
template<typename T , typename U , typename... Args> | |
detail::zippy< detail::zip_first, T, U, Args... > | llvm::zip_first (T &&t, U &&u, Args &&...args) |
zip iterator that, for the sake of efficiency, assumes the first iteratee to be the shortest. More... | |
template<typename Iter > | |
Iter | llvm::detail::next_or_end (const Iter &I, const Iter &End) |
template<typename Iter > | |
auto | llvm::detail::deref_or_none (const Iter &I, const Iter &End) -> std::optional< std::remove_const_t< std::remove_reference_t< decltype(*I)>>> |
template<typename T , typename U , typename... Args> | |
detail::zip_longest_range< T, U, Args... > | llvm::zip_longest (T &&t, U &&u, Args &&... args) |
Iterate over two or more iterators at the same time. More... | |
template<typename ValueT , typename... RangeTs> | |
detail::concat_range< ValueT, RangeTs... > | llvm::concat (RangeTs &&... Ranges) |
Concatenated range across two or more ranges. More... | |
template<typename ContainerTy > | |
auto | llvm::make_first_range (ContainerTy &&c) |
Given a container of pairs, return a range over the first elements. More... | |
template<typename ContainerTy > | |
auto | llvm::make_second_range (ContainerTy &&c) |
Given a container of pairs, return a range over the second elements. More... | |
template<typename... CallableTs> | |
constexpr decltype(auto) | llvm::makeVisitor (CallableTs &&...Callables) |
Returns an opaquely-typed Callable object whose operator() overload set is the sum of the operator() overload sets of each CallableT in CallableTs. More... | |
template<class Iterator , class RNG > | |
void | llvm::shuffle (Iterator first, Iterator last, RNG &&g) |
template<typename T > | |
int | llvm::array_pod_sort_comparator (const void *P1, const void *P2) |
Adapt std::less<T> for array_pod_sort. More... | |
template<class IteratorTy > | |
void | llvm::array_pod_sort (IteratorTy Start, IteratorTy End) |
array_pod_sort - This sorts an array with the specified start and end extent. More... | |
template<class IteratorTy > | |
void | llvm::array_pod_sort (IteratorTy Start, IteratorTy End, int(*Compare)(const typename std::iterator_traits< IteratorTy >::value_type *, const typename std::iterator_traits< IteratorTy >::value_type *)) |
template<typename IteratorTy > | |
void | llvm::sort (IteratorTy Start, IteratorTy End) |
template<typename Container > | |
void | llvm::sort (Container &&C) |
template<typename IteratorTy , typename Compare > | |
void | llvm::sort (IteratorTy Start, IteratorTy End, Compare Comp) |
template<typename Container , typename Compare > | |
void | llvm::sort (Container &&C, Compare Comp) |
template<typename R > | |
auto | llvm::size (R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr) |
Get the size of a range. More... | |
template<typename R , typename UnaryFunction > | |
UnaryFunction | llvm::for_each (R &&Range, UnaryFunction F) |
Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename UnaryPredicate > | |
bool | llvm::none_of (R &&Range, UnaryPredicate P) |
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename T > | |
auto | llvm::find (R &&Range, const T &Val) |
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename UnaryPredicate > | |
auto | llvm::find_if (R &&Range, UnaryPredicate P) |
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename UnaryPredicate > | |
auto | llvm::find_if_not (R &&Range, UnaryPredicate P) |
template<typename R , typename UnaryPredicate > | |
auto | llvm::remove_if (R &&Range, UnaryPredicate P) |
Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename OutputIt , typename UnaryPredicate > | |
OutputIt | llvm::copy_if (R &&Range, OutputIt Out, UnaryPredicate P) |
Provide wrappers to std::copy_if which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename T , typename R , typename Predicate > | |
T * | llvm::find_singleton (R &&Range, Predicate P, bool AllowRepeats=false) |
Return the single value in Range that satisfies P (<member of Range> *, AllowRepeats)->T * returning nullptr when no values or multiple values were found. More... | |
template<typename T , typename R , typename Predicate > | |
std::pair< T *, bool > | llvm::find_singleton_nested (R &&Range, Predicate P, bool AllowRepeats=false) |
Return a pair consisting of the single value in Range that satisfies P (<member of Range> *, AllowRepeats)->std::pair<T*, bool> returning nullptr when no values or multiple values were found, and a bool indicating whether multiple values were found to cause the nullptr. More... | |
template<typename R , typename OutputIt > | |
OutputIt | llvm::copy (R &&Range, OutputIt Out) |
template<typename R , typename OutputIt , typename UnaryPredicate , typename T > | |
OutputIt | llvm::replace_copy_if (R &&Range, OutputIt Out, UnaryPredicate P, const T &NewValue) |
Provide wrappers to std::replace_copy_if which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename OutputIt , typename T > | |
OutputIt | llvm::replace_copy (R &&Range, OutputIt Out, const T &OldValue, const T &NewValue) |
Provide wrappers to std::replace_copy which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename OutputIt > | |
OutputIt | llvm::move (R &&Range, OutputIt Out) |
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename E > | |
bool | llvm::is_contained (R &&Range, const E &Element) |
Wrapper function around std::find to detect if an element exists in a container. More... | |
template<typename T > | |
constexpr bool | llvm::is_contained (std::initializer_list< T > Set, T Value) |
template<typename R , typename Compare > | |
bool | llvm::is_sorted (R &&Range, Compare C) |
Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a comparator C . More... | |
template<typename R > | |
bool | llvm::is_sorted (R &&Range) |
Wrapper function around std::is_sorted to check if elements in a range R are sorted in non-descending order. More... | |
template<typename R , typename E > | |
auto | llvm::count (R &&Range, const E &Element) |
Wrapper function around std::count to count the number of times an element Element occurs in the given range Range . More... | |
template<typename R , typename UnaryPredicate > | |
auto | llvm::count_if (R &&Range, UnaryPredicate P) |
Wrapper function around std::count_if to count the number of times an element satisfying a given predicate occurs in a range. More... | |
template<typename R , typename OutputIt , typename UnaryFunction > | |
OutputIt | llvm::transform (R &&Range, OutputIt d_first, UnaryFunction F) |
Wrapper function around std::transform to apply a function to a range and store the result elsewhere. More... | |
template<typename R , typename UnaryPredicate > | |
auto | llvm::partition (R &&Range, UnaryPredicate P) |
Provide wrappers to std::partition which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename T > | |
auto | llvm::lower_bound (R &&Range, T &&Value) |
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename T , typename Compare > | |
auto | llvm::lower_bound (R &&Range, T &&Value, Compare C) |
template<typename R , typename T > | |
auto | llvm::upper_bound (R &&Range, T &&Value) |
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly. More... | |
template<typename R , typename T , typename Compare > | |
auto | llvm::upper_bound (R &&Range, T &&Value, Compare C) |
template<typename R > | |
void | llvm::stable_sort (R &&Range) |
template<typename R , typename Compare > | |
void | llvm::stable_sort (R &&Range, Compare C) |
template<typename R , typename Predicate , typename Val = decltype(*adl_begin(std::declval<R>()))> | |
auto | llvm::partition_point (R &&Range, Predicate P) |
Binary search for the first iterator in a range where a predicate is false. More... | |
template<typename Range , typename Predicate > | |
auto | llvm::unique (Range &&R, Predicate P) |
template<typename L , typename R > | |
bool | llvm::equal (L &&LRange, R &&RRange) |
Wrapper function around std::equal to detect if pair-wise elements between two ranges are the same. More... | |
template<typename R > | |
bool | llvm::all_equal (R &&Range) |
Returns true if all elements in Range are equal or when the Range is empty. More... | |
template<typename Container , typename UnaryPredicate > | |
void | llvm::erase_if (Container &C, UnaryPredicate P) |
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent to: More... | |
template<typename Container , typename ValueType > | |
void | llvm::erase_value (Container &C, ValueType V) |
Wrapper function to remove a value from a container: More... | |
template<typename Container , typename Range > | |
void | llvm::append_range (Container &C, Range &&R) |
Wrapper function to append a range to a container. More... | |
template<typename Container , typename RandomAccessIterator > | |
void | llvm::replace (Container &Cont, typename Container::iterator ContIt, typename Container::iterator ContEnd, RandomAccessIterator ValIt, RandomAccessIterator ValEnd) |
Given a sequence container Cont, replace the range [ContIt, ContEnd) with the range [ValIt, ValEnd) (which is not from the same container). More... | |
template<typename Container , typename Range = std::initializer_list< typename Container::value_type>> | |
void | llvm::replace (Container &Cont, typename Container::iterator ContIt, typename Container::iterator ContEnd, Range R) |
Given a sequence container Cont, replace the range [ContIt, ContEnd) with the range R. More... | |
template<typename ForwardIterator , typename UnaryFunctor , typename NullaryFunctor , typename = std::enable_if_t< !std::is_constructible<StringRef, UnaryFunctor>::value && !std::is_constructible<StringRef, NullaryFunctor>::value>> | |
void | llvm::interleave (ForwardIterator begin, ForwardIterator end, UnaryFunctor each_fn, NullaryFunctor between_fn) |
An STL-style algorithm similar to std::for_each that applies a second functor between every pair of elements. More... | |
template<typename Container , typename UnaryFunctor , typename NullaryFunctor , typename = std::enable_if_t< !std::is_constructible<StringRef, UnaryFunctor>::value && !std::is_constructible<StringRef, NullaryFunctor>::value>> | |
void | llvm::interleave (const Container &c, UnaryFunctor each_fn, NullaryFunctor between_fn) |
template<typename Container , typename UnaryFunctor , typename StreamT , typename T = detail::ValueOfRange<Container>> | |
void | llvm::interleave (const Container &c, StreamT &os, UnaryFunctor each_fn, const StringRef &separator) |
Overload of interleave for the common case of string separator. More... | |
template<typename Container , typename StreamT , typename T = detail::ValueOfRange<Container>> | |
void | llvm::interleave (const Container &c, StreamT &os, const StringRef &separator) |
template<typename Container , typename UnaryFunctor , typename StreamT , typename T = detail::ValueOfRange<Container>> | |
void | llvm::interleaveComma (const Container &c, StreamT &os, UnaryFunctor each_fn) |
template<typename Container , typename StreamT , typename T = detail::ValueOfRange<Container>> | |
void | llvm::interleaveComma (const Container &c, StreamT &os) |
template<std::size_t i, typename R > | |
decltype(auto) | llvm::detail::get (const result_pair< R > &Pair) |
template<typename R > | |
detail::enumerator< R > | llvm::enumerate (R &&TheRange) |
Given an input range, returns a new range whose values are are pair (A,B) such that A is the 0-based index of the item in the sequence, and B is the value from the original sequence. More... | |
template<typename Predicate , typename... Args> | |
bool | llvm::detail::all_of_zip_predicate_first (Predicate &&P, Args &&...args) |
template<typename... ArgsThenPredicate, size_t... InputIndexes> | |
bool | llvm::detail::all_of_zip_predicate_last (std::tuple< ArgsThenPredicate... > argsThenPredicate, std::index_sequence< InputIndexes... >) |
template<typename... ArgsAndPredicate> | |
bool | llvm::all_of_zip (ArgsAndPredicate &&...argsAndPredicate) |
Compare two zipped ranges using the provided predicate (as last argument). More... | |
template<typename IterTy , typename Pred = bool (*)(const decltype(*std::declval<IterTy>()) &)> | |
bool | llvm::hasNItems (IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted=[](const decltype(*std::declval< IterTy >()) &) { return true;}, std::enable_if_t< !std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< std::remove_reference_t< decltype(Begin)>>::iterator_category >::value, void > *=nullptr) |
Return true if the sequence [Begin, End) has exactly N items. More... | |
template<typename IterTy , typename Pred = bool (*)(const decltype(*std::declval<IterTy>()) &)> | |
bool | llvm::hasNItemsOrMore (IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted=[](const decltype(*std::declval< IterTy >()) &) { return true;}, std::enable_if_t< !std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< std::remove_reference_t< decltype(Begin)>>::iterator_category >::value, void > *=nullptr) |
Return true if the sequence [Begin, End) has N or more items. More... | |
template<typename IterTy , typename Pred = bool (*)(const decltype(*std::declval<IterTy>()) &)> | |
bool | llvm::hasNItemsOrLess (IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted=[](const decltype(*std::declval< IterTy >()) &) { return true;}) |
Returns true if the sequence [Begin, End) has N or less items. More... | |
template<typename ContainerTy > | |
bool | llvm::hasNItems (ContainerTy &&C, unsigned N) |
Returns true if the given container has exactly N items. More... | |
template<typename ContainerTy > | |
bool | llvm::hasNItemsOrMore (ContainerTy &&C, unsigned N) |
Returns true if the given container has N or more items. More... | |
template<typename ContainerTy > | |
bool | llvm::hasNItemsOrLess (ContainerTy &&C, unsigned N) |
Returns true if the given container has N or less items. More... | |
template<class Ptr > | |
auto | llvm::to_address (const Ptr &P) |
Returns a raw pointer that represents the same address as the argument. More... | |
template<class T > | |
constexpr T * | llvm::to_address (T *P) |
Variables | |
template<typename T > | |
int(*)(const void *, const void *) | llvm::get_array_pod_sort_comparator (const T &) |
get_array_pod_sort_comparator - This is an internal helper function used to get type deduction of T right. More... | |
This file contains some templates that are useful if you are working with the STL at all.
No library is required when using these functions.
Definition in file STLExtras.h.