LLVM 20.0.0git
|
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memory), i.e. More...
#include "llvm/ADT/ArrayRef.h"
Public Types | |
using | value_type = T |
using | pointer = value_type * |
using | const_pointer = const value_type * |
using | reference = value_type & |
using | const_reference = const value_type & |
using | iterator = pointer |
using | const_iterator = const_pointer |
using | reverse_iterator = std::reverse_iterator< iterator > |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
using | size_type = size_t |
using | difference_type = ptrdiff_t |
Public Types inherited from llvm::ArrayRef< T > | |
using | value_type = T |
using | pointer = value_type * |
using | const_pointer = const value_type * |
using | reference = value_type & |
using | const_reference = const value_type & |
using | iterator = const_pointer |
using | const_iterator = const_pointer |
using | reverse_iterator = std::reverse_iterator< iterator > |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
using | size_type = size_t |
using | difference_type = ptrdiff_t |
Public Member Functions | |
MutableArrayRef ()=default | |
Construct an empty MutableArrayRef. | |
MutableArrayRef (std::nullopt_t) | |
Construct an empty MutableArrayRef from std::nullopt. | |
MutableArrayRef (T &OneElt) | |
Construct a MutableArrayRef from a single element. | |
MutableArrayRef (T *data, size_t length) | |
Construct a MutableArrayRef from a pointer and length. | |
MutableArrayRef (T *begin, T *end) | |
Construct a MutableArrayRef from a range. | |
MutableArrayRef (SmallVectorImpl< T > &Vec) | |
Construct a MutableArrayRef from a SmallVector. | |
MutableArrayRef (std::vector< T > &Vec) | |
Construct a MutableArrayRef from a std::vector. | |
template<size_t N> | |
constexpr | MutableArrayRef (std::array< T, N > &Arr) |
Construct a MutableArrayRef from a std::array. | |
template<size_t N> | |
constexpr | MutableArrayRef (T(&Arr)[N]) |
Construct a MutableArrayRef from a C array. | |
T * | data () const |
iterator | begin () const |
iterator | end () const |
reverse_iterator | rbegin () const |
reverse_iterator | rend () const |
T & | front () const |
front - Get the first element. | |
T & | back () const |
back - Get the last element. | |
MutableArrayRef< T > | slice (size_t N, size_t M) const |
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array. | |
MutableArrayRef< T > | slice (size_t N) const |
slice(n) - Chop off the first N elements of the array. | |
MutableArrayRef< T > | drop_front (size_t N=1) const |
Drop the first N elements of the array. | |
MutableArrayRef< T > | drop_back (size_t N=1) const |
template<class PredicateT > | |
MutableArrayRef< T > | drop_while (PredicateT Pred) const |
Return a copy of *this with the first N elements satisfying the given predicate removed. | |
template<class PredicateT > | |
MutableArrayRef< T > | drop_until (PredicateT Pred) const |
Return a copy of *this with the first N elements not satisfying the given predicate removed. | |
MutableArrayRef< T > | take_front (size_t N=1) const |
Return a copy of *this with only the first N elements. | |
MutableArrayRef< T > | take_back (size_t N=1) const |
Return a copy of *this with only the last N elements. | |
template<class PredicateT > | |
MutableArrayRef< T > | take_while (PredicateT Pred) const |
Return the first N elements of this Array that satisfy the given predicate. | |
template<class PredicateT > | |
MutableArrayRef< T > | take_until (PredicateT Pred) const |
Return the first N elements of this Array that don't satisfy the given predicate. | |
Operator Overloads | |
T & | operator[] (size_t Index) const |
Public Member Functions inherited from llvm::ArrayRef< T > | |
ArrayRef ()=default | |
Construct an empty ArrayRef. | |
ArrayRef (std::nullopt_t) | |
Construct an empty ArrayRef from std::nullopt. | |
ArrayRef (const T &OneElt) | |
Construct an ArrayRef from a single element. | |
constexpr | ArrayRef (const T *data, size_t length) |
Construct an ArrayRef from a pointer and length. | |
constexpr | ArrayRef (const T *begin, const T *end) |
Construct an ArrayRef from a range. | |
template<typename U > | |
ArrayRef (const SmallVectorTemplateCommon< T, U > &Vec) | |
Construct an ArrayRef from a SmallVector. | |
template<typename A > | |
ArrayRef (const std::vector< T, A > &Vec) | |
Construct an ArrayRef from a std::vector. | |
template<size_t N> | |
constexpr | ArrayRef (const std::array< T, N > &Arr) |
Construct an ArrayRef from a std::array. | |
template<size_t N> | |
constexpr | ArrayRef (const T(&Arr)[N]) |
Construct an ArrayRef from a C array. | |
constexpr | ArrayRef (const std::initializer_list< T > &Vec) |
Construct an ArrayRef from a std::initializer_list. | |
template<typename U > | |
ArrayRef (const ArrayRef< U * > &A, std::enable_if_t< std::is_convertible< U *const *, T const * >::value > *=nullptr) | |
Construct an ArrayRef<const T*> from ArrayRef<T*>. | |
template<typename U , typename DummyT > | |
ArrayRef (const SmallVectorTemplateCommon< U *, DummyT > &Vec, std::enable_if_t< std::is_convertible< U *const *, T const * >::value > *=nullptr) | |
Construct an ArrayRef<const T*> from a SmallVector<T*>. | |
template<typename U , typename A > | |
ArrayRef (const std::vector< U *, A > &Vec, std::enable_if_t< std::is_convertible< U *const *, T const * >::value > *=nullptr) | |
Construct an ArrayRef<const T*> from std::vector<T*>. | |
iterator | begin () const |
iterator | end () const |
reverse_iterator | rbegin () const |
reverse_iterator | rend () const |
bool | empty () const |
empty - Check if the array is empty. | |
const T * | data () const |
size_t | size () const |
size - Get the array size. | |
const T & | front () const |
front - Get the first element. | |
const T & | back () const |
back - Get the last element. | |
template<typename Allocator > | |
MutableArrayRef< T > | copy (Allocator &A) |
bool | equals (ArrayRef RHS) const |
equals - Check for element-wise equality. | |
ArrayRef< T > | slice (size_t N, size_t M) const |
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array. | |
ArrayRef< T > | slice (size_t N) const |
slice(n) - Chop off the first N elements of the array. | |
ArrayRef< T > | drop_front (size_t N=1) const |
Drop the first N elements of the array. | |
ArrayRef< T > | drop_back (size_t N=1) const |
Drop the last N elements of the array. | |
template<class PredicateT > | |
ArrayRef< T > | drop_while (PredicateT Pred) const |
Return a copy of *this with the first N elements satisfying the given predicate removed. | |
template<class PredicateT > | |
ArrayRef< T > | drop_until (PredicateT Pred) const |
Return a copy of *this with the first N elements not satisfying the given predicate removed. | |
ArrayRef< T > | take_front (size_t N=1) const |
Return a copy of *this with only the first N elements. | |
ArrayRef< T > | take_back (size_t N=1) const |
Return a copy of *this with only the last N elements. | |
template<class PredicateT > | |
ArrayRef< T > | take_while (PredicateT Pred) const |
Return the first N elements of this Array that satisfy the given predicate. | |
template<class PredicateT > | |
ArrayRef< T > | take_until (PredicateT Pred) const |
Return the first N elements of this Array that don't satisfy the given predicate. | |
const T & | operator[] (size_t Index) const |
template<typename U > | |
std::enable_if_t< std::is_same< U, T >::value, ArrayRef< T > > & | operator= (U &&Temporary)=delete |
Disallow accidental assignment from a temporary. | |
template<typename U > | |
std::enable_if_t< std::is_same< U, T >::value, ArrayRef< T > > & | operator= (std::initializer_list< U >)=delete |
Disallow accidental assignment from a temporary. | |
std::vector< T > | vec () const |
operator std::vector< T > () const | |
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memory), i.e.
a start pointer and a length. It allows various APIs to take and modify consecutive elements easily and conveniently.
This class does not own the underlying data, it is expected to be used in situations where the data resides in some other buffer, whose lifetime extends past that of the MutableArrayRef. For this reason, it is not in general safe to store a MutableArrayRef.
This is intended to be trivially copyable, so it should be passed by value.
Definition at line 307 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::const_iterator = const_pointer |
Definition at line 315 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::const_pointer = const value_type * |
Definition at line 311 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::const_reference = const value_type & |
Definition at line 313 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Definition at line 317 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::difference_type = ptrdiff_t |
Definition at line 319 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::iterator = pointer |
Definition at line 314 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::pointer = value_type * |
Definition at line 310 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::reference = value_type & |
Definition at line 312 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::reverse_iterator = std::reverse_iterator<iterator> |
Definition at line 316 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::size_type = size_t |
Definition at line 318 of file ArrayRef.h.
using llvm::MutableArrayRef< T >::value_type = T |
Definition at line 309 of file ArrayRef.h.
|
default |
Construct an empty MutableArrayRef.
|
inline |
Construct an empty MutableArrayRef from std::nullopt.
Definition at line 325 of file ArrayRef.h.
|
inline |
Construct a MutableArrayRef from a single element.
Definition at line 328 of file ArrayRef.h.
|
inline |
Construct a MutableArrayRef from a pointer and length.
Definition at line 331 of file ArrayRef.h.
|
inline |
Construct a MutableArrayRef from a range.
Definition at line 335 of file ArrayRef.h.
|
inline |
Construct a MutableArrayRef from a SmallVector.
Definition at line 338 of file ArrayRef.h.
|
inline |
Construct a MutableArrayRef from a std::vector.
Definition at line 342 of file ArrayRef.h.
|
inlineconstexpr |
Construct a MutableArrayRef from a std::array.
Definition at line 347 of file ArrayRef.h.
|
inlineconstexpr |
Construct a MutableArrayRef from a C array.
Definition at line 352 of file ArrayRef.h.
|
inline |
back - Get the last element.
Definition at line 369 of file ArrayRef.h.
References assert(), and llvm::size().
Referenced by llvm::performOptimizedStructLayout().
|
inline |
Definition at line 356 of file ArrayRef.h.
Referenced by combineConcatVectorOfShuffleAndItsOperands(), llvm::slpvectorizer::BoUpSLP::findReusedOrderedScalars(), llvm::lto::findThinLTOModule(), llvm::performOptimizedStructLayout(), llvm::X86FrameLowering::restoreCalleeSavedRegisters(), toUTF8(), and turnVectorIntoSplatVector().
|
inline |
Definition at line 354 of file ArrayRef.h.
Referenced by llvm::detail::IEEEFloat::convertToInteger(), llvm::object::Decompressor::decompress(), llvm::jitlink::finalizeBlockRelax(), getOpenFileImpl(), llvm::OwningArrayRef< T >::operator=(), llvm::performOptimizedStructLayout(), llvm::jitlink::Block::setMutableContent(), llvm::orc::MachOBuilderLoadCommand< MachO::LC_ID_DYLIB >::write(), llvm::orc::MachOBuilderLoadCommand< MachO::LC_LOAD_DYLIB >::write(), llvm::orc::MachOBuilderLoadCommand< MachO::LC_RPATH >::write(), llvm::MutableBinaryByteStream::writeBytes(), and llvm::OwningArrayRef< T >::~OwningArrayRef().
|
inline |
Definition at line 392 of file ArrayRef.h.
References assert(), N, and llvm::size().
|
inline |
Drop the first N
elements of the array.
Definition at line 387 of file ArrayRef.h.
References assert(), N, and llvm::size().
Referenced by llvm::AMDGPULegalizerInfo::buildMultiply(), and getOpenFileImpl().
|
inline |
Return a copy of *this with the first N elements not satisfying the given predicate removed.
Definition at line 407 of file ArrayRef.h.
References llvm::find_if().
|
inline |
Return a copy of *this with the first N elements satisfying the given predicate removed.
Definition at line 400 of file ArrayRef.h.
References llvm::find_if_not().
|
inline |
Definition at line 357 of file ArrayRef.h.
References llvm::size().
Referenced by combineConcatVectorOfShuffleAndItsOperands(), llvm::slpvectorizer::BoUpSLP::findReusedOrderedScalars(), llvm::performOptimizedStructLayout(), llvm::X86FrameLowering::restoreCalleeSavedRegisters(), toUTF8(), and turnVectorIntoSplatVector().
|
inline |
|
inline |
Definition at line 442 of file ArrayRef.h.
References assert(), Index, and llvm::size().
|
inline |
Definition at line 359 of file ArrayRef.h.
|
inline |
Definition at line 360 of file ArrayRef.h.
|
inline |
slice(n) - Chop off the first N elements of the array.
Definition at line 382 of file ArrayRef.h.
References N, and llvm::size().
|
inline |
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
Definition at line 376 of file ArrayRef.h.
References assert(), N, and llvm::size().
Referenced by llvm::insertMultibyteShift(), and multikeySort().
|
inline |
Return a copy of *this with only the last N
elements.
Definition at line 419 of file ArrayRef.h.
References N, and llvm::size().
Referenced by combineConcatVectorOfShuffleAndItsOperands(), shuffles::vdealvdd(), and shuffles::vshuffvdd().
|
inline |
Return a copy of *this with only the first N
elements.
Definition at line 412 of file ArrayRef.h.
References N, and llvm::size().
Referenced by llvm::AMDGPULegalizerInfo::buildMultiply(), combineConcatVectorOfShuffleAndItsOperands(), shuffles::vdealvdd(), and shuffles::vshuffvdd().
|
inline |
Return the first N elements of this Array that don't satisfy the given predicate.
Definition at line 435 of file ArrayRef.h.
References llvm::find_if().
|
inline |
Return the first N elements of this Array that satisfy the given predicate.
Definition at line 428 of file ArrayRef.h.
References llvm::find_if_not().