17 #ifndef LLVM_MC_SUBTARGETFEATURE_H 18 #define LLVM_MC_SUBTARGETFEATURE_H 24 #include <initializer_list> 41 static_assert((MAX_SUBTARGET_FEATURES % 64) == 0,
42 "Should be a multiple of 64!");
47 constexpr
FeatureBitset(
const std::array<uint64_t, MAX_SUBTARGET_WORDS> &
B) {
48 for (
unsigned I = 0;
I != B.size(); ++
I)
66 uint64_t NewBits = Bits[
I / 64] | (uint64_t(1) << (
I % 64));
67 Bits[
I / 64] = NewBits;
73 uint64_t NewBits = Bits[I / 64] & ~(uint64_t(1) << (I % 64));
74 Bits[I / 64] = NewBits;
80 uint64_t NewBits = Bits[I / 64] ^ (uint64_t(1) << (I % 64));
81 Bits[I / 64] = NewBits;
86 uint64_t
Mask = uint64_t(1) << (I % 64);
87 return (Bits[I / 64] & Mask) != 0;
90 constexpr
bool test(
unsigned I)
const {
return (*
this)[
I]; }
107 Bits[
I] ^= RHS.Bits[
I];
119 Bits[
I] &= RHS.Bits[
I];
131 Bits[
I] |= RHS.Bits[
I];
143 for (
auto &
B : Result.Bits)
155 for (
unsigned I = 0,
E =
size();
I !=
E; ++
I) {
184 std::vector<std::string> Features;
190 std::string getString()
const;
196 const std::vector<std::string> &
getFeatures()
const {
return Features; }
211 char Ch = Feature[0];
213 return Ch ==
'+' || Ch ==
'-';
218 return hasFlag(Feature) ? Feature.
substr(1) : Feature;
225 char Ch = Feature[0];
231 static void Split(std::vector<std::string> &V,
StringRef S);
236 #endif // LLVM_MC_SUBTARGETFEATURE_H constexpr FeatureBitset & flip(unsigned I)
const unsigned MAX_SUBTARGET_FEATURES
const_iterator end(StringRef path)
Get end iterator over path.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
constexpr FeatureBitset(std::initializer_list< unsigned > Init)
This class represents lattice values for constants.
constexpr FeatureBitset operator &(const FeatureBitset &RHS) const
constexpr size_t size() const
bool operator!=(const FeatureBitset &RHS) const
static bool hasFlag(StringRef Feature)
Determine if a feature has a flag; '+' or '-'.
const FeatureBitset & getAsBitset() const
bool operator==(const FeatureBitset &RHS) const
const unsigned MAX_SUBTARGET_WORDS
bool operator<(const FeatureBitset &Other) const
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
constexpr bool test(unsigned I) const
const std::vector< std::string > & getFeatures() const
Returns the vector of individual subtarget features.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
Container class for subtarget features.
Class used to store the subtarget bits in the tables created by tablegen.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
constexpr FeatureBitset operator~() const
constexpr FeatureBitset & operator|=(const FeatureBitset &RHS)
constexpr FeatureBitset()=default
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
constexpr FeatureBitset & operator &=(const FeatureBitset &RHS)
constexpr FeatureBitArray(const std::array< uint64_t, MAX_SUBTARGET_WORDS > &B)
constexpr FeatureBitset(const std::array< uint64_t, MAX_SUBTARGET_WORDS > &B)
Triple - Helper class for working with autoconf configuration names.
unsigned countPopulation(T Value)
Count the number of set bits in a value.
constexpr FeatureBitset operator|(const FeatureBitset &RHS) const
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
Manages the enabling and disabling of subtarget specific features.
constexpr FeatureBitset & reset(unsigned I)
static std::string StripFlag(StringRef Feature)
Return string stripped of flag.
constexpr FeatureBitset operator^(const FeatureBitset &RHS) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
constexpr FeatureBitset & operator^=(const FeatureBitset &RHS)
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
static bool isEnabled(StringRef Feature)
Return true if enable flag; '+'.
constexpr bool operator[](unsigned I) const
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.