80#ifndef LLVM_ADT_SEQUENCE_H
81#define LLVM_ADT_SEQUENCE_H
114 const intmax_t BotT = intmax_t(std::numeric_limits<T>::min());
115 const intmax_t BotU = intmax_t(std::numeric_limits<U>::min());
116 const uintmax_t TopT = uintmax_t(std::numeric_limits<T>::max());
117 const uintmax_t TopU = uintmax_t(std::numeric_limits<U>::max());
118 return !((BotT > BotU && Value < static_cast<U>(BotT)) ||
119 (TopT < TopU && Value >
static_cast<U
>(TopT)));
128 template <
typename Integral,
129 std::enable_if_t<std::is_integral<Integral>::value,
bool> = 0>
131 if (!canTypeFitValue<intmax_t>(FromValue))
134 Result.Value =
static_cast<intmax_t
>(FromValue);
139 template <
typename Enum,
140 std::enable_if_t<std::is_enum<Enum>::value,
bool> = 0>
142 using type = std::underlying_type_t<Enum>;
143 return from<type>(
static_cast<type
>(FromValue));
165 template <
typename Integral,
166 std::enable_if_t<std::is_integral<Integral>::value,
bool> = 0>
167 Integral
to()
const {
168 if (!canTypeFitValue<Integral>(
Value))
170 return static_cast<Integral
>(
Value);
175 template <
typename Enum,
176 std::enable_if_t<std::is_enum<Enum>::value,
bool> = 0>
178 using type = std::underlying_type_t<Enum>;
179 return Enum(to<type>());
183 static void assertOutOfBounds() {
assert(
false &&
"Out of bounds"); }
220 const auto Copy = *
this;
225 const auto Copy = *
this;
240 return IsReverse ? O.SI - SI : SI - O.SI;
246 static intmax_t getOffset(intmax_t
Offset) {
250 CheckedInt add(intmax_t
Offset)
const {
return SI + getOffset(
Offset); }
252 void offset(intmax_t
Offset) { SI = SI + getOffset(
Offset); }
274 : BeginValue(Begin), PastEndValue(
End) {
275 assert(Begin <=
End &&
"Begin must be less or equal to End.");
280 size_t size()
const {
return PastEndValue - BeginValue; }
281 bool empty()
const {
return BeginValue == PastEndValue; }
290 static_assert(std::is_integral<T>::value || std::is_enum<T>::value,
291 "T must be an integral or enum type");
292 static_assert(std::is_same<T, std::remove_cv_t<T>>
::value,
293 "T must not be const nor volatile");
303template <typename T, typename = std::enable_if_t<std::is_integral<T>::value &&
304 !std::is_enum<T>::value>>
313template <typename T, typename = std::enable_if_t<std::is_integral<T>::value &&
314 !std::is_enum<T>::value>>
316 return seq<T>(0,
Size);
323template <typename T, typename = std::enable_if_t<std::is_integral<T>::value &&
324 !std::is_enum<T>::value>>
335template <
typename EnumT,
336 typename = std::enable_if_t<std::is_enum<EnumT>::value>>
339 "Enum type is not marked as iterable.");
350template <
typename EnumT,
351 typename = std::enable_if_t<std::is_enum<EnumT>::value>>
362template <
typename EnumT,
363 typename = std::enable_if_t<std::is_enum<EnumT>::value>>
366 "Enum type is not marked as iterable.");
377template <
typename EnumT,
378 typename = std::enable_if_t<std::is_enum<EnumT>::value>>
Given that RA is a live value
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
bool canTypeFitValue(const U Value)
This is an optimization pass for GlobalISel generic memory operations.
auto seq_inclusive(T Begin, T End)
Iterate over an integral type from Begin to End inclusive.
auto enum_seq_inclusive(EnumT Begin, EnumT End)
Iterate over an enum type from Begin to End inclusive.
auto enum_seq(EnumT Begin, EnumT End)
Iterate over an enum type from Begin up to - but not including - End.
constexpr force_iteration_on_noniterable_enum_t force_iteration_on_noniterable_enum
std::enable_if_t< std::is_signed_v< T >, T > AddOverflow(T X, T Y, T &Result)
Add two signed integers, computing the two's complement truncated result, returning true if overflow ...
auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
std::enable_if_t< std::is_signed_v< T >, T > SubOverflow(T X, T Y, T &Result)
Subtract two signed integers, computing the two's complement truncated result, returning true if an o...
static CheckedInt from(Integral FromValue)
static CheckedInt from(Enum FromValue)
bool operator!=(const CheckedInt &O) const
CheckedInt operator+(intmax_t Offset) const
bool operator==(const CheckedInt &O) const
intmax_t operator-(CheckedInt Other) const
void operator-=(intmax_t Offset)
bool operator==(const SafeIntIterator &O) const
bool operator<=(const SafeIntIterator &O) const
SafeIntIterator operator+(intmax_t Offset) const
SafeIntIterator operator--(int)
reference operator*() const
SafeIntIterator(const SafeIntIterator< T, !IsReverse > &O)
SafeIntIterator operator-(intmax_t Offset) const
void operator+=(intmax_t Offset)
bool operator>=(const SafeIntIterator &O) const
bool operator>(const SafeIntIterator &O) const
bool operator!=(const SafeIntIterator &O) const
reference operator[](intmax_t Offset) const
intmax_t operator-(const SafeIntIterator &O) const
SafeIntIterator operator++(int)
friend struct SafeIntIterator
bool operator<(const SafeIntIterator &O) const
std::random_access_iterator_tag iterator_category
static constexpr bool is_iterable
force_iteration_on_noniterable_enum_t()=default
iota_range(T Begin, T End, bool Inclusive)
reverse_iterator const_reverse_iterator
detail::SafeIntIterator< value_type, false > iterator
detail::SafeIntIterator< value_type, true > reverse_iterator