LLVM 20.0.0git
|
Provides some synthesis utilities to produce sequences of values. More...
#include <cassert>
#include <iterator>
#include <limits>
#include <type_traits>
#include "llvm/Support/MathExtras.h"
Go to the source code of this file.
Classes | |
struct | llvm::enum_iteration_traits< EnumT > |
struct | llvm::force_iteration_on_noniterable_enum_t |
struct | llvm::detail::CheckedInt |
struct | llvm::detail::SafeIntIterator< T, IsReverse > |
struct | llvm::iota_range< T > |
Namespaces | |
namespace | llvm |
This is an optimization pass for GlobalISel generic memory operations. | |
namespace | llvm::detail |
These are wrappers over isa* function that allow them to be used in generic algorithms such as llvm:all_of , llvm::none_of , etc. | |
Functions | |
template<typename T , typename U > | |
bool | llvm::detail::canTypeFitValue (const U Value) |
template<typename T , typename = std::enable_if_t<std::is_integral<T>::value && !std::is_enum<T>::value>> | |
auto | llvm::seq (T Begin, T End) |
Iterate over an integral type from Begin up to - but not including - End. | |
template<typename T , typename = std::enable_if_t<std::is_integral<T>::value && !std::is_enum<T>::value>> | |
auto | llvm::seq (T Size) |
Iterate over an integral type from 0 up to - but not including - Size. | |
template<typename T , typename = std::enable_if_t<std::is_integral<T>::value && !std::is_enum<T>::value>> | |
auto | llvm::seq_inclusive (T Begin, T End) |
Iterate over an integral type from Begin to End inclusive. | |
template<typename EnumT , typename = std::enable_if_t<std::is_enum<EnumT>::value>> | |
auto | llvm::enum_seq (EnumT Begin, EnumT End) |
Iterate over an enum type from Begin up to - but not including - End. | |
template<typename EnumT , typename = std::enable_if_t<std::is_enum<EnumT>::value>> | |
auto | llvm::enum_seq (EnumT Begin, EnumT End, force_iteration_on_noniterable_enum_t) |
Iterate over an enum type from Begin up to - but not including - End, even when EnumT is not marked as safely iterable by enum_iteration_traits . | |
template<typename EnumT , typename = std::enable_if_t<std::is_enum<EnumT>::value>> | |
auto | llvm::enum_seq_inclusive (EnumT Begin, EnumT End) |
Iterate over an enum type from Begin to End inclusive. | |
template<typename EnumT , typename = std::enable_if_t<std::is_enum<EnumT>::value>> | |
auto | llvm::enum_seq_inclusive (EnumT Begin, EnumT End, force_iteration_on_noniterable_enum_t) |
Iterate over an enum type from Begin to End inclusive, even when EnumT is not marked as safely iterable by enum_iteration_traits . | |
Variables | |
constexpr force_iteration_on_noniterable_enum_t | llvm::force_iteration_on_noniterable_enum |
Provides some synthesis utilities to produce sequences of values.
The names are intentionally kept very short as they tend to occur in common and widely used contexts.
The seq(A, B)
function produces a sequence of values from A
to up to (but not including) B
, i.e., [A
, B
), that can be safely iterated over. seq
supports both integral (e.g., int
, char
, uint32_t
) and enum types. seq_inclusive(A, B)
produces a sequence of values from A
to B
, including B
.
Examples with integral types:
Prints: 0 1 2
.
Prints: 0 1 2 3
.
Similar to seq
and seq_inclusive
, the enum_seq
and enum_seq_inclusive
functions produce sequences of enum values that can be iterated over. To enable iteration with enum types, you need to either mark enums as safe to iterate on by specializing enum_iteration_traits
, or opt into potentially unsafe iteration at every callsite by passing force_iteration_on_noniterable_enum
.
Examples with enum types:
Prints: 3 4
.
Prints: 2 3
.
Definition in file Sequence.h.