LLVM 24.0.0git
RISCVTargetParser.cpp
Go to the documentation of this file.
1//===-- RISCVTargetParser.cpp - Parser for target features ------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements a target parser to recognise hardware features
10// for RISC-V CPUs.
11//
12//===----------------------------------------------------------------------===//
13
16#include "llvm/ADT/SmallSet.h"
22
23namespace llvm {
24namespace RISCV {
25
26char ParserError::ID = 0;
27char ParserWarning::ID = 0;
28
29enum CPUKind : unsigned {
30#define PROC(ENUM, NAME, DEFAULT_MARCH, FAST_SCALAR_UNALIGN, \
31 FAST_VECTOR_UNALIGN, MVENDORID, MARCHID, MIMPID) \
32 CK_##ENUM,
33#define TUNE_PROC(ENUM, NAME) CK_##ENUM,
34#include "llvm/TargetParser/RISCVTargetParserDef.inc"
35};
36
37constexpr CPUInfo RISCVCPUInfo[] = {
38#define PROC(ENUM, NAME, DEFAULT_MARCH, FAST_SCALAR_UNALIGN, \
39 FAST_VECTOR_UNALIGN, MVENDORID, MARCHID, MIMPID) \
40 { \
41 NAME, \
42 DEFAULT_MARCH, \
43 FAST_SCALAR_UNALIGN, \
44 FAST_VECTOR_UNALIGN, \
45 {MVENDORID, MARCHID, MIMPID}, \
46 },
47#include "llvm/TargetParser/RISCVTargetParserDef.inc"
48};
49
51 for (auto &C : RISCVCPUInfo)
52 if (C.Name == CPU)
53 return &C;
54 return nullptr;
55}
56
58 const CPUInfo *Info = getCPUInfoByName(CPU);
59 return Info && Info->FastScalarUnalignedAccess;
60}
61
63 const CPUInfo *Info = getCPUInfoByName(CPU);
64 return Info && Info->FastVectorUnalignedAccess;
65}
66
67bool hasValidCPUModel(StringRef CPU) { return getCPUModel(CPU).isValid(); }
68
70 const CPUInfo *Info = getCPUInfoByName(CPU);
71 if (!Info)
72 return {0, 0, 0};
73 return Info->Model;
74}
75
77 if (!Model.isValid())
78 return "";
79
80 for (auto &C : RISCVCPUInfo)
81 if (C.Model == Model)
82 return C.Name;
83 return "";
84}
85
86bool parseCPU(StringRef CPU, bool IsRV64) {
87 const CPUInfo *Info = getCPUInfoByName(CPU);
88
89 if (!Info)
90 return false;
91 return Info->is64Bit() == IsRV64;
92}
93
94bool parseTuneCPU(StringRef TuneCPU, bool IsRV64) {
95 std::optional<CPUKind> Kind =
97#define TUNE_PROC(ENUM, NAME) .Case(NAME, CK_##ENUM)
98 #include "llvm/TargetParser/RISCVTargetParserDef.inc"
99 .Default(std::nullopt);
100
101 if (Kind.has_value())
102 return true;
103
104 // Fallback to parsing as a CPU.
105 return parseCPU(TuneCPU, IsRV64);
106}
107
109 const CPUInfo *Info = getCPUInfoByName(CPU);
110 if (!Info)
111 return "";
112 return Info->DefaultMarch;
113}
114
116 for (const auto &C : RISCVCPUInfo) {
117 if (IsRV64 == C.is64Bit())
118 Values.emplace_back(C.Name);
119 }
120
122 [](StringRef A, StringRef B) { return A.compare_numeric(B) < 0; });
123}
124
126 for (const auto &C : RISCVCPUInfo) {
127 if (IsRV64 == C.is64Bit())
128 Values.emplace_back(C.Name);
129 }
130#define TUNE_PROC(ENUM, NAME) Values.emplace_back(StringRef(NAME));
131#include "llvm/TargetParser/RISCVTargetParserDef.inc"
132
134 [](StringRef A, StringRef B) { return A.compare_numeric(B) < 0; });
135}
136
137// This function is currently used by IREE, so it's not dead code.
139 SmallVectorImpl<std::string> &EnabledFeatures,
140 bool NeedPlus) {
141 StringRef MarchFromCPU = llvm::RISCV::getMArchFromMcpu(CPU);
142 if (MarchFromCPU == "")
143 return;
144
145 EnabledFeatures.clear();
147 MarchFromCPU, /* EnableExperimentalExtension */ true);
148
149 if (llvm::errorToBool(RII.takeError()))
150 return;
151
152 std::vector<std::string> FeatStrings =
153 (*RII)->toFeatures(/* AddAllExtensions */ false);
154 for (const auto &F : FeatStrings)
155 if (NeedPlus)
156 EnabledFeatures.push_back(F);
157 else
158 EnabledFeatures.push_back(F.substr(1));
159}
160
161namespace {
162class RISCVTuneFeatureLookupTable {
163 struct RISCVTuneFeature {
164 unsigned PosIdx;
165 unsigned NegIdx;
166 unsigned FeatureIdx;
167 };
168
169 struct RISCVImpliedTuneFeature {
170 unsigned FeatureIdx;
171 unsigned ImpliedFeatureIdx;
172 };
173
174 struct RISCVConfigurableTuneFeatures {
175 StringRef Processor;
176 unsigned DirectiveIdx;
177
178 bool operator<(const RISCVConfigurableTuneFeatures &RHS) const {
179 return Processor < RHS.Processor;
180 }
181 };
182
183#define GET_TUNE_FEATURES
184#define GET_CONFIGURABLE_TUNE_FEATURES
185#include "llvm/TargetParser/RISCVTargetParserDef.inc"
186
187 // Positive directive name -> Feature name
188 StringMap<StringRef> PositiveMap;
189 // Negative directive name -> Feature name
190 StringMap<StringRef> NegativeMap;
191
192 StringMap<SmallVector<StringRef>> ImpliedFeatureMap;
193 StringMap<SmallVector<StringRef>> InvImpliedFeatureMap;
194
195public:
196 using SmallStringSet = SmallSet<StringRef, 4>;
197
198 static void getAllTuneFeatures(SmallVectorImpl<StringRef> &Features) {
199 for (const auto &TuneFeature : TuneFeatures)
200 Features.push_back(TuneFeatureStrings[TuneFeature.FeatureIdx]);
201 }
202
203 static void getConfigurableFeatures(StringRef ProcName,
204 SmallStringSet &Directives) {
205 // Entries for the same processor are always put together.
206 auto [ItFirst, ItEnd] =
207 std::equal_range(std::begin(ConfigurableTuneFeatures),
208 std::end(ConfigurableTuneFeatures),
209 RISCVConfigurableTuneFeatures{ProcName, 0});
210 for (; ItFirst != ItEnd; ++ItFirst)
211 Directives.insert(TuneFeatureStrings[ItFirst->DirectiveIdx]);
212 }
213
214 RISCVTuneFeatureLookupTable() {
215 for (const auto &TuneFeature : TuneFeatures) {
216 StringRef PosDirective = TuneFeatureStrings[TuneFeature.PosIdx];
217 StringRef NegDirective = TuneFeatureStrings[TuneFeature.NegIdx];
218 StringRef FeatureName = TuneFeatureStrings[TuneFeature.FeatureIdx];
219 PositiveMap[PosDirective] = FeatureName;
220 NegativeMap[NegDirective] = FeatureName;
221 }
222
223 for (const auto &Imp : ImpliedTuneFeatures) {
224 StringRef Feature = TuneFeatureStrings[Imp.FeatureIdx];
225 StringRef ImpliedFeature = TuneFeatureStrings[Imp.ImpliedFeatureIdx];
226 ImpliedFeatureMap[Feature].push_back(ImpliedFeature);
227 InvImpliedFeatureMap[ImpliedFeature].push_back(Feature);
228 }
229 }
230
231 /// Returns {Feature name, Is positive or not}, or empty feature name
232 /// if not found.
233 std::pair<StringRef, bool> getFeature(StringRef DirectiveName) const {
234 auto It = PositiveMap.find(DirectiveName);
235 if (It != PositiveMap.end())
236 return {It->getValue(), /*IsPositive=*/true};
237
238 return {NegativeMap.lookup(DirectiveName), /*IsPositive=*/false};
239 }
240
241 /// Returns the implied features, or empty ArrayRef if not found. Note:
242 /// ImpliedFeatureMap / InvImpliedFeatureMap are the owners of these implied
243 /// feature lists, so we can just return the ArrayRef.
244 ArrayRef<StringRef> featureImplies(StringRef FeatureName,
245 bool Inverse = false) const {
246 const auto &Map = Inverse ? InvImpliedFeatureMap : ImpliedFeatureMap;
247 auto It = Map.find(FeatureName);
248 if (It == Map.end())
249 return {};
250 return It->second;
251 }
252};
253} // namespace
254
256 RISCVTuneFeatureLookupTable::getAllTuneFeatures(Features);
257}
258
260 SmallVectorImpl<std::string> &ResFeatures) {
261 RISCVTuneFeatureLookupTable TFLookup;
262 using SmallStringSet = RISCVTuneFeatureLookupTable::SmallStringSet;
263
264 // Do not create ParserWarning right away. Instead, we store the warning
265 // message until the last moment.
266 std::string WarningMsg;
267
268 TFString = TFString.trim();
269 if (TFString.empty())
270 return Error::success();
271
272 // Note: StringSet is not really ergonomic to use in this case here.
273 SmallStringSet PositiveFeatures;
274 SmallStringSet NegativeFeatures;
275 SmallStringSet PerProcDirectives;
276 RISCVTuneFeatureLookupTable::getConfigurableFeatures(ProcName,
277 PerProcDirectives);
278 if (PerProcDirectives.empty() && !ProcName.empty())
279 return make_error<ParserError>("Processor '" + Twine(ProcName) +
280 "' has no "
281 "configurable tuning features");
282
283 // Phase 1: Collect explicit features.
284 StringRef DirectiveStr;
285 do {
286 std::tie(DirectiveStr, TFString) = TFString.split(",");
287 auto [FeatureName, IsPositive] = TFLookup.getFeature(DirectiveStr);
288 if (FeatureName.empty()) {
289 raw_string_ostream SS(WarningMsg);
290 SS << "unrecognized tune feature directive '" << DirectiveStr << "'";
291 continue;
292 }
293
294 auto &Features = IsPositive ? PositiveFeatures : NegativeFeatures;
295 if (!Features.insert(FeatureName).second)
297 "cannot specify more than one instance of '" + Twine(DirectiveStr) +
298 "'");
299
300 if (!PerProcDirectives.count(DirectiveStr) && !ProcName.empty())
301 return make_error<ParserError>("Directive '" + Twine(DirectiveStr) +
302 "' is not "
303 "allowed to be used with processor '" +
304 Twine(ProcName) + "'");
305 } while (!TFString.empty());
306
307 auto Intersection =
308 llvm::set_intersection(PositiveFeatures, NegativeFeatures);
309 if (!Intersection.empty()) {
310 std::string IntersectedStr = join(Intersection, "', '");
311 return make_error<ParserError>("Feature(s) '" + Twine(IntersectedStr) +
312 "' cannot appear in both "
313 "positive and negative directives");
314 }
315
316 // Phase 2: Derive implied features.
317 SmallStringSet DerivedPosFeatures;
318 SmallStringSet DerivedNegFeatures;
319 for (StringRef PF : PositiveFeatures) {
320 if (auto FeatureList = TFLookup.featureImplies(PF); !FeatureList.empty())
321 DerivedPosFeatures.insert_range(FeatureList);
322 }
323 for (StringRef NF : NegativeFeatures) {
324 if (auto FeatureList = TFLookup.featureImplies(NF, /*Inverse=*/true);
325 !FeatureList.empty())
326 DerivedNegFeatures.insert_range(FeatureList);
327 }
328 PositiveFeatures.insert_range(DerivedPosFeatures);
329 NegativeFeatures.insert_range(DerivedNegFeatures);
330
331 Intersection = llvm::set_intersection(PositiveFeatures, NegativeFeatures);
332 if (!Intersection.empty()) {
333 std::string IntersectedStr = join(Intersection, "', '");
334 return make_error<ParserError>("Feature(s) '" + Twine(IntersectedStr) +
335 "' were implied by both "
336 "positive and negative directives");
337 }
338
339 // Export the result.
340 const std::string PosPrefix("+");
341 const std::string NegPrefix("-");
342 for (StringRef PF : PositiveFeatures)
343 ResFeatures.emplace_back(PosPrefix + PF.str());
344 for (StringRef NF : NegativeFeatures)
345 ResFeatures.emplace_back(NegPrefix + NF.str());
346
347 if (WarningMsg.empty())
348 return Error::success();
349
350 return make_error<ParserWarning>(WarningMsg);
351}
352
354 SmallVectorImpl<StringRef> &Directives) {
355 RISCVTuneFeatureLookupTable::SmallStringSet DirectiveSet;
356 RISCVTuneFeatureLookupTable::getConfigurableFeatures(CPU, DirectiveSet);
357 Directives.assign(DirectiveSet.begin(), DirectiveSet.end());
358}
359} // namespace RISCV
360
361namespace RISCVVType {
362// Encode VTYPE into the binary format used by the the VSETVLI instruction which
363// is used by our MC layer representation.
364//
365// Bits | Name | Description
366// -----+------------+------------------------------------------------
367// 8 | altfmt | Alternative format for bf16/ofp8
368// 7 | vma | Vector mask agnostic
369// 6 | vta | Vector tail agnostic
370// 5:3 | vsew[2:0] | Standard element width (SEW) setting
371// 2:0 | vlmul[2:0] | Vector register group multiplier (LMUL) setting
372unsigned encodeVTYPE(VLMUL VLMul, unsigned SEW, bool TailAgnostic,
373 bool MaskAgnostic, bool AltFmt) {
374 assert(isValidSEW(SEW) && "Invalid SEW");
375 unsigned VLMulBits = static_cast<unsigned>(VLMul);
376 unsigned VSEWBits = encodeSEW(SEW);
377 unsigned VTypeI = (VSEWBits << 3) | (VLMulBits & 0x7);
378 if (TailAgnostic)
379 VTypeI |= 0x40;
380 if (MaskAgnostic)
381 VTypeI |= 0x80;
382 if (AltFmt)
383 VTypeI |= 0x100;
384
385 return VTypeI;
386}
387
388unsigned encodeXSfmmVType(unsigned SEW, unsigned Widen, bool AltFmt) {
389 assert(isValidSEW(SEW) && "Invalid SEW");
390 assert((Widen == 1 || Widen == 2 || Widen == 4) && "Invalid Widen");
391 unsigned VSEWBits = encodeSEW(SEW);
392 unsigned TWiden = Log2_32(Widen) + 1;
393 unsigned VTypeI = (VSEWBits << 3) | AltFmt << 8 | TWiden << 9;
394 return VTypeI;
395}
396
397namespace IME {
398static void assertValidXLenForVType(unsigned XLen) {
399 assert((XLen == 32 || XLen == 64) && "Invalid XLEN");
400}
401
402static unsigned getLambdaShift(unsigned XLen) {
404 return XLen - 4;
405}
406
407static unsigned getAltFmtAShift(unsigned XLen) {
409 return XLen - 6;
410}
411
412static unsigned getAltFmtBShift(unsigned XLen) {
414 return XLen - 7;
415}
416
417static unsigned getBSShift(unsigned XLen) {
419 return XLen - 5;
420}
421
422unsigned encodeLambda(unsigned Lambda) {
423 assert(isValidLambda(Lambda) && "Invalid IME lambda");
424 if (Lambda == 0)
425 return 0;
426 return Log2_32(Lambda) + 1;
427}
428
429std::optional<unsigned> decodeLambda(unsigned Encoding) {
430 assert(Encoding < 8 && "Invalid IME lambda encoding");
431 if (Encoding == 0)
432 return std::nullopt;
433 return 1U << (Encoding - 1);
434}
435
438 return (0x7ULL << getLambdaShift(XLen)) | (1ULL << getAltFmtAShift(XLen)) |
439 (1ULL << getAltFmtBShift(XLen)) | (1ULL << getBSShift(XLen));
440}
441
442uint64_t encodeVTypeFields(unsigned XLen, unsigned Lambda, bool AltFmtA,
443 bool AltFmtB, bool BlockSize16) {
445 uint64_t VType = uint64_t(encodeLambda(Lambda)) << getLambdaShift(XLen);
446 if (AltFmtA)
447 VType |= 1ULL << getAltFmtAShift(XLen);
448 if (AltFmtB)
449 VType |= 1ULL << getAltFmtBShift(XLen);
450 if (BlockSize16)
451 VType |= 1ULL << getBSShift(XLen);
452 return VType;
453}
454
455uint64_t addVTypeFields(uint64_t VType, unsigned XLen, unsigned Lambda,
456 bool AltFmtA, bool AltFmtB, bool BlockSize16) {
457 return (VType & ~getVTypeFieldsMask(XLen)) |
458 encodeVTypeFields(XLen, Lambda, AltFmtA, AltFmtB, BlockSize16);
459}
460
461unsigned getLambdaEncoding(uint64_t VType, unsigned XLen) {
463 return (VType >> getLambdaShift(XLen)) & 0x7;
464}
465
466std::optional<unsigned> getLambda(uint64_t VType, unsigned XLen) {
467 return decodeLambda(getLambdaEncoding(VType, XLen));
468}
469
470bool isAltFmtA(uint64_t VType, unsigned XLen) {
472 return VType & (1ULL << getAltFmtAShift(XLen));
473}
474
475bool isAltFmtB(uint64_t VType, unsigned XLen) {
477 return VType & (1ULL << getAltFmtBShift(XLen));
478}
479
480bool isBlockSize16(uint64_t VType, unsigned XLen) {
482 return VType & (1ULL << getBSShift(XLen));
483}
484} // namespace IME
485
486std::pair<unsigned, bool> decodeVLMUL(VLMUL VLMul) {
487 switch (VLMul) {
488 default:
489 llvm_unreachable("Unexpected LMUL value!");
490 case LMUL_1:
491 case LMUL_2:
492 case LMUL_4:
493 case LMUL_8:
494 return std::make_pair(1 << static_cast<unsigned>(VLMul), false);
495 case LMUL_F2:
496 case LMUL_F4:
497 case LMUL_F8:
498 return std::make_pair(1 << (8 - static_cast<unsigned>(VLMul)), true);
499 }
500}
501
502void printVType(unsigned VType, raw_ostream &OS) {
503 unsigned Sew = getSEW(VType);
504 OS << "e" << Sew;
505
506 bool AltFmt = RISCVVType::isAltFmt(VType);
507 if (AltFmt)
508 OS << "alt";
509
510 unsigned LMul;
511 bool Fractional;
512 std::tie(LMul, Fractional) = decodeVLMUL(getVLMUL(VType));
513
514 if (Fractional)
515 OS << ", mf";
516 else
517 OS << ", m";
518 OS << LMul;
519
520 if (isTailAgnostic(VType))
521 OS << ", ta";
522 else
523 OS << ", tu";
524
525 if (isMaskAgnostic(VType))
526 OS << ", ma";
527 else
528 OS << ", mu";
529}
530
531void printXSfmmVType(unsigned VType, raw_ostream &OS) {
532 OS << "e" << getSEW(VType) << ", w" << getXSfmmWiden(VType);
533}
534
535unsigned getSEWLMULRatio(unsigned SEW, VLMUL VLMul) {
536 unsigned LMul;
537 bool Fractional;
538 std::tie(LMul, Fractional) = decodeVLMUL(VLMul);
539
540 // Convert LMul to a fixed point value with 3 fractional bits.
541 LMul = Fractional ? (8 / LMul) : (LMul * 8);
542
543 assert(SEW >= 8 && "Unexpected SEW value");
544 return (SEW * 8) / LMul;
545}
546
547std::optional<VLMUL> getSameRatioLMUL(unsigned Ratio, unsigned EEW) {
548 unsigned EMULFixedPoint = (EEW * 8) / Ratio;
549 bool Fractional = EMULFixedPoint < 8;
550 unsigned EMUL = Fractional ? 8 / EMULFixedPoint : EMULFixedPoint / 8;
551 if (!isValidLMUL(EMUL, Fractional))
552 return std::nullopt;
553 return RISCVVType::encodeLMUL(EMUL, Fractional);
554}
555
556} // namespace RISCVVType
557
558} // namespace llvm
static SDValue Widen(SelectionDAG *CurDAG, SDValue N)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t uint64_t
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define ENUM(Name,...)
Definition ClauseT.h:60
#define F(x, y, z)
Definition MD5.cpp:54
const RISCVInstrInfo * RII
#define TUNE_PROC(ENUM, NAME)
This file defines generic set operations that may be used on set's of different types,...
This file defines the SmallSet class.
This file defines the SmallVector class.
This file contains some functions that are useful when dealing with strings.
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
Value * RHS
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
static ErrorSuccess success()
Create a success value.
Definition Error.h:336
static LLVM_ABI llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseArchString(StringRef Arch, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck=true)
Parse RISC-V ISA info from arch string.
const_iterator begin() const
Definition SmallSet.h:216
const_iterator end() const
Definition SmallSet.h:222
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
Definition StringRef.h:736
constexpr bool empty() const
Check if the string is empty.
Definition StringRef.h:141
StringRef trim(char Char) const
Return string with consecutive Char characters starting from the left and right removed.
Definition StringRef.h:850
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static unsigned getAltFmtBShift(unsigned XLen)
LLVM_ABI bool isAltFmtB(uint64_t VType, unsigned XLen)
LLVM_ABI std::optional< unsigned > getLambda(uint64_t VType, unsigned XLen)
LLVM_ABI bool isBlockSize16(uint64_t VType, unsigned XLen)
static bool isValidLambda(unsigned Lambda)
static unsigned getBSShift(unsigned XLen)
LLVM_ABI uint64_t addVTypeFields(uint64_t VType, unsigned XLen, unsigned Lambda, bool AltFmtA, bool AltFmtB, bool BlockSize16)
LLVM_ABI bool isAltFmtA(uint64_t VType, unsigned XLen)
LLVM_ABI unsigned getLambdaEncoding(uint64_t VType, unsigned XLen)
LLVM_ABI std::optional< unsigned > decodeLambda(unsigned Encoding)
LLVM_ABI uint64_t getVTypeFieldsMask(unsigned XLen)
LLVM_ABI uint64_t encodeVTypeFields(unsigned XLen, unsigned Lambda, bool AltFmtA, bool AltFmtB, bool BlockSize16)
static void assertValidXLenForVType(unsigned XLen)
static unsigned getLambdaShift(unsigned XLen)
static unsigned getAltFmtAShift(unsigned XLen)
LLVM_ABI unsigned encodeLambda(unsigned Lambda)
static bool isTailAgnostic(unsigned VType)
static VLMUL encodeLMUL(unsigned LMUL, bool Fractional)
LLVM_ABI void printXSfmmVType(unsigned VType, raw_ostream &OS)
LLVM_ABI unsigned encodeXSfmmVType(unsigned SEW, unsigned Widen, bool AltFmt)
static unsigned getXSfmmWiden(unsigned VType)
static bool isValidLMUL(unsigned LMUL, bool Fractional)
LLVM_ABI std::optional< VLMUL > getSameRatioLMUL(unsigned Ratio, unsigned EEW)
static bool isMaskAgnostic(unsigned VType)
LLVM_ABI std::pair< unsigned, bool > decodeVLMUL(VLMUL VLMul)
static unsigned encodeSEW(unsigned SEW)
LLVM_ABI unsigned getSEWLMULRatio(unsigned SEW, VLMUL VLMul)
static bool isValidSEW(unsigned SEW)
LLVM_ABI void printVType(unsigned VType, raw_ostream &OS)
static bool isAltFmt(unsigned VType)
LLVM_ABI unsigned encodeVTYPE(VLMUL VLMUL, unsigned SEW, bool TailAgnostic, bool MaskAgnostic, bool AltFmt=false)
static unsigned getSEW(unsigned VType)
static VLMUL getVLMUL(unsigned VType)
LLVM_ABI bool hasFastVectorUnalignedAccess(StringRef CPU)
LLVM_ABI void getFeaturesForCPU(StringRef CPU, SmallVectorImpl< std::string > &EnabledFeatures, bool NeedPlus=false)
LLVM_ABI void fillValidTuneCPUArchList(SmallVectorImpl< StringRef > &Values, bool IsRV64)
static const CPUInfo * getCPUInfoByName(StringRef CPU)
constexpr CPUInfo RISCVCPUInfo[]
LLVM_ABI CPUModel getCPUModel(StringRef CPU)
LLVM_ABI Error parseTuneFeatureString(StringRef ProcName, StringRef TFString, SmallVectorImpl< std::string > &TuneFeatures)
Parse the tune feature string with the respective processor.
LLVM_ABI void getAllTuneFeatures(SmallVectorImpl< StringRef > &TuneFeatures)
LLVM_ABI StringRef getMArchFromMcpu(StringRef CPU)
LLVM_ABI bool parseCPU(StringRef CPU, bool IsRV64)
LLVM_ABI bool hasFastScalarUnalignedAccess(StringRef CPU)
LLVM_ABI bool hasValidCPUModel(StringRef CPU)
LLVM_ABI StringRef getCPUNameFromCPUModel(const CPUModel &Model)
LLVM_ABI bool parseTuneCPU(StringRef CPU, bool IsRV64)
LLVM_ABI void fillValidCPUArchList(SmallVectorImpl< StringRef > &Values, bool IsRV64)
LLVM_ABI void getCPUConfigurableTuneFeatures(StringRef CPU, SmallVectorImpl< StringRef > &Directives)
EnumSet< Directive > Directives
Definition OMP.h:159
This is an optimization pass for GlobalISel generic memory operations.
bool errorToBool(Error Err)
Helper for converting an Error to a bool.
Definition Error.h:1129
bool operator<(int64_t V1, const APSInt &V2)
Definition APSInt.h:360
RelativeUniformCounterPtr Values
Definition InstrProf.h:91
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
Definition MathExtras.h:326
void sort(IteratorTy Start, IteratorTy End)
Definition STLExtras.h:1652
S1Ty set_intersection(const S1Ty &S1, const S2Ty &S2)
set_intersection(A, B) - Return A ^ B
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Definition Error.h:340
std::string join(IteratorT Begin, IteratorT End, StringRef Separator)
Joins the strings in the range [Begin, End), adding Separator between the elements.
ArrayRef(const T &OneElt) -> ArrayRef< T >
static LLVM_ABI char ID