Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
ArrayRef.h
Go to the documentation of this file.
1//===- ArrayRef.h - Array Reference Wrapper ---------------------*- 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#ifndef LLVM_ADT_ARRAYREF_H
10#define LLVM_ADT_ARRAYREF_H
11
12#include "llvm/ADT/Hashing.h"
13#include "llvm/ADT/SmallVector.h"
14#include "llvm/ADT/STLExtras.h"
15#include "llvm/Support/Compiler.h"
16#include <algorithm>
17#include <array>
18#include <cassert>
19#include <cstddef>
20#include <initializer_list>
21#include <iterator>
22#include <memory>
23#include <type_traits>
24#include <vector>
25
26namespacellvm {
27template<typename T>class[[nodiscard]]MutableArrayRef;
28
29 /// ArrayRef - Represent a constant reference to an array (0 or more elements
30 /// consecutively in memory), i.e. a start pointer and a length. It allows
31 /// various APIs to take consecutive elements easily and conveniently.
32 ///
33 /// This class does not own the underlying data, it is expected to be used in
34 /// situations where the data resides in some other buffer, whose lifetime
35 /// extends past that of the ArrayRef. For this reason, it is not in general
36 /// safe to store an ArrayRef.
37 ///
38 /// This is intended to be trivially copyable, so it should be passed by
39 /// value.
40template<typename T>
41classLLVM_GSL_POINTER [[nodiscard]]ArrayRef {
42public:
43usingvalue_type =T;
44usingpointer =value_type *;
45usingconst_pointer =constvalue_type *;
46usingreference =value_type &;
47usingconst_reference =constvalue_type &;
48usingiterator =const_pointer;
49usingconst_iterator =const_pointer;
50usingreverse_iterator = std::reverse_iterator<iterator>;
51usingconst_reverse_iterator = std::reverse_iterator<const_iterator>;
52usingsize_type = size_t;
53usingdifference_type =ptrdiff_t;
54
55private:
56 /// The start of the array, in an external buffer.
57constT *Data =nullptr;
58
59 /// The number of elements.
60size_typeLength = 0;
61
62public:
63 /// @name Constructors
64 /// @{
65
66 /// Construct an empty ArrayRef.
67/*implicit*/ArrayRef() =default;
68
69 /// Construct an empty ArrayRef from std::nullopt.
70/*implicit*/ArrayRef(std::nullopt_t) {}
71
72 /// Construct an ArrayRef from a single element.
73/*implicit*/ArrayRef(constT &OneEltLLVM_LIFETIME_BOUND)
74 : Data(&OneElt),Length(1) {}
75
76 /// Construct an ArrayRef from a pointer and length.
77constexpr/*implicit*/ArrayRef(constT *dataLLVM_LIFETIME_BOUND,
78size_t length)
79 : Data(data),Length(length) {}
80
81 /// Construct an ArrayRef from a range.
82constexprArrayRef(constT *beginLLVM_LIFETIME_BOUND,constT *end)
83 : Data(begin),Length(end - begin) {
84assert(begin <= end);
85 }
86
87 /// Construct an ArrayRef from a SmallVector. This is templated in order to
88 /// avoid instantiating SmallVectorTemplateCommon<T> whenever we
89 /// copy-construct an ArrayRef.
90template<typename U>
91/*implicit*/ArrayRef(constSmallVectorTemplateCommon<T, U> &Vec)
92 : Data(Vec.data()),Length(Vec.size()) {
93 }
94
95 /// Construct an ArrayRef from a std::vector.
96template<typename A>
97/*implicit*/ArrayRef(const std::vector<T, A> &Vec)
98 : Data(Vec.data()),Length(Vec.size()) {}
99
100 /// Construct an ArrayRef from a std::array
101template <size_t N>
102/*implicit*/constexprArrayRef(const std::array<T, N> &Arr)
103 : Data(Arr.data()),Length(N) {}
104
105 /// Construct an ArrayRef from a C array.
106template <size_t N>
107/*implicit*/constexprArrayRef(constT (&ArrLLVM_LIFETIME_BOUND)[N])
108 : Data(Arr),Length(N) {}
109
110 /// Construct an ArrayRef from a std::initializer_list.
111#if LLVM_GNUC_PREREQ(9, 0, 0)
112// Disable gcc's warning in this constructor as it generates an enormous amount
113// of messages. Anyone using ArrayRef should already be aware of the fact that
114// it does not do lifetime extension.
115#pragma GCC diagnostic push
116#pragma GCC diagnostic ignored "-Winit-list-lifetime"
117#endif
118constexpr/*implicit*/ArrayRef(
119 std::initializer_list<T> VecLLVM_LIFETIME_BOUND)
120 : Data(Vec.begin() == Vec.end() ? (T *)nullptr : Vec.begin()),
121Length(Vec.size()) {}
122#if LLVM_GNUC_PREREQ(9, 0, 0)
123#pragma GCC diagnostic pop
124#endif
125
126 /// Construct an ArrayRef<const T*> from ArrayRef<T*>. This uses SFINAE to
127 /// ensure that only ArrayRefs of pointers can be converted.
128template <typename U>
129ArrayRef(constArrayRef<U *> &A,
130 std::enable_if_t<std::is_convertible<U *const *, T const *>::value>
131 * =nullptr)
132 : Data(A.data()),Length(A.size()) {}
133
134 /// Construct an ArrayRef<const T*> from a SmallVector<T*>. This is
135 /// templated in order to avoid instantiating SmallVectorTemplateCommon<T>
136 /// whenever we copy-construct an ArrayRef.
137template <typename U,typename DummyT>
138/*implicit*/ArrayRef(
139constSmallVectorTemplateCommon<U *, DummyT> &Vec,
140 std::enable_if_t<std::is_convertible<U *const *, T const *>::value> * =
141nullptr)
142 : Data(Vec.data()),Length(Vec.size()) {}
143
144 /// Construct an ArrayRef<const T*> from std::vector<T*>. This uses SFINAE
145 /// to ensure that only vectors of pointers can be converted.
146template <typename U,typename A>
147ArrayRef(const std::vector<U *, A> &Vec,
148 std::enable_if_t<std::is_convertible<U *const *, T const *>::value>
149 * =nullptr)
150 : Data(Vec.data()),Length(Vec.size()) {}
151
152 /// @}
153 /// @name Simple Operations
154 /// @{
155
156iteratorbegin() const{return Data; }
157iteratorend() const{return Data +Length; }
158
159reverse_iteratorrbegin() const{returnreverse_iterator(end()); }
160reverse_iteratorrend() const{returnreverse_iterator(begin()); }
161
162 /// empty - Check if the array is empty.
163boolempty() const{returnLength == 0; }
164
165constT *data() const{return Data; }
166
167 /// size - Get the array size.
168size_tsize() const{returnLength; }
169
170 /// front - Get the first element.
171constT &front() const{
172assert(!empty());
173return Data[0];
174 }
175
176 /// back - Get the last element.
177constT &back() const{
178assert(!empty());
179return Data[Length-1];
180 }
181
182// copy - Allocate copy in Allocator and return ArrayRef<T> to it.
183template <typename Allocator>MutableArrayRef<T>copy(Allocator &A) {
184T *Buff =A.template Allocate<T>(Length);
185 std::uninitialized_copy(begin(), end(), Buff);
186returnMutableArrayRef<T>(Buff,Length);
187 }
188
189 /// equals - Check for element-wise equality.
190boolequals(ArrayRefRHS) const{
191if (Length !=RHS.Length)
192returnfalse;
193return std::equal(begin(), end(),RHS.begin());
194 }
195
196 /// slice(n, m) - Chop off the first N elements of the array, and keep M
197 /// elements in the array.
198ArrayRef<T>slice(size_tN,size_t M) const{
199assert(N+M <=size() &&"Invalid specifier");
200returnArrayRef<T>(data()+N, M);
201 }
202
203 /// slice(n) - Chop off the first N elements of the array.
204ArrayRef<T>slice(size_tN) const{return drop_front(N); }
205
206 /// Drop the first \p N elements of the array.
207ArrayRef<T>drop_front(size_tN = 1) const{
208assert(size() >=N &&"Dropping more elements than exist");
209return slice(N,size() -N);
210 }
211
212 /// Drop the last \p N elements of the array.
213ArrayRef<T>drop_back(size_tN = 1) const{
214assert(size() >=N &&"Dropping more elements than exist");
215return slice(0,size() -N);
216 }
217
218 /// Return a copy of *this with the first N elements satisfying the
219 /// given predicate removed.
220template <class PredicateT>ArrayRef<T>drop_while(PredicateT Pred) const{
221returnArrayRef<T>(find_if_not(*this, Pred), end());
222 }
223
224 /// Return a copy of *this with the first N elements not satisfying
225 /// the given predicate removed.
226template <class PredicateT>ArrayRef<T>drop_until(PredicateT Pred) const{
227returnArrayRef<T>(find_if(*this, Pred), end());
228 }
229
230 /// Return a copy of *this with only the first \p N elements.
231ArrayRef<T>take_front(size_tN = 1) const{
232if (N >=size())
233return *this;
234return drop_back(size() -N);
235 }
236
237 /// Return a copy of *this with only the last \p N elements.
238ArrayRef<T>take_back(size_tN = 1) const{
239if (N >=size())
240return *this;
241return drop_front(size() -N);
242 }
243
244 /// Return the first N elements of this Array that satisfy the given
245 /// predicate.
246template <class PredicateT>ArrayRef<T>take_while(PredicateT Pred) const{
247returnArrayRef<T>(begin(),find_if_not(*this, Pred));
248 }
249
250 /// Return the first N elements of this Array that don't satisfy the
251 /// given predicate.
252template <class PredicateT>ArrayRef<T>take_until(PredicateT Pred) const{
253returnArrayRef<T>(begin(),find_if(*this, Pred));
254 }
255
256 /// @}
257 /// @name Operator Overloads
258 /// @{
259constT &operator[](size_tIndex) const{
260assert(Index <Length &&"Invalid index!");
261return Data[Index];
262 }
263
264 /// Disallow accidental assignment from a temporary.
265 ///
266 /// The declaration here is extra complicated so that "arrayRef = {}"
267 /// continues to select the move assignment operator.
268template <typename U>
269 std::enable_if_t<std::is_same<U, T>::value,ArrayRef<T>> &
270operator=(U &&Temporary) =delete;
271
272 /// Disallow accidental assignment from a temporary.
273 ///
274 /// The declaration here is extra complicated so that "arrayRef = {}"
275 /// continues to select the move assignment operator.
276template <typename U>
277 std::enable_if_t<std::is_same<U, T>::value,ArrayRef<T>> &
278operator=(std::initializer_list<U>) =delete;
279
280 /// @}
281 /// @name Expensive Operations
282 /// @{
283 std::vector<T>vec() const{
284return std::vector<T>(Data, Data+Length);
285 }
286
287 /// @}
288 /// @name Conversion operators
289 /// @{
290operator std::vector<T>() const{
291return std::vector<T>(Data, Data+Length);
292 }
293
294 /// @}
295 };
296
297 /// MutableArrayRef - Represent a mutable reference to an array (0 or more
298 /// elements consecutively in memory), i.e. a start pointer and a length. It
299 /// allows various APIs to take and modify consecutive elements easily and
300 /// conveniently.
301 ///
302 /// This class does not own the underlying data, it is expected to be used in
303 /// situations where the data resides in some other buffer, whose lifetime
304 /// extends past that of the MutableArrayRef. For this reason, it is not in
305 /// general safe to store a MutableArrayRef.
306 ///
307 /// This is intended to be trivially copyable, so it should be passed by
308 /// value.
309template<typename T>
310class[[nodiscard]]MutableArrayRef :publicArrayRef<T> {
311public:
312usingvalue_type =T;
313usingpointer =value_type *;
314usingconst_pointer =constvalue_type *;
315usingreference =value_type &;
316usingconst_reference =constvalue_type &;
317usingiterator =pointer;
318usingconst_iterator =const_pointer;
319usingreverse_iterator = std::reverse_iterator<iterator>;
320usingconst_reverse_iterator = std::reverse_iterator<const_iterator>;
321usingsize_type = size_t;
322usingdifference_type =ptrdiff_t;
323
324 /// Construct an empty MutableArrayRef.
325/*implicit*/MutableArrayRef() =default;
326
327 /// Construct an empty MutableArrayRef from std::nullopt.
328/*implicit*/MutableArrayRef(std::nullopt_t) :ArrayRef<T>() {}
329
330 /// Construct a MutableArrayRef from a single element.
331/*implicit*/MutableArrayRef(T &OneElt) :ArrayRef<T>(OneElt) {}
332
333 /// Construct a MutableArrayRef from a pointer and length.
334/*implicit*/MutableArrayRef(T *data,size_t length)
335 :ArrayRef<T>(data, length) {}
336
337 /// Construct a MutableArrayRef from a range.
338MutableArrayRef(T *begin,T *end) :ArrayRef<T>(begin, end) {}
339
340 /// Construct a MutableArrayRef from a SmallVector.
341/*implicit*/MutableArrayRef(SmallVectorImpl<T> &Vec)
342 :ArrayRef<T>(Vec) {}
343
344 /// Construct a MutableArrayRef from a std::vector.
345/*implicit*/MutableArrayRef(std::vector<T> &Vec)
346 :ArrayRef<T>(Vec) {}
347
348 /// Construct a MutableArrayRef from a std::array
349template <size_t N>
350/*implicit*/constexprMutableArrayRef(std::array<T, N> &Arr)
351 :ArrayRef<T>(Arr) {}
352
353 /// Construct a MutableArrayRef from a C array.
354template <size_t N>
355/*implicit*/constexprMutableArrayRef(T (&Arr)[N]) :ArrayRef<T>(Arr) {}
356
357T *data() const{returnconst_cast<T*>(ArrayRef<T>::data()); }
358
359iteratorbegin() const{returndata(); }
360iteratorend() const{returndata() + this->size(); }
361
362reverse_iteratorrbegin() const{returnreverse_iterator(end()); }
363reverse_iteratorrend() const{returnreverse_iterator(begin()); }
364
365 /// front - Get the first element.
366T &front() const{
367assert(!this->empty());
368returndata()[0];
369 }
370
371 /// back - Get the last element.
372T &back() const{
373assert(!this->empty());
374returndata()[this->size()-1];
375 }
376
377 /// slice(n, m) - Chop off the first N elements of the array, and keep M
378 /// elements in the array.
379MutableArrayRef<T>slice(size_tN,size_t M) const{
380assert(N + M <= this->size() &&"Invalid specifier");
381returnMutableArrayRef<T>(this->data() + N, M);
382 }
383
384 /// slice(n) - Chop off the first N elements of the array.
385MutableArrayRef<T>slice(size_tN) const{
386return slice(N, this->size() -N);
387 }
388
389 /// Drop the first \p N elements of the array.
390MutableArrayRef<T>drop_front(size_tN = 1) const{
391assert(this->size() >=N &&"Dropping more elements than exist");
392return slice(N, this->size() -N);
393 }
394
395MutableArrayRef<T>drop_back(size_tN = 1) const{
396assert(this->size() >=N &&"Dropping more elements than exist");
397return slice(0, this->size() -N);
398 }
399
400 /// Return a copy of *this with the first N elements satisfying the
401 /// given predicate removed.
402template <class PredicateT>
403MutableArrayRef<T>drop_while(PredicateT Pred) const{
404returnMutableArrayRef<T>(find_if_not(*this, Pred), end());
405 }
406
407 /// Return a copy of *this with the first N elements not satisfying
408 /// the given predicate removed.
409template <class PredicateT>
410MutableArrayRef<T>drop_until(PredicateT Pred) const{
411returnMutableArrayRef<T>(find_if(*this, Pred), end());
412 }
413
414 /// Return a copy of *this with only the first \p N elements.
415MutableArrayRef<T>take_front(size_tN = 1) const{
416if (N >= this->size())
417return *this;
418return drop_back(this->size() -N);
419 }
420
421 /// Return a copy of *this with only the last \p N elements.
422MutableArrayRef<T>take_back(size_tN = 1) const{
423if (N >= this->size())
424return *this;
425return drop_front(this->size() -N);
426 }
427
428 /// Return the first N elements of this Array that satisfy the given
429 /// predicate.
430template <class PredicateT>
431MutableArrayRef<T>take_while(PredicateT Pred) const{
432returnMutableArrayRef<T>(begin(),find_if_not(*this, Pred));
433 }
434
435 /// Return the first N elements of this Array that don't satisfy the
436 /// given predicate.
437template <class PredicateT>
438MutableArrayRef<T>take_until(PredicateT Pred) const{
439returnMutableArrayRef<T>(begin(),find_if(*this, Pred));
440 }
441
442 /// @}
443 /// @name Operator Overloads
444 /// @{
445T &operator[](size_tIndex) const{
446assert(Index < this->size() &&"Invalid index!");
447returndata()[Index];
448 }
449 };
450
451 /// This is a MutableArrayRef that owns its array.
452template <typename T>classOwningArrayRef :publicMutableArrayRef<T> {
453public:
454OwningArrayRef() =default;
455OwningArrayRef(size_tSize) :MutableArrayRef<T>(newT[Size],Size) {}
456
457OwningArrayRef(ArrayRef<T> Data)
458 :MutableArrayRef<T>(newT[Data.size()], Data.size()) {
459 std::copy(Data.begin(), Data.end(), this->begin());
460 }
461
462OwningArrayRef(OwningArrayRef &&Other) { *this = std::move(Other); }
463
464OwningArrayRef &operator=(OwningArrayRef &&Other) {
465delete[] this->data();
466 this->MutableArrayRef<T>::operator=(Other);
467Other.MutableArrayRef<T>::operator=(MutableArrayRef<T>());
468return *this;
469 }
470
471~OwningArrayRef() {delete[] this->data(); }
472 };
473
474 /// @name ArrayRef Deduction guides
475 /// @{
476 /// Deduction guide to construct an ArrayRef from a single element.
477template <typename T>ArrayRef(constT &OneElt) ->ArrayRef<T>;
478
479 /// Deduction guide to construct an ArrayRef from a pointer and length
480template <typename T>ArrayRef(constT *data,size_t length) ->ArrayRef<T>;
481
482 /// Deduction guide to construct an ArrayRef from a range
483template <typename T>ArrayRef(constT *data,constT *end) ->ArrayRef<T>;
484
485 /// Deduction guide to construct an ArrayRef from a SmallVector
486template <typename T>ArrayRef(constSmallVectorImpl<T> &Vec) ->ArrayRef<T>;
487
488 /// Deduction guide to construct an ArrayRef from a SmallVector
489template <typename T,unsigned N>
490ArrayRef(constSmallVector<T, N> &Vec) ->ArrayRef<T>;
491
492 /// Deduction guide to construct an ArrayRef from a std::vector
493template <typename T>ArrayRef(const std::vector<T> &Vec) ->ArrayRef<T>;
494
495 /// Deduction guide to construct an ArrayRef from a std::array
496template <typename T, std::size_t N>
497ArrayRef(const std::array<T, N> &Vec) ->ArrayRef<T>;
498
499 /// Deduction guide to construct an ArrayRef from an ArrayRef (const)
500template <typename T>ArrayRef(constArrayRef<T> &Vec) ->ArrayRef<T>;
501
502 /// Deduction guide to construct an ArrayRef from an ArrayRef
503template <typename T>ArrayRef(ArrayRef<T> &Vec) ->ArrayRef<T>;
504
505 /// Deduction guide to construct an ArrayRef from a C array.
506template <typename T,size_t N>ArrayRef(constT (&Arr)[N]) ->ArrayRef<T>;
507
508 /// @}
509
510 /// @name MutableArrayRef Deduction guides
511 /// @{
512 /// Deduction guide to construct a `MutableArrayRef` from a single element
513template <class T>MutableArrayRef(T &OneElt) ->MutableArrayRef<T>;
514
515 /// Deduction guide to construct a `MutableArrayRef` from a pointer and
516 /// length.
517template <class T>
518MutableArrayRef(T *data,size_t length) ->MutableArrayRef<T>;
519
520 /// Deduction guide to construct a `MutableArrayRef` from a `SmallVector`.
521template <class T>
522MutableArrayRef(SmallVectorImpl<T> &Vec) ->MutableArrayRef<T>;
523
524template <class T,unsigned N>
525MutableArrayRef(SmallVector<T, N> &Vec) ->MutableArrayRef<T>;
526
527 /// Deduction guide to construct a `MutableArrayRef` from a `std::vector`.
528template <class T>MutableArrayRef(std::vector<T> &Vec) ->MutableArrayRef<T>;
529
530 /// Deduction guide to construct a `MutableArrayRef` from a `std::array`.
531template <class T, std::size_t N>
532MutableArrayRef(std::array<T, N> &Vec) ->MutableArrayRef<T>;
533
534 /// Deduction guide to construct a `MutableArrayRef` from a C array.
535template <typename T,size_t N>
536MutableArrayRef(T (&Arr)[N]) ->MutableArrayRef<T>;
537
538 /// @}
539 /// @name ArrayRef Comparison Operators
540 /// @{
541
542template<typename T>
543inlinebooloperator==(ArrayRef<T>LHS,ArrayRef<T>RHS) {
544returnLHS.equals(RHS);
545 }
546
547template <typename T>
548inlinebooloperator==(SmallVectorImpl<T> &LHS,ArrayRef<T>RHS) {
549returnArrayRef<T>(LHS).equals(RHS);
550 }
551
552template <typename T>
553inlinebooloperator!=(ArrayRef<T>LHS,ArrayRef<T>RHS) {
554return !(LHS ==RHS);
555 }
556
557template <typename T>
558inlinebooloperator!=(SmallVectorImpl<T> &LHS,ArrayRef<T>RHS) {
559return !(LHS ==RHS);
560 }
561
562 /// @}
563
564template <typename T>hash_codehash_value(ArrayRef<T> S) {
565returnhash_combine_range(S.begin(), S.end());
566 }
567
568// Provide DenseMapInfo for ArrayRefs.
569template <typename T>structDenseMapInfo<ArrayRef<T>, void> {
570staticinlineArrayRef<T>getEmptyKey() {
571returnArrayRef<T>(
572reinterpret_cast<constT *>(~static_cast<uintptr_t>(0)),size_t(0));
573 }
574
575staticinlineArrayRef<T>getTombstoneKey() {
576returnArrayRef<T>(
577reinterpret_cast<constT *>(~static_cast<uintptr_t>(1)),size_t(0));
578 }
579
580staticunsignedgetHashValue(ArrayRef<T> Val) {
581assert(Val.data() != getEmptyKey().data() &&
582"Cannot hash the empty key!");
583assert(Val.data() != getTombstoneKey().data() &&
584"Cannot hash the tombstone key!");
585return (unsigned)(hash_value(Val));
586 }
587
588staticboolisEqual(ArrayRef<T>LHS,ArrayRef<T>RHS) {
589if (RHS.data() == getEmptyKey().data())
590returnLHS.data() == getEmptyKey().data();
591if (RHS.data() == getTombstoneKey().data())
592returnLHS.data() == getTombstoneKey().data();
593returnLHS ==RHS;
594 }
595 };
596
597}// end namespace llvm
598
599#endif// LLVM_ADT_ARRAYREF_H
A
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Compiler.h
LLVM_LIFETIME_BOUND
#define LLVM_LIFETIME_BOUND
Definition:Compiler.h:419
LLVM_GSL_POINTER
#define LLVM_GSL_POINTER
LLVM_GSL_POINTER - Apply this to non-owning classes like StringRef to enable lifetime warnings.
Definition:Compiler.h:413
Index
uint32_t Index
Definition:ELFObjHandler.cpp:83
Size
uint64_t Size
Definition:ELFObjHandler.cpp:81
Hashing.h
T
#define T
Definition:Mips16ISelLowering.cpp:341
Allocator
Basic Register Allocator
Definition:RegAllocBasic.cpp:146
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
STLExtras.h
This file contains some templates that are useful if you are working with the STL at all.
SmallVector.h
This file defines the SmallVector class.
data
static Split data
Definition:StaticDataSplitter.cpp:176
RHS
Value * RHS
Definition:X86PartialReduction.cpp:74
LHS
Value * LHS
Definition:X86PartialReduction.cpp:73
PredicateT
T
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::ArrayRef::operator=
std::enable_if_t< std::is_same< U, T >::value, ArrayRef< T > > & operator=(std::initializer_list< U >)=delete
Disallow accidental assignment from a temporary.
llvm::ArrayRef::size_type
size_t size_type
Definition:ArrayRef.h:52
llvm::ArrayRef::vec
std::vector< T > vec() const
Definition:ArrayRef.h:283
llvm::ArrayRef::equals
bool equals(ArrayRef RHS) const
equals - Check for element-wise equality.
Definition:ArrayRef.h:190
llvm::ArrayRef::drop_while
ArrayRef< T > drop_while(PredicateT Pred) const
Return a copy of *this with the first N elements satisfying the given predicate removed.
Definition:ArrayRef.h:220
llvm::ArrayRef::back
const T & back() const
back - Get the last element.
Definition:ArrayRef.h:177
llvm::ArrayRef::ArrayRef
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*>.
Definition:ArrayRef.h:147
llvm::ArrayRef::take_front
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
Definition:ArrayRef.h:231
llvm::ArrayRef::ArrayRef
constexpr ArrayRef(std::initializer_list< T > Vec LLVM_LIFETIME_BOUND)
Construct an ArrayRef from a std::initializer_list.
Definition:ArrayRef.h:118
llvm::ArrayRef::copy
MutableArrayRef< T > copy(Allocator &A)
Definition:ArrayRef.h:183
llvm::ArrayRef::drop_front
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
Definition:ArrayRef.h:207
llvm::ArrayRef::slice
ArrayRef< T > slice(size_t N) const
slice(n) - Chop off the first N elements of the array.
Definition:ArrayRef.h:204
llvm::ArrayRef::rend
reverse_iterator rend() const
Definition:ArrayRef.h:160
llvm::ArrayRef::front
const T & front() const
front - Get the first element.
Definition:ArrayRef.h:171
llvm::ArrayRef::take_while
ArrayRef< T > take_while(PredicateT Pred) const
Return the first N elements of this Array that satisfy the given predicate.
Definition:ArrayRef.h:246
llvm::ArrayRef::ArrayRef
ArrayRef(const T &OneElt LLVM_LIFETIME_BOUND)
Construct an ArrayRef from a single element.
Definition:ArrayRef.h:73
llvm::ArrayRef::ArrayRef
constexpr ArrayRef(const T *begin LLVM_LIFETIME_BOUND, const T *end)
Construct an ArrayRef from a range.
Definition:ArrayRef.h:82
llvm::ArrayRef::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition:ArrayRef.h:51
llvm::ArrayRef::end
iterator end() const
Definition:ArrayRef.h:157
llvm::ArrayRef::take_until
ArrayRef< T > take_until(PredicateT Pred) const
Return the first N elements of this Array that don't satisfy the given predicate.
Definition:ArrayRef.h:252
llvm::ArrayRef::drop_until
ArrayRef< T > drop_until(PredicateT Pred) const
Return a copy of *this with the first N elements not satisfying the given predicate removed.
Definition:ArrayRef.h:226
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition:ArrayRef.h:168
llvm::ArrayRef::ArrayRef
ArrayRef()=default
Construct an empty ArrayRef.
llvm::ArrayRef::ArrayRef
ArrayRef(std::nullopt_t)
Construct an empty ArrayRef from std::nullopt.
Definition:ArrayRef.h:70
llvm::ArrayRef::ArrayRef
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*>.
Definition:ArrayRef.h:129
llvm::ArrayRef::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition:ArrayRef.h:50
llvm::ArrayRef::drop_back
ArrayRef< T > drop_back(size_t N=1) const
Drop the last N elements of the array.
Definition:ArrayRef.h:213
llvm::ArrayRef::begin
iterator begin() const
Definition:ArrayRef.h:156
llvm::ArrayRef::ArrayRef
constexpr ArrayRef(const std::array< T, N > &Arr)
Construct an ArrayRef from a std::array.
Definition:ArrayRef.h:102
llvm::ArrayRef::take_back
ArrayRef< T > take_back(size_t N=1) const
Return a copy of *this with only the last N elements.
Definition:ArrayRef.h:238
llvm::ArrayRef::empty
bool empty() const
empty - Check if the array is empty.
Definition:ArrayRef.h:163
llvm::ArrayRef::ArrayRef
constexpr ArrayRef(const T(&Arr LLVM_LIFETIME_BOUND)[N])
Construct an ArrayRef from a C array.
Definition:ArrayRef.h:107
llvm::ArrayRef::ArrayRef
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*>.
Definition:ArrayRef.h:138
llvm::ArrayRef::ArrayRef
constexpr ArrayRef(const T *data LLVM_LIFETIME_BOUND, size_t length)
Construct an ArrayRef from a pointer and length.
Definition:ArrayRef.h:77
llvm::ArrayRef::operator[]
const T & operator[](size_t Index) const
Definition:ArrayRef.h:259
llvm::ArrayRef::ArrayRef
ArrayRef(const std::vector< T, A > &Vec)
Construct an ArrayRef from a std::vector.
Definition:ArrayRef.h:97
llvm::ArrayRef::data
const T * data() const
Definition:ArrayRef.h:165
llvm::ArrayRef::operator=
std::enable_if_t< std::is_same< U, T >::value, ArrayRef< T > > & operator=(U &&Temporary)=delete
Disallow accidental assignment from a temporary.
llvm::ArrayRef::rbegin
reverse_iterator rbegin() const
Definition:ArrayRef.h:159
llvm::ArrayRef::slice
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.
Definition:ArrayRef.h:198
llvm::ArrayRef::ArrayRef
ArrayRef(const SmallVectorTemplateCommon< T, U > &Vec)
Construct an ArrayRef from a SmallVector.
Definition:ArrayRef.h:91
llvm::MutableArrayRef
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition:ArrayRef.h:310
llvm::MutableArrayRef::data
T * data() const
Definition:ArrayRef.h:357
llvm::MutableArrayRef::take_until
MutableArrayRef< T > take_until(PredicateT Pred) const
Return the first N elements of this Array that don't satisfy the given predicate.
Definition:ArrayRef.h:438
llvm::MutableArrayRef::MutableArrayRef
MutableArrayRef(T &OneElt)
Construct a MutableArrayRef from a single element.
Definition:ArrayRef.h:331
llvm::MutableArrayRef::drop_front
MutableArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
Definition:ArrayRef.h:390
llvm::MutableArrayRef::take_back
MutableArrayRef< T > take_back(size_t N=1) const
Return a copy of *this with only the last N elements.
Definition:ArrayRef.h:422
llvm::MutableArrayRef::rbegin
reverse_iterator rbegin() const
Definition:ArrayRef.h:362
llvm::MutableArrayRef::MutableArrayRef
MutableArrayRef(T *begin, T *end)
Construct a MutableArrayRef from a range.
Definition:ArrayRef.h:338
llvm::MutableArrayRef::slice
MutableArrayRef< T > slice(size_t N) const
slice(n) - Chop off the first N elements of the array.
Definition:ArrayRef.h:385
llvm::MutableArrayRef::MutableArrayRef
MutableArrayRef(T *data, size_t length)
Construct a MutableArrayRef from a pointer and length.
Definition:ArrayRef.h:334
llvm::MutableArrayRef::MutableArrayRef
MutableArrayRef()=default
Construct an empty MutableArrayRef.
llvm::MutableArrayRef::MutableArrayRef
constexpr MutableArrayRef(std::array< T, N > &Arr)
Construct a MutableArrayRef from a std::array.
Definition:ArrayRef.h:350
llvm::MutableArrayRef::front
T & front() const
front - Get the first element.
Definition:ArrayRef.h:366
llvm::MutableArrayRef::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition:ArrayRef.h:320
llvm::MutableArrayRef::size_type
size_t size_type
Definition:ArrayRef.h:321
llvm::MutableArrayRef::end
iterator end() const
Definition:ArrayRef.h:360
llvm::MutableArrayRef::begin
iterator begin() const
Definition:ArrayRef.h:359
llvm::MutableArrayRef::operator[]
T & operator[](size_t Index) const
Definition:ArrayRef.h:445
llvm::MutableArrayRef::back
T & back() const
back - Get the last element.
Definition:ArrayRef.h:372
llvm::MutableArrayRef::MutableArrayRef
MutableArrayRef(std::vector< T > &Vec)
Construct a MutableArrayRef from a std::vector.
Definition:ArrayRef.h:345
llvm::MutableArrayRef::MutableArrayRef
constexpr MutableArrayRef(T(&Arr)[N])
Construct a MutableArrayRef from a C array.
Definition:ArrayRef.h:355
llvm::MutableArrayRef::MutableArrayRef
MutableArrayRef(SmallVectorImpl< T > &Vec)
Construct a MutableArrayRef from a SmallVector.
Definition:ArrayRef.h:341
llvm::MutableArrayRef::drop_back
MutableArrayRef< T > drop_back(size_t N=1) const
Definition:ArrayRef.h:395
llvm::MutableArrayRef::take_while
MutableArrayRef< T > take_while(PredicateT Pred) const
Return the first N elements of this Array that satisfy the given predicate.
Definition:ArrayRef.h:431
llvm::MutableArrayRef::slice
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.
Definition:ArrayRef.h:379
llvm::MutableArrayRef::drop_while
MutableArrayRef< T > drop_while(PredicateT Pred) const
Return a copy of *this with the first N elements satisfying the given predicate removed.
Definition:ArrayRef.h:403
llvm::MutableArrayRef::rend
reverse_iterator rend() const
Definition:ArrayRef.h:363
llvm::MutableArrayRef::drop_until
MutableArrayRef< T > drop_until(PredicateT Pred) const
Return a copy of *this with the first N elements not satisfying the given predicate removed.
Definition:ArrayRef.h:410
llvm::MutableArrayRef::take_front
MutableArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
Definition:ArrayRef.h:415
llvm::MutableArrayRef::MutableArrayRef
MutableArrayRef(std::nullopt_t)
Construct an empty MutableArrayRef from std::nullopt.
Definition:ArrayRef.h:328
llvm::MutableArrayRef::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition:ArrayRef.h:319
llvm::OwningArrayRef
This is a MutableArrayRef that owns its array.
Definition:ArrayRef.h:452
llvm::OwningArrayRef::operator=
OwningArrayRef & operator=(OwningArrayRef &&Other)
Definition:ArrayRef.h:464
llvm::OwningArrayRef::OwningArrayRef
OwningArrayRef(OwningArrayRef &&Other)
Definition:ArrayRef.h:462
llvm::OwningArrayRef::~OwningArrayRef
~OwningArrayRef()
Definition:ArrayRef.h:471
llvm::OwningArrayRef::OwningArrayRef
OwningArrayRef()=default
llvm::OwningArrayRef::OwningArrayRef
OwningArrayRef(ArrayRef< T > Data)
Definition:ArrayRef.h:457
llvm::OwningArrayRef::OwningArrayRef
OwningArrayRef(size_t Size)
Definition:ArrayRef.h:455
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::SmallVectorTemplateCommon
This is the part of SmallVectorTemplateBase which does not depend on whether the type T is a POD.
Definition:SmallVector.h:121
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::hash_code
An opaque object representing a hash code.
Definition:Hashing.h:75
ptrdiff_t
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::Length
@ Length
Definition:DWP.cpp:480
llvm::hash_value
hash_code hash_value(const FixedPointSemantics &Val)
Definition:APFixedPoint.h:136
llvm::size
auto 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.
Definition:STLExtras.h:1697
llvm::operator!=
bool operator!=(uint64_t V1, const APInt &V2)
Definition:APInt.h:2082
llvm::operator==
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
Definition:AddressRanges.h:153
llvm::find_if_not
auto find_if_not(R &&Range, UnaryPredicate P)
Definition:STLExtras.h:1771
llvm::MutableArrayRef
MutableArrayRef(T &OneElt) -> MutableArrayRef< T >
llvm::IRMemLocation::Other
@ Other
Any other memory.
llvm::find_if
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1766
llvm::hash_combine_range
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
Definition:Hashing.h:468
N
#define N
llvm::DenseMapInfo< ArrayRef< T >, void >::isEqual
static bool isEqual(ArrayRef< T > LHS, ArrayRef< T > RHS)
Definition:ArrayRef.h:588
llvm::DenseMapInfo< ArrayRef< T >, void >::getTombstoneKey
static ArrayRef< T > getTombstoneKey()
Definition:ArrayRef.h:575
llvm::DenseMapInfo< ArrayRef< T >, void >::getHashValue
static unsigned getHashValue(ArrayRef< T > Val)
Definition:ArrayRef.h:580
llvm::DenseMapInfo< ArrayRef< T >, void >::getEmptyKey
static ArrayRef< T > getEmptyKey()
Definition:ArrayRef.h:570
llvm::DenseMapInfo
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition:DenseMapInfo.h:52

Generated on Thu Jul 17 2025 03:52:02 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp