Go to the documentation of this file.
17 #ifndef LLVM_MC_SUBTARGETFEATURE_H
18 #define LLVM_MC_SUBTARGETFEATURE_H
24 #include <initializer_list>
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)
67 Bits[
I / 64] = NewBits;
74 Bits[
I / 64] = NewBits;
81 Bits[
I / 64] = NewBits;
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;
196 const std::vector<std::string> &
getFeatures()
const {
return Features; }
211 char Ch = Feature[0];
213 return Ch ==
'+' || Ch ==
'-';
225 char Ch = Feature[0];
236 #endif // LLVM_MC_SUBTARGETFEATURE_H
const FeatureBitset & getAsBitset() const
This is an optimization pass for GlobalISel generic memory operations.
void AddFeature(StringRef String, bool Enable=true)
Adds Features.
constexpr FeatureBitset(std::initializer_list< unsigned > Init)
Triple - Helper class for working with autoconf configuration names.
constexpr FeatureBitset operator|(const FeatureBitset &RHS) const
bool operator==(const FeatureBitset &RHS) const
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()=default
Container class for subtarget features.
bool operator<(const FeatureBitset &Other) const
static StringRef StripFlag(StringRef Feature)
Return string stripped of flag.
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr std::underlying_type_t< E > 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; '+'.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
constexpr FeatureBitset operator&(const FeatureBitset &RHS) const
static 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.
Manages the enabling and disabling of subtarget specific features.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
constexpr FeatureBitset operator~() const
This class implements an extremely fast bulk output stream that can only output to a stream.
void getDefaultSubtargetFeatures(const Triple &Triple)
Adds the default features for the specified target triple.
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
SubtargetFeatures(StringRef Initial="")
std::string getString() const
Returns features as a string.
const unsigned MAX_SUBTARGET_WORDS
constexpr FeatureBitset & flip(unsigned I)
unsigned countPopulation(T Value)
Count the number of set bits in a value.
constexpr LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
constexpr size_t size() const
constexpr FeatureBitset & operator|=(const FeatureBitset &RHS)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
StringRef - Represent a constant reference to a string, i.e.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
constexpr FeatureBitset(const std::array< uint64_t, MAX_SUBTARGET_WORDS > &B)
constexpr FeatureBitset & reset(unsigned I)
constexpr FeatureBitset operator^(const FeatureBitset &RHS) const
const unsigned MAX_SUBTARGET_FEATURES
static bool hasFlag(StringRef Feature)
Determine if a feature has a flag; '+' or '-'.
constexpr FeatureBitArray(const std::array< uint64_t, MAX_SUBTARGET_WORDS > &B)
constexpr bool test(unsigned I) const
void print(raw_ostream &OS) const
Prints feature string.
bool operator!=(const FeatureBitset &RHS) const
constexpr FeatureBitset & operator&=(const FeatureBitset &RHS)
constexpr FeatureBitset & set(unsigned I)
constexpr FeatureBitset & operator^=(const FeatureBitset &RHS)
constexpr bool operator[](unsigned I) const
Optional< std::vector< StOtherPiece > > Other
Class used to store the subtarget bits in the tables created by tablegen.