37 return Ch ==
'+' || Ch ==
'-';
60 S.
split(Tmp,
',', -1,
false );
70 : (Enable ?
"+" :
"-") + String.
lower());
77 auto F = std::lower_bound(A.
begin(), A.
end(), S);
89 MaxLen = std::max(MaxLen, std::strlen(
I.Key));
102 errs() <<
"Available CPUs for this target:\n\n";
103 for (
auto &CPU : CPUTable)
104 errs() <<
format(
" %-*s - %s.\n", MaxCPULen, CPU.Key, CPU.Desc);
108 errs() <<
"Available features for this target:\n\n";
109 for (
auto &Feature : FeatTable)
110 errs() <<
format(
" %-*s - %s.\n", MaxFeatLen, Feature.Key, Feature.Desc);
113 errs() <<
"Use +feature to enable a feature, or -feature to disable it.\n"
114 "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
123 Split(Features, Initial);
128 return join(Features.begin(), Features.end(),
",");
137 for (
auto &FE : FeatureTable) {
138 if (FeatureEntry->
Value == FE.Value)
continue;
140 if ((FeatureEntry->
Implies & FE.Value).any()) {
154 for (
auto &FE : FeatureTable) {
155 if (FeatureEntry->
Value == FE.Value)
continue;
157 if ((FE.Implies & FeatureEntry->
Value).any()) {
174 if ((Bits & FeatureEntry->
Value) == FeatureEntry->
Value) {
175 Bits &= ~FeatureEntry->
Value;
179 Bits |= FeatureEntry->
Value;
185 errs() <<
"'" << Feature
186 <<
"' is not a recognized feature for this target"
187 <<
" (ignoring feature)\n";
203 Bits |= FeatureEntry->
Value;
208 Bits &= ~FeatureEntry->
Value;
214 errs() <<
"'" << Feature
215 <<
"' is not a recognized feature for this target"
216 <<
" (ignoring feature)\n";
233 "CPU table is not sorted");
235 "CPU features table is not sorted");
242 Help(CPUTable, FeatureTable);
245 else if (!CPU.
empty()) {
251 Bits = CPUEntry->
Value;
254 for (
auto &FE : FeatureTable) {
255 if ((CPUEntry->
Value & FE.Value).any())
260 <<
"' is not a recognized processor for this target"
261 <<
" (ignoring processor)\n";
266 for (
auto &Feature : Features) {
268 if (Feature ==
"+help")
269 Help(CPUTable, FeatureTable);
280 for (
auto &
F : Features)
const_iterator end(StringRef path)
Get end iterator over path.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static void Help(ArrayRef< SubtargetFeatureKV > CPUTable, ArrayRef< SubtargetFeatureKV > FeatTable)
Display help for feature choices.
void getDefaultSubtargetFeatures(const Triple &Triple)
Adds the default features for the specified target triple.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
static size_t getLongestEntryLength(ArrayRef< SubtargetFeatureKV > Table)
getLongestEntryLength - Return the length of the longest entry in the table.
static std::string StripFlag(StringRef Feature)
StripFlag - Return string stripped of flag.
const_iterator begin(StringRef path)
Get begin iterator over path.
std::string join(IteratorT Begin, IteratorT End, StringRef Separator)
Joins the strings in the range [Begin, End), adding Separator between the elements.
void AddFeature(StringRef String, bool Enable=true)
Adding Features.
SubtargetFeatureKV - Used to provide key value pairs for feature and CPU bit flags.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
static bool hasFlag(StringRef Feature)
hasFlag - Determine if a feature has a flag; '+' or '-'
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
static const SubtargetFeatureKV * Find(StringRef S, ArrayRef< SubtargetFeatureKV > A)
Find KV in array using binary search.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
void dump() const
dump - Dump feature info.
static void SetImpliedBits(FeatureBitset &Bits, const SubtargetFeatureKV *FeatureEntry, ArrayRef< SubtargetFeatureKV > FeatureTable)
SetImpliedBits - For each feature that is (transitively) implied by this feature, set it...
bool empty() const
empty - Check if the array is empty.
std::string getString() const
Features string accessors.
static void ToggleFeature(FeatureBitset &Bits, StringRef String, ArrayRef< SubtargetFeatureKV > FeatureTable)
ToggleFeature - Toggle a feature and update the feature bits.
Triple - Helper class for working with autoconf configuration names.
static void ClearImpliedBits(FeatureBitset &Bits, const SubtargetFeatureKV *FeatureEntry, ArrayRef< SubtargetFeatureKV > FeatureTable)
ClearImpliedBits - For each feature that (transitively) implies this feature, clear it...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
SubtargetFeatures(StringRef Initial="")
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
static bool isEnabled(StringRef Feature)
isEnabled - Return true if enable flag; '+'.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void ApplyFeatureFlag(FeatureBitset &Bits, StringRef Feature, ArrayRef< SubtargetFeatureKV > FeatureTable)
Apply the feature flag and update the feature bits.
void print(raw_ostream &OS) const
Print feature string.
This class implements an extremely fast bulk output stream that can only output to a stream...
VendorType getVendor() const
getVendor - Get the parsed vendor type of this triple.
StringRef - Represent a constant reference to a string, i.e.
FeatureBitset getFeatureBits(StringRef CPU, ArrayRef< SubtargetFeatureKV > CPUTable, ArrayRef< SubtargetFeatureKV > FeatureTable)
Get feature bits of a CPU.
static void Split(std::vector< std::string > &V, StringRef S)
Split - Splits a string of comma separated items in to a vector of strings.
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
LLVM_NODISCARD std::string lower() const