42 if (Implies.
test(FE.Value))
51 if (FE.Implies.getAsBitset().test(Value)) {
61 "Feature flags should start with '+' or '-'");
81 errs() <<
"'" << Feature <<
"' is not a recognized feature for this target" 82 <<
" (ignoring feature)\n";
91 MaxLen =
std::max(MaxLen, std::strlen(
I.Key));
100 static bool PrintOnce =
false;
110 errs() <<
"Available CPUs for this target:\n\n";
111 for (
auto &CPU : CPUTable)
112 errs() <<
format(
" %-*s - Select the %s processor.\n", MaxCPULen, CPU.Key,
117 errs() <<
"Available features for this target:\n\n";
118 for (
auto &Feature : FeatTable)
119 errs() <<
format(
" %-*s - %s.\n", MaxFeatLen, Feature.Key, Feature.Desc);
122 errs() <<
"Use +feature to enable a feature, or -feature to disable it.\n" 123 "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
132 static bool PrintOnce =
false;
138 errs() <<
"Available CPUs for this target:\n\n";
139 for (
auto &CPU : CPUTable)
140 errs() <<
"\t" << CPU.Key <<
"\n";
143 errs() <<
"Use -mcpu or -mtune to specify the target's processor.\n" 144 "For example, clang --target=aarch64-unknown-linux-gui " 145 "-mcpu=cortex-a35\n";
159 "CPU table is not sorted");
161 "CPU features table is not sorted");
167 Help(ProcDesc, ProcFeatures);
170 else if (!CPU.
empty()) {
178 errs() <<
"'" << CPU <<
"' is not a recognized processor for this target" 179 <<
" (ignoring processor)\n";
184 for (
const std::string &Feature : Features.
getFeatures()) {
186 if (Feature ==
"+help")
187 Help(ProcDesc, ProcFeatures);
188 else if (Feature ==
"+cpuHelp")
198 FeatureBits =
getFeatures(CPU, FS, ProcDesc, ProcFeatures);
206 FeatureBits =
getFeatures(CPU, FS, ProcDesc, ProcFeatures);
214 const InstrStage *IS,
const unsigned *
OC,
const unsigned *FP)
215 : TargetTriple(TT), CPU(C), ProcFeatures(PF), ProcDesc(PD),
216 WriteProcResTable(WPR), WriteLatencyTable(WL),
217 ReadAdvanceTable(RA), Stages(IS), OperandCycles(OC), ForwardingPaths(FP) {
222 FeatureBits.
flip(FB);
239 for (
unsigned I = 0,
E = FB.
size();
I <
E;
I++) {
241 FeatureBits.
reset(I);
254 if (FeatureBits.
test(FeatureEntry->
Value)) {
259 FeatureBits.
set(FeatureEntry->
Value);
266 errs() <<
"'" << Feature <<
"' is not a recognized feature for this target" 267 <<
" (ignoring feature)\n";
287 return (FeatureBits & All) == Set;
291 assert(std::is_sorted(ProcDesc.begin(), ProcDesc.end()) &&
292 "Processor machine model table is not sorted");
300 <<
"' is not a recognized processor for this target" 301 <<
" (ignoring processor)\n";
auto lower_bound(R &&Range, T &&Value) -> decltype(adl_begin(Range))
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
constexpr FeatureBitset & flip(unsigned I)
FeatureBitset SetFeatureBitsTransitively(const FeatureBitset &FB)
Set/clear additional feature bits, including all other bits they imply.
const_iterator end(StringRef path)
Get end iterator over path.
FeatureBitArray Implies
K-V bit mask.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
This class represents lattice values for constants.
constexpr size_t size() const
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
FeatureBitArray Implies
K-V bit mask.
const MCSchedModel * SchedModel
static void SetImpliedBits(FeatureBitset &Bits, const FeatureBitset &Implies, ArrayRef< SubtargetFeatureKV > FeatureTable)
For each feature that is (transitively) implied by this feature, set it.
static bool hasFlag(StringRef Feature)
Determine if a feature has a flag; '+' or '-'.
const FeatureBitset & getAsBitset() const
virtual Optional< unsigned > getCacheSize(unsigned Level) const
Return the cache size in bytes for the given level of cache.
SI optimize exec mask operations pre RA
virtual unsigned getMaxPrefetchIterationsAhead() const
Return the maximum prefetch distance in terms of loop iterations.
bool checkFeatures(StringRef FS) const
Check whether the subtarget features are enabled/disabled as per the provided string, ignoring all other features.
static void cpuHelp(ArrayRef< SubtargetSubTypeKV > CPUTable)
Display help for mcpu choices only.
const MCSchedModel & getSchedModelForCPU(StringRef CPU) const
Get the machine model of a CPU.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
static const T * Find(StringRef S, ArrayRef< T > A)
Find KV in array using binary search.
constexpr bool test(unsigned I) const
InstrItineraryData getInstrItineraryForCPU(StringRef CPU) const
Get scheduling itinerary of a CPU.
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)...
Itinerary data supplied by a subtarget to be used by a target.
FeatureBitset ClearFeatureBitsTransitively(const FeatureBitset &FB)
void InitMCProcessorInfo(StringRef CPU, StringRef FS)
Initialize the scheduling model and feature bits.
void initInstrItins(InstrItineraryData &InstrItins) const
Initialize an InstrItineraryData instance.
static const MCSchedModel & GetDefaultSchedModel()
Returns the default initialized model.
FeatureBitset ToggleFeature(uint64_t FB)
Toggle a feature and return the re-computed feature bits.
const std::vector< std::string > & getFeatures() const
Returns the vector of individual subtarget features.
unsigned Value
K-V integer value.
Container class for subtarget features.
static FeatureBitset getFeatures(StringRef CPU, StringRef FS, ArrayRef< SubtargetSubTypeKV > ProcDesc, ArrayRef< SubtargetFeatureKV > ProcFeatures)
Identify one of the processor resource kinds consumed by a particular scheduling class for the specif...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
FeatureBitset ApplyFeatureFlag(StringRef FS)
Apply a feature flag and return the re-computed feature bits, including all feature bits implied by t...
Triple - Helper class for working with autoconf configuration names.
static void Help(ArrayRef< SubtargetSubTypeKV > CPUTable, ArrayRef< SubtargetFeatureKV > FeatTable)
Display help for feature and mcpu choices.
Specify the latency in cpu cycles for a particular scheduling class and def index.
Align max(MaybeAlign Lhs, Align Rhs)
Used to provide key value pairs for feature and CPU bit flags.
static void ApplyFeatureFlag(FeatureBitset &Bits, StringRef Feature, ArrayRef< SubtargetFeatureKV > FeatureTable)
Manages the enabling and disabling of subtarget specific features.
virtual Optional< unsigned > getCacheAssociativity(unsigned Level) const
Return the cache associatvity for the given level of cache.
Specify the number of cycles allowed after instruction issue before a particular use operand reads it...
virtual unsigned getCacheLineSize() const
Return the target cache line size in bytes.
static void ClearImpliedBits(FeatureBitset &Bits, unsigned Value, ArrayRef< SubtargetFeatureKV > FeatureTable)
For each feature that (transitively) implies this feature, clear it.
constexpr FeatureBitset & reset(unsigned I)
These values represent a non-pipelined step in the execution of an instruction.
static std::string StripFlag(StringRef Feature)
Return string stripped of flag.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
static size_t getLongestEntryLength(ArrayRef< T > Table)
Return the length of the longest entry in the table.
static bool isEnabled(StringRef Feature)
Return true if enable flag; '+'.
virtual unsigned getPrefetchDistance() const
Return the preferred prefetch distance in terms of instructions.
StringRef - Represent a constant reference to a string, i.e.
virtual unsigned getMinPrefetchStride() const
Return the minimum stride necessary to trigger software prefetching.
Machine model for scheduling, bundling, and heuristics.
const MCSchedModel & getSchedModel() const
Get the machine model for this subtarget's CPU.
bool empty() const
empty - Check if the array is empty.
void setDefaultFeatures(StringRef CPU, StringRef FS)
Set the features to the default for the given CPU with an appended feature string.