17#ifndef LLVM_TARGETPARSER_SUBTARGETFEATURE_H
18#define LLVM_TARGETPARSER_SUBTARGETFEATURE_H
27#include <initializer_list>
45 "Should be a multiple of 64!");
46 std::array<uint64_t, MAX_SUBTARGET_WORDS> Bits{};
81 return (Bits[
I / 64] & Mask) != 0;
84 constexpr bool test(
unsigned I)
const {
return (*
this)[
I]; }
90 for (
unsigned Word = Begin / 64; Word < Bits.size(); ++Word) {
94 Begin = (Word + 1) * 64;
102 const unsigned, std::ptrdiff_t,
103 const unsigned *, unsigned> {
110 : Parent(&Parent), Index(Index) {}
114 Index = Parent->find_first_from(Index + 1);
118 return Index ==
RHS.Index;
139 for (
unsigned I = 0,
E = Bits.size();
I !=
E; ++
I) {
140 Bits[
I] ^=
RHS.Bits[
I];
151 for (
unsigned I = 0,
E = Bits.size();
I !=
E; ++
I)
152 Bits[
I] &=
RHS.Bits[
I];
162 for (
unsigned I = 0,
E = Bits.size();
I !=
E; ++
I) {
163 Bits[
I] |=
RHS.Bits[
I];
175 for (
auto &
B : Result.Bits)
181 return std::equal(std::begin(Bits), std::end(Bits), std::begin(
RHS.Bits));
187 for (
unsigned I = 0,
E =
size();
I !=
E; ++
I) {
216 std::vector<std::string> Features;
230 const std::vector<std::string> &
getFeatures()
const {
return Features; }
245 char Ch = Feature[0];
247 return Ch ==
'+' || Ch ==
'-';
259 char Ch = Feature[0];
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const FeatureBitset & getAsBitset() const
constexpr FeatureBitArray(const std::array< uint64_t, MAX_SUBTARGET_WORDS > &B)
Yields the index of each set bit, skipping unset bits via countr_zero.
const_iterator(const FeatureBitset &Parent, unsigned Index)
unsigned operator*() const
const_iterator & operator++()
bool operator==(const const_iterator &RHS) const
constexpr FeatureBitset(const std::array< uint64_t, MAX_SUBTARGET_WORDS > &B)
constexpr FeatureBitset & operator&=(const FeatureBitset &RHS)
constexpr FeatureBitset & operator|=(const FeatureBitset &RHS)
constexpr FeatureBitset & reset(unsigned I)
constexpr bool operator[](unsigned I) const
const_iterator end() const
constexpr FeatureBitset & operator^=(const FeatureBitset &RHS)
bool operator!=(const FeatureBitset &RHS) const
constexpr FeatureBitset & set(unsigned I)
constexpr bool test(unsigned I) const
constexpr FeatureBitset & flip(unsigned I)
constexpr FeatureBitset()=default
const_iterator begin() const
constexpr FeatureBitset operator|(const FeatureBitset &RHS) const
constexpr FeatureBitset(std::initializer_list< unsigned > Init)
constexpr FeatureBitset operator&(const FeatureBitset &RHS) const
unsigned find_first_from(unsigned Begin) const
Index of the first set bit at or after Begin, or size() if none.
bool operator<(const FeatureBitset &Other) const
bool operator==(const FeatureBitset &RHS) const
constexpr FeatureBitset operator~() const
constexpr size_t size() const
constexpr FeatureBitset operator^(const FeatureBitset &RHS) const
Represent a constant reference to a string, i.e.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr bool empty() const
Check if the string is empty.
static LLVM_ABI void Split(std::vector< std::string > &V, StringRef S)
Splits a string of comma separated items in to a vector of strings.
const std::vector< std::string > & getFeatures() const
Returns the vector of individual subtarget features.
LLVM_ABI void getDefaultSubtargetFeatures(const Triple &Triple)
Adds the default features for the specified target triple.
static bool hasFlag(StringRef Feature)
Determine if a feature has a flag; '+' or '-'.
static StringRef StripFlag(StringRef Feature)
Return string stripped of flag.
LLVM_ABI void print(raw_ostream &OS) const
Prints feature string.
LLVM_ABI std::string getString() const
Returns features as a string.
LLVM_ABI void dump() const
LLVM_ABI SubtargetFeatures(StringRef Initial="")
static bool isEnabled(StringRef Feature)
Return true if enable flag; '+'.
LLVM_ABI void AddFeature(StringRef String, bool Enable=true)
Adds Features.
LLVM_ABI void addFeaturesVector(const ArrayRef< std::string > OtherFeatures)
Triple - Helper class for working with autoconf configuration names.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
const unsigned MAX_SUBTARGET_FEATURES
void fill(R &&Range, T &&Value)
Provide wrappers to std::fill which take ranges instead of having to pass begin/end explicitly.
constexpr int popcount(T Value) noexcept
Count the number of set bits in a value.
int countr_zero(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
constexpr T maskTrailingZeros(unsigned N)
Create a bitmask with the N right-most bits set to 0, and all other bits set to 1.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
const unsigned MAX_SUBTARGET_WORDS