17#ifndef LLVM_TARGETPARSER_SUBTARGETFEATURE_H
18#define LLVM_TARGETPARSER_SUBTARGETFEATURE_H
26#include <initializer_list>
44 "Should be a multiple of 64!");
45 std::array<uint64_t, MAX_SUBTARGET_WORDS> Bits{};
80 return (Bits[
I / 64] & Mask) != 0;
83 constexpr bool test(
unsigned I)
const {
return (*
this)[
I]; }
99 for (
unsigned I = 0,
E = Bits.size();
I !=
E; ++
I) {
100 Bits[
I] ^=
RHS.Bits[
I];
111 for (
unsigned I = 0,
E = Bits.size();
I !=
E; ++
I)
112 Bits[
I] &=
RHS.Bits[
I];
122 for (
unsigned I = 0,
E = Bits.size();
I !=
E; ++
I) {
123 Bits[
I] |=
RHS.Bits[
I];
135 for (
auto &
B : Result.Bits)
141 return std::equal(std::begin(Bits), std::end(Bits), std::begin(
RHS.Bits));
147 for (
unsigned I = 0,
E =
size();
I !=
E; ++
I) {
176 std::vector<std::string> Features;
190 const std::vector<std::string> &
getFeatures()
const {
return Features; }
205 char Ch = Feature[0];
207 return Ch ==
'+' || Ch ==
'-';
219 char Ch = Feature[0];
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Class used to store the subtarget bits in the tables created by tablegen.
const FeatureBitset & getAsBitset() const
constexpr FeatureBitArray(const std::array< uint64_t, MAX_SUBTARGET_WORDS > &B)
Container class for subtarget features.
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
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
constexpr FeatureBitset operator|(const FeatureBitset &RHS) const
constexpr FeatureBitset(std::initializer_list< unsigned > Init)
constexpr FeatureBitset operator&(const FeatureBitset &RHS) const
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
StringRef - 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
empty - Check if the string is empty.
Manages the enabling and disabling of subtarget specific features.
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
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.
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.
int popcount(T Value) noexcept
Count the number of set bits in a value.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
const unsigned MAX_SUBTARGET_WORDS