27struct RISCVExtensionVersion {
32struct RISCVSupportedExtension {
43 "i",
"m",
"a",
"f",
"d",
"zicsr",
"zifencei"
47 {
"i", RISCVExtensionVersion{2, 1}},
48 {
"e", RISCVExtensionVersion{2, 0}},
49 {
"m", RISCVExtensionVersion{2, 0}},
50 {
"a", RISCVExtensionVersion{2, 1}},
51 {
"f", RISCVExtensionVersion{2, 2}},
52 {
"d", RISCVExtensionVersion{2, 2}},
53 {
"c", RISCVExtensionVersion{2, 0}},
55 {
"h", RISCVExtensionVersion{1, 0}},
57 {
"zihintpause", RISCVExtensionVersion{2, 0}},
59 {
"zfhmin", RISCVExtensionVersion{1, 0}},
60 {
"zfh", RISCVExtensionVersion{1, 0}},
62 {
"zfinx", RISCVExtensionVersion{1, 0}},
63 {
"zdinx", RISCVExtensionVersion{1, 0}},
64 {
"zhinxmin", RISCVExtensionVersion{1, 0}},
65 {
"zhinx", RISCVExtensionVersion{1, 0}},
67 {
"zba", RISCVExtensionVersion{1, 0}},
68 {
"zbb", RISCVExtensionVersion{1, 0}},
69 {
"zbc", RISCVExtensionVersion{1, 0}},
70 {
"zbs", RISCVExtensionVersion{1, 0}},
72 {
"zbkb", RISCVExtensionVersion{1, 0}},
73 {
"zbkc", RISCVExtensionVersion{1, 0}},
74 {
"zbkx", RISCVExtensionVersion{1, 0}},
75 {
"zknd", RISCVExtensionVersion{1, 0}},
76 {
"zkne", RISCVExtensionVersion{1, 0}},
77 {
"zknh", RISCVExtensionVersion{1, 0}},
78 {
"zksed", RISCVExtensionVersion{1, 0}},
79 {
"zksh", RISCVExtensionVersion{1, 0}},
80 {
"zkr", RISCVExtensionVersion{1, 0}},
81 {
"zkn", RISCVExtensionVersion{1, 0}},
82 {
"zks", RISCVExtensionVersion{1, 0}},
83 {
"zkt", RISCVExtensionVersion{1, 0}},
84 {
"zk", RISCVExtensionVersion{1, 0}},
86 {
"zmmul", RISCVExtensionVersion{1, 0}},
88 {
"v", RISCVExtensionVersion{1, 0}},
89 {
"zvl32b", RISCVExtensionVersion{1, 0}},
90 {
"zvl64b", RISCVExtensionVersion{1, 0}},
91 {
"zvl128b", RISCVExtensionVersion{1, 0}},
92 {
"zvl256b", RISCVExtensionVersion{1, 0}},
93 {
"zvl512b", RISCVExtensionVersion{1, 0}},
94 {
"zvl1024b", RISCVExtensionVersion{1, 0}},
95 {
"zvl2048b", RISCVExtensionVersion{1, 0}},
96 {
"zvl4096b", RISCVExtensionVersion{1, 0}},
97 {
"zvl8192b", RISCVExtensionVersion{1, 0}},
98 {
"zvl16384b", RISCVExtensionVersion{1, 0}},
99 {
"zvl32768b", RISCVExtensionVersion{1, 0}},
100 {
"zvl65536b", RISCVExtensionVersion{1, 0}},
101 {
"zve32x", RISCVExtensionVersion{1, 0}},
102 {
"zve32f", RISCVExtensionVersion{1, 0}},
103 {
"zve64x", RISCVExtensionVersion{1, 0}},
104 {
"zve64f", RISCVExtensionVersion{1, 0}},
105 {
"zve64d", RISCVExtensionVersion{1, 0}},
107 {
"zicbom", RISCVExtensionVersion{1, 0}},
108 {
"zicboz", RISCVExtensionVersion{1, 0}},
109 {
"zicbop", RISCVExtensionVersion{1, 0}},
110 {
"zicsr", RISCVExtensionVersion{2, 0}},
111 {
"zifencei", RISCVExtensionVersion{2, 0}},
113 {
"zawrs", RISCVExtensionVersion{1, 0}},
115 {
"svnapot", RISCVExtensionVersion{1, 0}},
116 {
"svpbmt", RISCVExtensionVersion{1, 0}},
117 {
"svinval", RISCVExtensionVersion{1, 0}},
120 {
"xtheadba", RISCVExtensionVersion{1, 0}},
121 {
"xtheadbb", RISCVExtensionVersion{1, 0}},
122 {
"xtheadbs", RISCVExtensionVersion{1, 0}},
123 {
"xtheadcmo", RISCVExtensionVersion{1, 0}},
124 {
"xtheadcondmov", RISCVExtensionVersion{1, 0}},
125 {
"xtheadfmemidx", RISCVExtensionVersion{1, 0}},
126 {
"xtheadmac", RISCVExtensionVersion{1, 0}},
127 {
"xtheadmemidx", RISCVExtensionVersion{1, 0}},
128 {
"xtheadmempair", RISCVExtensionVersion{1, 0}},
129 {
"xtheadsync", RISCVExtensionVersion{1, 0}},
130 {
"xtheadvdot", RISCVExtensionVersion{1, 0}},
131 {
"xventanacondops", RISCVExtensionVersion{1, 0}},
135 {
"zihintntl", RISCVExtensionVersion{0, 2}},
137 {
"zca", RISCVExtensionVersion{1, 0}},
138 {
"zcb", RISCVExtensionVersion{1, 0}},
139 {
"zcd", RISCVExtensionVersion{1, 0}},
140 {
"zcf", RISCVExtensionVersion{1, 0}},
141 {
"zfa", RISCVExtensionVersion{0, 1}},
142 {
"zicond", RISCVExtensionVersion{1, 0}},
143 {
"zvfh", RISCVExtensionVersion{0, 1}},
144 {
"ztso", RISCVExtensionVersion{0, 1}},
147 {
"zvkb", RISCVExtensionVersion{0, 3}},
148 {
"zvkg", RISCVExtensionVersion{0, 3}},
149 {
"zvkn", RISCVExtensionVersion{0, 3}},
150 {
"zvknha", RISCVExtensionVersion{0, 3}},
151 {
"zvknhb", RISCVExtensionVersion{0, 3}},
152 {
"zvkned", RISCVExtensionVersion{0, 3}},
153 {
"zvks", RISCVExtensionVersion{0, 3}},
154 {
"zvksed", RISCVExtensionVersion{0, 3}},
155 {
"zvksh", RISCVExtensionVersion{0, 3}},
159 return Ext.consume_front(
"experimental-");
171 "Already guarded by if-statement in ::parseArchString");
173 int Pos = Ext.size() - 1;
174 while (Pos > 0 &&
isDigit(Ext[Pos]))
176 if (Pos > 0 && Ext[Pos] ==
'p' &&
isDigit(Ext[Pos - 1])) {
178 while (Pos > 0 &&
isDigit(Ext[Pos]))
188 bool operator()(
const RISCVSupportedExtension &ExtInfo) {
189 return ExtInfo.Name ==
Ext;
194static std::optional<RISCVExtensionVersion>
200 auto ExtensionInfoIterator =
llvm::find_if(ExtInfo, FindByName(ExtName));
202 if (ExtensionInfoIterator == ExtInfo.end()) {
205 return ExtensionInfoIterator->Version;
210void RISCVISAInfo::addExtension(
StringRef ExtName,
unsigned MajorVersion,
211 unsigned MinorVersion) {
213 Ext.MajorVersion = MajorVersion;
214 Ext.MinorVersion = MinorVersion;
215 Exts[ExtName.
str()] =
Ext;
219 if (Ext.startswith(
"sx"))
220 return "non-standard supervisor-level extension";
221 if (Ext.startswith(
"s"))
222 return "standard supervisor-level extension";
223 if (Ext.startswith(
"x"))
224 return "non-standard user-level extension";
225 if (Ext.startswith(
"z"))
226 return "standard user-level extension";
231 if (Ext.startswith(
"sx"))
233 if (Ext.startswith(
"s"))
235 if (Ext.startswith(
"x"))
237 if (Ext.startswith(
"z"))
242static std::optional<RISCVExtensionVersion>
249 return ExtIterator->Version;
267 unsigned MinorVersion) {
268 auto FindByNameAndVersion = [=](
const RISCVSupportedExtension &ExtInfo) {
269 return ExtInfo.Name == Ext && (MajorVersion == ExtInfo.Version.Major) &&
270 (MinorVersion == ExtInfo.Version.Minor);
282 return Exts.count(Ext.str()) != 0;
304 assert(Ext >=
'a' && Ext <=
'z');
324 assert(ExtName.size() >= 1);
325 switch (ExtName[0]) {
329 assert(ExtName.size() >= 2);
336 assert(ExtName.size() == 1);
344 const std::string &RHS) {
349 if (LHSRank != RHSRank)
350 return LHSRank < RHSRank;
357 std::vector<StringRef> &Features,
359 bool AddAllExtensions)
const {
360 for (
auto const &Ext : Exts) {
367 Features.push_back(StrAlloc(
"+experimental-" + ExtName));
369 Features.push_back(StrAlloc(
"+" + ExtName));
372 if (AddAllExtensions) {
374 if (Exts.count(Ext.Name))
376 Features.push_back(StrAlloc(
Twine(
"-") + Ext.Name));
380 if (Exts.count(Ext.Name))
382 Features.push_back(StrAlloc(
Twine(
"-experimental-") + Ext.Name));
393 unsigned &Minor,
unsigned &ConsumeLength,
394 bool EnableExperimentalExtension,
395 bool ExperimentalExtensionVersionCheck) {
400 MajorStr = In.take_while(
isDigit);
401 In = In.substr(MajorStr.
size());
403 if (!MajorStr.
empty() && In.consume_front(
"p")) {
404 MinorStr = In.take_while(
isDigit);
405 In = In.substr(MajorStr.
size() + MinorStr.
size() - 1);
408 if (MinorStr.
empty()) {
411 "minor version number missing after 'p' for extension '" + Ext +
"'");
418 "Failed to parse major version number for extension '" + Ext +
"'");
423 "Failed to parse minor version number for extension '" + Ext +
"'");
425 ConsumeLength = MajorStr.
size();
427 if (!MinorStr.
empty())
428 ConsumeLength += MinorStr.
size() + 1 ;
433 if (Ext.size() > 1 && In.size()) {
435 "multi-character extensions must be separated by underscores";
441 if (!EnableExperimentalExtension) {
442 std::string
Error =
"requires '-menable-experimental-extensions' for "
443 "experimental extension '" +
448 if (ExperimentalExtensionVersionCheck &&
451 "experimental extension requires explicit version number `" +
456 auto SupportedVers = *ExperimentalExtension;
457 if (ExperimentalExtensionVersionCheck &&
458 (Major != SupportedVers.Major || Minor != SupportedVers.Minor)) {
459 std::string
Error =
"unsupported version number " + MajorStr.
str();
460 if (!MinorStr.
empty())
462 Error +=
" for experimental extension '" + Ext.str() +
463 "' (this compiler supports " + utostr(SupportedVers.Major) +
464 "." + utostr(SupportedVers.Minor) +
")";
477 Major = DefaultVersion->Major;
478 Minor = DefaultVersion->Minor;
488 std::string
Error =
"unsupported version number " + std::string(MajorStr);
489 if (!MinorStr.
empty())
491 Error +=
" for extension '" + Ext.str() +
"'";
497 const std::vector<std::string> &Features) {
498 assert(XLen == 32 || XLen == 64);
499 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
501 for (
auto &Feature : Features) {
503 bool Experimental =
false;
504 assert(ExtName.
size() > 1 && (ExtName[0] ==
'+' || ExtName[0] ==
'-'));
505 bool Add = ExtName[0] ==
'+';
508 auto ExtensionInfos = Experimental
511 auto ExtensionInfoIterator =
516 if (ExtensionInfoIterator == ExtensionInfos.end())
520 ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version.Major,
521 ExtensionInfoIterator->Version.Minor);
523 ISAInfo->Exts.erase(ExtName.
str());
533 "string must be lowercase");
543 "arch string must begin with valid base ISA");
544 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
552 Arch.
split(Split,
'_');
555 std::tie(Prefix, MinorVersionStr) = Ext.rsplit(
'p');
556 if (MinorVersionStr.
empty())
558 "extension lacks version in expected format");
559 unsigned MajorVersion, MinorVersion;
562 "failed to parse minor version number");
566 int TrailingDigits = 0;
568 while (!ExtName.
empty()) {
576 "extension lacks version in expected format");
578 StringRef MajorVersionStr = Prefix.take_back(TrailingDigits);
581 "failed to parse major version number");
582 ISAInfo->addExtension(ExtName, MajorVersion, MinorVersion);
584 ISAInfo->updateFLen();
585 ISAInfo->updateMinVLen();
586 ISAInfo->updateMaxELen();
587 return std::move(ISAInfo);
592 bool ExperimentalExtensionVersionCheck,
593 bool IgnoreUnknown) {
597 "string must be lowercase");
605 "string must begin with rv32{i,e,g} or rv64{i,e,g}");
608 unsigned XLen = HasRV64 ? 64 : 32;
609 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
614 char Baseline = Arch[4];
620 "first letter should be 'e', 'i' or 'g'");
628 "version not supported for 'g'");
633 if (Arch.
back() ==
'_')
635 "extension name missing after separator '_'");
647 OtherExts = Exts.
substr(Pos);
648 Exts = Exts.
substr(0, Pos);
651 unsigned Major, Minor, ConsumeLength;
652 if (Baseline ==
'g') {
661 ISAInfo->addExtension(Ext, Version->Major, Version->Minor);
668 StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
669 EnableExperimentalExtension, ExperimentalExtensionVersionCheck)) {
676 Major = Version->Major;
677 Minor = Version->Minor;
680 ISAInfo->addExtension(
StringRef(&Baseline, 1), Major, Minor);
690 auto StdExtsItr = StdExts.
begin();
691 auto StdExtsEnd = StdExts.
end();
693 I += 1 + ConsumeLength;
701 while (StdExtsItr != StdExtsEnd && *StdExtsItr !=
C)
704 if (StdExtsItr == StdExtsEnd) {
710 "standard user-level extension not given in canonical order '%c'",
715 "invalid standard user-level extension '%c'",
C);
722 unsigned Major, Minor, ConsumeLength;
723 if (std::next(
I) !=
E)
726 ConsumeLength, EnableExperimentalExtension,
727 ExperimentalExtensionVersionCheck)) {
730 GoToNextExt(
I, ConsumeLength);
741 GoToNextExt(
I, ConsumeLength);
745 "unsupported standard user-level extension '%c'",
748 ISAInfo->addExtension(
StringRef(&
C, 1), Major, Minor);
752 GoToNextExt(
I, ConsumeLength);
768 OtherExts.
split(Split,
'_');
771 std::array<StringRef, 4> Prefix{
"z",
"x",
"s",
"sx"};
772 auto I = Prefix.begin();
773 auto E = Prefix.end();
774 if (Split.size() > 1 || Split[0] !=
"") {
778 "extension name missing after separator '_'");
790 "invalid extension prefix '" + Ext +
"'");
801 "%s not given in canonical order '%s'",
802 Desc.
str().c_str(), Ext.str().c_str());
805 if (!IgnoreUnknown &&
Name.size() ==
Type.size()) {
807 "%s name missing after '%s'",
808 Desc.
str().c_str(),
Type.str().c_str());
811 unsigned Major, Minor, ConsumeLength;
813 EnableExperimentalExtension,
814 ExperimentalExtensionVersionCheck)) {
825 Desc.
str().c_str(),
Name.str().c_str());
831 ISAInfo->addExtension(
Name, Major, Minor);
838 for (
auto Ext : AllExts) {
842 Desc.
str().c_str(), Ext.str().c_str());
849Error RISCVISAInfo::checkDependency() {
850 bool HasD = Exts.count(
"d") != 0;
851 bool HasF = Exts.count(
"f") != 0;
852 bool HasZfinx = Exts.count(
"zfinx") != 0;
853 bool HasZdinx = Exts.count(
"zdinx") != 0;
854 bool HasVector = Exts.count(
"zve32x") != 0;
855 bool HasZve32f = Exts.count(
"zve32f") != 0;
856 bool HasZve64d = Exts.count(
"zve64d") != 0;
857 bool HasZvl = MinVLen != 0;
859 if (HasF && HasZfinx)
861 "'f' and 'zfinx' extensions are incompatible");
863 if (HasZve32f && !HasF && !HasZfinx)
866 "'zve32f' requires 'f' or 'zfinx' extension to also be specified");
868 if (HasZve64d && !HasD && !HasZdinx)
871 "'zve64d' requires 'd' or 'zdinx' extension to also be specified");
873 if (Exts.count(
"zvfh") && !Exts.count(
"zfh") && !Exts.count(
"zfhmin") &&
874 !Exts.count(
"zhinx") && !Exts.count(
"zhinxmin"))
877 "'zvfh' requires 'zfh', 'zfhmin', 'zhinx' or 'zhinxmin' extension to "
878 "also be specified");
880 if (HasZvl && !HasVector)
883 "'zvl*b' requires 'v' or 'zve*' extension to also be specified");
885 if ((Exts.count(
"zvkb") || Exts.count(
"zvkg") || Exts.count(
"zvkn") ||
886 Exts.count(
"zvknha") || Exts.count(
"zvkned") || Exts.count(
"zvks") ||
887 Exts.count(
"zvksed") || Exts.count(
"zvksh")) &&
891 "'zvk*' requires 'v' or 'zve*' extension to also be specified");
893 if (Exts.count(
"zvknhb") && !Exts.count(
"zve64x"))
896 "'zvknhb' requires 'v' or 'zve64*' extension to also be specified");
932 "zkne",
"zknd",
"zknh"};
992void RISCVISAInfo::updateImplication() {
993 bool HasE = Exts.count(
"e") != 0;
994 bool HasI = Exts.count(
"i") != 0;
998 if (!HasE && !HasI) {
1008 for (
auto const &Ext : Exts)
1011 while (!WorkList.
empty()) {
1015 for (
const char *ImpliedExt :
I->Exts) {
1016 if (WorkList.
count(ImpliedExt))
1018 if (Exts.count(ImpliedExt))
1022 WorkList.
insert(ImpliedExt);
1039void RISCVISAInfo::updateCombination() {
1040 bool IsNewCombine =
false;
1042 IsNewCombine =
false;
1044 auto CombineExt = CombineIntoExt.CombineExt;
1045 auto RequiredExts = CombineIntoExt.RequiredExts;
1048 bool IsAllRequiredFeatureExist =
true;
1049 for (
const char *Ext : RequiredExts)
1051 if (IsAllRequiredFeatureExist) {
1054 IsNewCombine =
true;
1057 }
while (IsNewCombine);
1060void RISCVISAInfo::updateFLen() {
1063 if (Exts.count(
"d"))
1065 else if (Exts.count(
"f"))
1069void RISCVISAInfo::updateMinVLen() {
1070 for (
auto const &Ext : Exts) {
1076 MinVLen = std::max(MinVLen, ZvlLen);
1081void RISCVISAInfo::updateMaxELen() {
1083 for (
auto const &Ext : Exts) {
1087 if (ExtName.
back() ==
'f')
1088 MaxELenFp = std::max(MaxELenFp, 32u);
1089 if (ExtName.
back() ==
'd')
1090 MaxELenFp = std::max(MaxELenFp, 64u);
1094 MaxELen = std::max(MaxELen, ZveELen);
1103 Arch <<
"rv" << XLen;
1105 ListSeparator LS(
"_");
1106 for (
auto const &Ext : Exts) {
1108 auto ExtInfo = Ext.second;
1109 Arch << LS << ExtName;
1110 Arch << ExtInfo.MajorVersion <<
"p" << ExtInfo.MinorVersion;
1117 std::vector<std::string> FeatureVector;
1118 for (
auto const &Ext : Exts) {
1119 std::string ExtName = Ext.first;
1125 ?
"+experimental-" + ExtName
1127 FeatureVector.push_back(Feature);
1129 return FeatureVector;
1134 ISAInfo->updateImplication();
1135 ISAInfo->updateCombination();
1136 ISAInfo->updateFLen();
1137 ISAInfo->updateMinVLen();
1138 ISAInfo->updateMaxELen();
1140 if (
Error Result = ISAInfo->checkDependency())
1141 return std::move(Result);
1142 return std::move(ISAInfo);
1152 }
else if (XLen == 64) {
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
std::optional< std::vector< StOtherPiece > > Other
static const char * ImpliedExtsZvl8192b[]
static const char * ImpliedExtsZks[]
static const char * ImpliedExtsZcb[]
static const char * ImpliedExtsZvl2048b[]
static const char * ImpliedExtsXTHeadVdot[]
static StringRef getExtensionTypeDesc(StringRef Ext)
static const char * ImpliedExtsZvl512b[]
static const char * ImpliedExtsZve32x[]
static constexpr ImpliedExtsEntry ImpliedExts[]
static const char * ImpliedExtsZve32f[]
static const char * ImpliedExtsZvl4096b[]
static const RISCVSupportedExtension SupportedExtensions[]
static const char * ImpliedExtsZvfh[]
static const char * ImpliedExtsZvl65536b[]
static const char * ImpliedExtsZvkn[]
static const char * ImpliedExtsZve64f[]
static const char * ImpliedExtsZvl1024b[]
static const char * ImpliedExtsZhinx[]
static constexpr CombinedExtsEntry CombineIntoExts[]
static const char * ImpliedExtsZvks[]
static const char * ImpliedExtsZve64x[]
static const char * ImpliedExtsZk[]
static const RISCVSupportedExtension SupportedExperimentalExtensions[]
static const char * ImpliedExtsZvl256b[]
static StringRef getExtensionType(StringRef Ext)
static const char * ImpliedExtsZfhmin[]
static std::optional< RISCVExtensionVersion > isExperimentalExtension(StringRef Ext)
static const char * ImpliedExtsD[]
static const char * ImpliedExtsZkn[]
static bool stripExperimentalPrefix(StringRef &Ext)
static std::optional< RISCVExtensionVersion > findDefaultVersion(StringRef ExtName)
static const char * ImpliedExtsZvl64b[]
static const char * ImpliedExtsZvl16384b[]
static const char * ImpliedExtsZvl128b[]
static constexpr StringLiteral AllStdExts
static const char * ImpliedExtsF[]
static const char * ImpliedExtsZfh[]
static const char * ImpliedExtsZvknhb[]
static Error getExtensionVersion(StringRef Ext, StringRef In, unsigned &Major, unsigned &Minor, unsigned &ConsumeLength, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck)
static const char * ImpliedExtsZvl32768b[]
static const char * ImpliedExtsZfinx[]
static const char * ImpliedExtsZfa[]
static unsigned getExtensionRank(const std::string &ExtName)
static const char * ImpliedExtsZdinx[]
static unsigned singleLetterExtensionRank(char Ext)
static size_t findFirstNonVersionCharacter(StringRef Ext)
static const char * ImpliedExtsZhinxmin[]
static const char * RISCVGImplications[]
static const char * ImpliedExtsV[]
static const char * ImpliedExtsZve64d[]
static bool isDigit(const char C)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
static bool isSupportedExtensionFeature(StringRef Ext)
static llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseNormalizedArchString(StringRef Arch)
Parse RISC-V ISA info from an arch string that is already in normalized form (as defined in the psABI...
bool hasExtension(StringRef Ext) const
static bool compareExtension(const std::string &LHS, const std::string &RHS)
std::string toString() const
static llvm::Expected< std::unique_ptr< RISCVISAInfo > > postProcessAndChecking(std::unique_ptr< RISCVISAInfo > &&ISAInfo)
std::vector< std::string > toFeatureVector() const
StringRef computeDefaultABI() const
static bool isSupportedExtension(StringRef Ext)
static llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseFeatures(unsigned XLen, const std::vector< std::string > &Features)
Parse RISC-V ISA info from feature vector.
void toFeatures(std::vector< StringRef > &Features, llvm::function_ref< StringRef(const Twine &)> StrAlloc, bool AddAllExtensions) const
Convert RISC-V ISA info to a feature vector.
static llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseArchString(StringRef Arch, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck=true, bool IgnoreUnknown=false)
Parse RISC-V ISA info from arch string.
size_type count(const key_type &key) const
Count the number of elements of a given key in the SetVector.
bool insert(const value_type &X)
Insert a new element into the SetVector.
bool empty() const
Determine if the SetVector is empty or not.
value_type pop_back_val()
A SetVector that performs no allocations if smaller than a certain size.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
StringRef - Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool consume_back(StringRef Suffix)
Returns true if this StringRef has the given suffix and removes that suffix.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
std::string str() const
str - Get the contents as an std::string.
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.
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
char back() const
back - Get the last character in the string.
constexpr size_t size() const
size - Get the string size.
bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
bool startswith(StringRef Prefix) const
bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
size_t find_first_of(char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
static constexpr size_t npos
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
An efficient, type-erasing, non-owning reference to a callable.
A raw_ostream that writes to an std::string.
std::string & str()
Returns the string's reference.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
bool is_sorted(R &&Range, Compare C)
Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a...
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
void consumeError(Error Err)
Consume a Error without doing anything.
ArrayRef< const char * > RequiredExts
ArrayRef< const char * > Exts
bool operator<(const ImpliedExtsEntry &Other) const
bool operator<(StringRef Other) const