28struct RISCVExtensionVersion {
33struct RISCVSupportedExtension {
38 bool operator<(
const RISCVSupportedExtension &RHS)
const {
48 "i",
"m",
"a",
"f",
"d",
"zicsr",
"zifencei"
53 {
"a", RISCVExtensionVersion{2, 1}},
54 {
"c", RISCVExtensionVersion{2, 0}},
55 {
"d", RISCVExtensionVersion{2, 2}},
56 {
"e", RISCVExtensionVersion{2, 0}},
57 {
"f", RISCVExtensionVersion{2, 2}},
58 {
"h", RISCVExtensionVersion{1, 0}},
59 {
"i", RISCVExtensionVersion{2, 1}},
60 {
"m", RISCVExtensionVersion{2, 0}},
62 {
"svinval", RISCVExtensionVersion{1, 0}},
63 {
"svnapot", RISCVExtensionVersion{1, 0}},
64 {
"svpbmt", RISCVExtensionVersion{1, 0}},
66 {
"v", RISCVExtensionVersion{1, 0}},
69 {
"xcvalu", RISCVExtensionVersion{1, 0}},
70 {
"xcvbi", RISCVExtensionVersion{1, 0}},
71 {
"xcvbitmanip", RISCVExtensionVersion{1, 0}},
72 {
"xcvmac", RISCVExtensionVersion{1, 0}},
73 {
"xcvsimd", RISCVExtensionVersion{1, 0}},
74 {
"xsfcie", RISCVExtensionVersion{1, 0}},
75 {
"xsfvcp", RISCVExtensionVersion{1, 0}},
76 {
"xtheadba", RISCVExtensionVersion{1, 0}},
77 {
"xtheadbb", RISCVExtensionVersion{1, 0}},
78 {
"xtheadbs", RISCVExtensionVersion{1, 0}},
79 {
"xtheadcmo", RISCVExtensionVersion{1, 0}},
80 {
"xtheadcondmov", RISCVExtensionVersion{1, 0}},
81 {
"xtheadfmemidx", RISCVExtensionVersion{1, 0}},
82 {
"xtheadmac", RISCVExtensionVersion{1, 0}},
83 {
"xtheadmemidx", RISCVExtensionVersion{1, 0}},
84 {
"xtheadmempair", RISCVExtensionVersion{1, 0}},
85 {
"xtheadsync", RISCVExtensionVersion{1, 0}},
86 {
"xtheadvdot", RISCVExtensionVersion{1, 0}},
87 {
"xventanacondops", RISCVExtensionVersion{1, 0}},
89 {
"zawrs", RISCVExtensionVersion{1, 0}},
91 {
"zba", RISCVExtensionVersion{1, 0}},
92 {
"zbb", RISCVExtensionVersion{1, 0}},
93 {
"zbc", RISCVExtensionVersion{1, 0}},
94 {
"zbkb", RISCVExtensionVersion{1, 0}},
95 {
"zbkc", RISCVExtensionVersion{1, 0}},
96 {
"zbkx", RISCVExtensionVersion{1, 0}},
97 {
"zbs", RISCVExtensionVersion{1, 0}},
99 {
"zca", RISCVExtensionVersion{1, 0}},
100 {
"zcb", RISCVExtensionVersion{1, 0}},
101 {
"zcd", RISCVExtensionVersion{1, 0}},
102 {
"zce", RISCVExtensionVersion{1, 0}},
103 {
"zcf", RISCVExtensionVersion{1, 0}},
104 {
"zcmp", RISCVExtensionVersion{1, 0}},
105 {
"zcmt", RISCVExtensionVersion{1, 0}},
107 {
"zdinx", RISCVExtensionVersion{1, 0}},
109 {
"zfh", RISCVExtensionVersion{1, 0}},
110 {
"zfhmin", RISCVExtensionVersion{1, 0}},
111 {
"zfinx", RISCVExtensionVersion{1, 0}},
113 {
"zhinx", RISCVExtensionVersion{1, 0}},
114 {
"zhinxmin", RISCVExtensionVersion{1, 0}},
116 {
"zicbom", RISCVExtensionVersion{1, 0}},
117 {
"zicbop", RISCVExtensionVersion{1, 0}},
118 {
"zicboz", RISCVExtensionVersion{1, 0}},
119 {
"zicntr", RISCVExtensionVersion{2, 0}},
120 {
"zicsr", RISCVExtensionVersion{2, 0}},
121 {
"zifencei", RISCVExtensionVersion{2, 0}},
122 {
"zihintntl", RISCVExtensionVersion{1, 0}},
123 {
"zihintpause", RISCVExtensionVersion{2, 0}},
124 {
"zihpm", RISCVExtensionVersion{2, 0}},
126 {
"zk", RISCVExtensionVersion{1, 0}},
127 {
"zkn", RISCVExtensionVersion{1, 0}},
128 {
"zknd", RISCVExtensionVersion{1, 0}},
129 {
"zkne", RISCVExtensionVersion{1, 0}},
130 {
"zknh", RISCVExtensionVersion{1, 0}},
131 {
"zkr", RISCVExtensionVersion{1, 0}},
132 {
"zks", RISCVExtensionVersion{1, 0}},
133 {
"zksed", RISCVExtensionVersion{1, 0}},
134 {
"zksh", RISCVExtensionVersion{1, 0}},
135 {
"zkt", RISCVExtensionVersion{1, 0}},
137 {
"zmmul", RISCVExtensionVersion{1, 0}},
139 {
"zve32f", RISCVExtensionVersion{1, 0}},
140 {
"zve32x", RISCVExtensionVersion{1, 0}},
141 {
"zve64d", RISCVExtensionVersion{1, 0}},
142 {
"zve64f", RISCVExtensionVersion{1, 0}},
143 {
"zve64x", RISCVExtensionVersion{1, 0}},
145 {
"zvfh", RISCVExtensionVersion{1, 0}},
146 {
"zvfhmin", RISCVExtensionVersion{1, 0}},
148 {
"zvl1024b", RISCVExtensionVersion{1, 0}},
149 {
"zvl128b", RISCVExtensionVersion{1, 0}},
150 {
"zvl16384b", RISCVExtensionVersion{1, 0}},
151 {
"zvl2048b", RISCVExtensionVersion{1, 0}},
152 {
"zvl256b", RISCVExtensionVersion{1, 0}},
153 {
"zvl32768b", RISCVExtensionVersion{1, 0}},
154 {
"zvl32b", RISCVExtensionVersion{1, 0}},
155 {
"zvl4096b", RISCVExtensionVersion{1, 0}},
156 {
"zvl512b", RISCVExtensionVersion{1, 0}},
157 {
"zvl64b", RISCVExtensionVersion{1, 0}},
158 {
"zvl65536b", RISCVExtensionVersion{1, 0}},
159 {
"zvl8192b", RISCVExtensionVersion{1, 0}},
164 {
"smaia", RISCVExtensionVersion{1, 0}},
165 {
"ssaia", RISCVExtensionVersion{1, 0}},
167 {
"zacas", RISCVExtensionVersion{1, 0}},
169 {
"zfa", RISCVExtensionVersion{0, 2}},
170 {
"zfbfmin", RISCVExtensionVersion{0, 8}},
172 {
"zicfilp", RISCVExtensionVersion{0, 2}},
173 {
"zicond", RISCVExtensionVersion{1, 0}},
175 {
"ztso", RISCVExtensionVersion{0, 1}},
177 {
"zvbb", RISCVExtensionVersion{1, 0}},
178 {
"zvbc", RISCVExtensionVersion{1, 0}},
180 {
"zvfbfmin", RISCVExtensionVersion{0, 8}},
181 {
"zvfbfwma", RISCVExtensionVersion{0, 8}},
184 {
"zvkb", RISCVExtensionVersion{1, 0}},
185 {
"zvkg", RISCVExtensionVersion{1, 0}},
186 {
"zvkn", RISCVExtensionVersion{1, 0}},
187 {
"zvknc", RISCVExtensionVersion{1, 0}},
188 {
"zvkned", RISCVExtensionVersion{1, 0}},
189 {
"zvkng", RISCVExtensionVersion{1, 0}},
190 {
"zvknha", RISCVExtensionVersion{1, 0}},
191 {
"zvknhb", RISCVExtensionVersion{1, 0}},
192 {
"zvks", RISCVExtensionVersion{1, 0}},
193 {
"zvksc", RISCVExtensionVersion{1, 0}},
194 {
"zvksed", RISCVExtensionVersion{1, 0}},
195 {
"zvksg", RISCVExtensionVersion{1, 0}},
196 {
"zvksh", RISCVExtensionVersion{1, 0}},
197 {
"zvkt", RISCVExtensionVersion{1, 0}},
202 static std::atomic<bool> TableChecked(
false);
203 if (!TableChecked.load(std::memory_order_relaxed)) {
205 "Extensions are not sorted by name");
207 "Experimental extensions are not sorted by name");
208 TableChecked.store(
true, std::memory_order_relaxed);
214 const std::string Description) {
216 <<
format(Description.empty() ?
"%-20s%s\n" :
"%-20s%-10s%s\n",
217 Name.c_str(), Version.c_str(), Description.c_str());
222 outs() <<
"All available -march extensions for RISC-V\n\n";
227 ExtMap[
E.Name] = {
E.Version.Major,
E.Version.Minor};
228 for (
const auto &
E : ExtMap) {
229 std::string Version = std::to_string(
E.second.MajorVersion) +
"." +
230 std::to_string(
E.second.MinorVersion);
234 outs() <<
"\nExperimental extensions\n";
237 ExtMap[
E.Name] = {
E.Version.Major,
E.Version.Minor};
238 for (
const auto &
E : ExtMap) {
239 std::string Version = std::to_string(
E.second.MajorVersion) +
"." +
240 std::to_string(
E.second.MinorVersion);
244 outs() <<
"\nUse -march to specify the target's extension.\n"
245 "For example, clang -march=rv32i_v1p0\n";
249 return Ext.consume_front(
"experimental-");
261 "Already guarded by if-statement in ::parseArchString");
263 int Pos = Ext.size() - 1;
264 while (Pos > 0 &&
isDigit(Ext[Pos]))
266 if (Pos > 0 && Ext[Pos] ==
'p' &&
isDigit(Ext[Pos - 1])) {
268 while (Pos > 0 &&
isDigit(Ext[Pos]))
276 bool operator()(
const RISCVSupportedExtension &LHS,
StringRef RHS) {
279 bool operator()(
StringRef LHS,
const RISCVSupportedExtension &RHS) {
285static std::optional<RISCVExtensionVersion>
293 if (
I == ExtInfo.end() ||
I->Name != ExtName)
301void RISCVISAInfo::addExtension(
StringRef ExtName,
unsigned MajorVersion,
302 unsigned MinorVersion) {
304 Ext.MajorVersion = MajorVersion;
305 Ext.MinorVersion = MinorVersion;
306 Exts[ExtName.
str()] =
Ext;
310 if (Ext.startswith(
"s"))
311 return "standard supervisor-level extension";
312 if (Ext.startswith(
"x"))
313 return "non-standard user-level extension";
314 if (Ext.startswith(
"z"))
315 return "standard user-level extension";
320 if (Ext.startswith(
"s"))
322 if (Ext.startswith(
"x"))
324 if (Ext.startswith(
"z"))
329static std::optional<RISCVExtensionVersion>
347 return I != ExtInfo.
end() &&
I->Name == Ext;
356 if (
I != ExtInfo.end() &&
I->Name == Ext)
364 unsigned MinorVersion) {
368 std::equal_range(ExtInfo.begin(), ExtInfo.end(), Ext, LessExtName());
369 for (
auto I = Range.first,
E = Range.second;
I !=
E; ++
I)
370 if (
I->Version.Major == MajorVersion &&
I->Version.Minor == MinorVersion)
383 return Exts.count(Ext.str()) != 0;
406 assert(Ext >=
'a' && Ext <=
'z');
426 assert(ExtName.size() >= 1);
427 switch (ExtName[0]) {
431 assert(ExtName.size() >= 2);
438 assert(ExtName.size() == 1);
446 const std::string &RHS) {
451 if (LHSRank != RHSRank)
452 return LHSRank < RHSRank;
459 std::vector<StringRef> &Features,
461 bool AddAllExtensions)
const {
462 for (
auto const &Ext : Exts) {
469 Features.push_back(StrAlloc(
"+experimental-" + ExtName));
471 Features.push_back(StrAlloc(
"+" + ExtName));
474 if (AddAllExtensions) {
476 if (Exts.count(Ext.Name))
478 Features.push_back(StrAlloc(
Twine(
"-") + Ext.Name));
482 if (Exts.count(Ext.Name))
484 Features.push_back(StrAlloc(
Twine(
"-experimental-") + Ext.Name));
495 unsigned &Minor,
unsigned &ConsumeLength,
496 bool EnableExperimentalExtension,
497 bool ExperimentalExtensionVersionCheck) {
502 MajorStr = In.take_while(
isDigit);
503 In = In.substr(MajorStr.
size());
505 if (!MajorStr.
empty() && In.consume_front(
"p")) {
506 MinorStr = In.take_while(
isDigit);
507 In = In.substr(MajorStr.
size() + MinorStr.
size() - 1);
510 if (MinorStr.
empty()) {
513 "minor version number missing after 'p' for extension '" + Ext +
"'");
520 "Failed to parse major version number for extension '" + Ext +
"'");
525 "Failed to parse minor version number for extension '" + Ext +
"'");
527 ConsumeLength = MajorStr.
size();
529 if (!MinorStr.
empty())
530 ConsumeLength += MinorStr.
size() + 1 ;
535 if (Ext.size() > 1 && In.size()) {
537 "multi-character extensions must be separated by underscores";
543 if (!EnableExperimentalExtension) {
544 std::string
Error =
"requires '-menable-experimental-extensions' for "
545 "experimental extension '" +
550 if (ExperimentalExtensionVersionCheck &&
553 "experimental extension requires explicit version number `" +
558 auto SupportedVers = *ExperimentalExtension;
559 if (ExperimentalExtensionVersionCheck &&
560 (Major != SupportedVers.Major || Minor != SupportedVers.Minor)) {
561 std::string
Error =
"unsupported version number " + MajorStr.
str();
562 if (!MinorStr.
empty())
564 Error +=
" for experimental extension '" + Ext.str() +
565 "' (this compiler supports " + utostr(SupportedVers.Major) +
566 "." + utostr(SupportedVers.Minor) +
")";
579 Major = DefaultVersion->Major;
580 Minor = DefaultVersion->Minor;
590 std::string
Error =
"unsupported version number " + std::string(MajorStr);
591 if (!MinorStr.
empty())
593 Error +=
" for extension '" + Ext.str() +
"'";
599 const std::vector<std::string> &Features) {
600 assert(XLen == 32 || XLen == 64);
601 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
603 for (
auto &Feature : Features) {
605 bool Experimental =
false;
606 assert(ExtName.
size() > 1 && (ExtName[0] ==
'+' || ExtName[0] ==
'-'));
607 bool Add = ExtName[0] ==
'+';
610 auto ExtensionInfos = Experimental
613 auto ExtensionInfoIterator =
618 if (ExtensionInfoIterator == ExtensionInfos.end() ||
619 ExtensionInfoIterator->Name != ExtName)
623 ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version.Major,
624 ExtensionInfoIterator->Version.Minor);
626 ISAInfo->Exts.erase(ExtName.
str());
636 "string must be lowercase");
646 "arch string must begin with valid base ISA");
647 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
655 Arch.
split(Split,
'_');
658 std::tie(Prefix, MinorVersionStr) = Ext.rsplit(
'p');
659 if (MinorVersionStr.
empty())
661 "extension lacks version in expected format");
662 unsigned MajorVersion, MinorVersion;
665 "failed to parse minor version number");
669 int TrailingDigits = 0;
671 while (!ExtName.
empty()) {
679 "extension lacks version in expected format");
681 StringRef MajorVersionStr = Prefix.take_back(TrailingDigits);
684 "failed to parse major version number");
685 ISAInfo->addExtension(ExtName, MajorVersion, MinorVersion);
687 ISAInfo->updateFLen();
688 ISAInfo->updateMinVLen();
689 ISAInfo->updateMaxELen();
690 return std::move(ISAInfo);
695 bool ExperimentalExtensionVersionCheck,
696 bool IgnoreUnknown) {
700 "string must be lowercase");
708 "string must begin with rv32{i,e,g} or rv64{i,e,g}");
711 unsigned XLen = HasRV64 ? 64 : 32;
712 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
717 char Baseline = Arch[4];
723 "first letter should be 'e', 'i' or 'g'");
731 "version not supported for 'g'");
736 if (Arch.
back() ==
'_')
738 "extension name missing after separator '_'");
750 OtherExts = Exts.
substr(Pos);
751 Exts = Exts.
substr(0, Pos);
754 unsigned Major, Minor, ConsumeLength;
755 if (Baseline ==
'g') {
764 ISAInfo->addExtension(Ext, Version->Major, Version->Minor);
771 StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
772 EnableExperimentalExtension, ExperimentalExtensionVersionCheck)) {
779 Major = Version->Major;
780 Minor = Version->Minor;
783 ISAInfo->addExtension(
StringRef(&Baseline, 1), Major, Minor);
791 auto StdExtsItr = StdExts.
begin();
792 auto StdExtsEnd = StdExts.
end();
795 I += 1 + ConsumeLength;
796 if (
I !=
E && *
I ==
'_')
803 while (StdExtsItr != StdExtsEnd && *StdExtsItr !=
C)
806 if (StdExtsItr == StdExtsEnd) {
812 "standard user-level extension not given in canonical order '%c'",
817 "invalid standard user-level extension '%c'",
C);
824 unsigned Major, Minor, ConsumeLength;
825 if (std::next(
I) !=
E)
828 ConsumeLength, EnableExperimentalExtension,
829 ExperimentalExtensionVersionCheck)) {
832 GoToNextExt(
I, ConsumeLength, Exts.
end());
842 GoToNextExt(
I, ConsumeLength, Exts.
end());
846 "unsupported standard user-level extension '%c'",
849 ISAInfo->addExtension(
StringRef(&
C, 1), Major, Minor);
853 GoToNextExt(
I, ConsumeLength, Exts.
end());
869 OtherExts.
split(Split,
'_');
872 if (Split.size() > 1 || Split[0] !=
"") {
876 "extension name missing after separator '_'");
888 "invalid extension prefix '" + Ext +
"'");
891 if (!IgnoreUnknown &&
Name.size() ==
Type.size()) {
893 "%s name missing after '%s'",
894 Desc.str().c_str(),
Type.str().c_str());
897 unsigned Major, Minor, ConsumeLength;
899 EnableExperimentalExtension,
900 ExperimentalExtensionVersionCheck)) {
911 Desc.str().c_str(),
Name.str().c_str());
917 ISAInfo->addExtension(
Name, Major, Minor);
924 for (
auto Ext : AllExts) {
928 Desc.str().c_str(), Ext.str().c_str());
935Error RISCVISAInfo::checkDependency() {
936 bool HasC = Exts.count(
"c") != 0;
937 bool HasF = Exts.count(
"f") != 0;
938 bool HasZfinx = Exts.count(
"zfinx") != 0;
939 bool HasVector = Exts.count(
"zve32x") != 0;
940 bool HasZvl = MinVLen != 0;
941 bool HasZcmt = Exts.count(
"zcmt") != 0;
943 if (HasF && HasZfinx)
945 "'f' and 'zfinx' extensions are incompatible");
947 if (HasZvl && !HasVector)
950 "'zvl*b' requires 'v' or 'zve*' extension to also be specified");
952 if (Exts.count(
"zvbb") && !HasVector)
955 "'zvbb' requires 'v' or 'zve*' extension to also be specified");
957 if (Exts.count(
"zvbc") && !Exts.count(
"zve64x"))
960 "'zvbc' requires 'v' or 'zve64*' extension to also be specified");
962 if ((Exts.count(
"zvkg") || Exts.count(
"zvkned") || Exts.count(
"zvknha") ||
963 Exts.count(
"zvksed") || Exts.count(
"zvksh")) &&
967 "'zvk*' requires 'v' or 'zve*' extension to also be specified");
969 if (Exts.count(
"zvknhb") && !Exts.count(
"zve64x"))
972 "'zvknhb' requires 'v' or 'zve64*' extension to also be specified");
974 if ((HasZcmt || Exts.count(
"zcmp")) && Exts.count(
"d") &&
975 (HasC || Exts.count(
"zcd")))
978 Twine(
"'") + (HasZcmt ?
"zcmt" :
"zcmp") +
979 "' extension is incompatible with '" + (HasC ?
"c" :
"zcd") +
980 "' extension when 'd' extension is enabled");
982 if (XLen != 32 && Exts.count(
"zcf"))
984 "'zcf' is only supported for 'rv32'");
1013 "zkne",
"zknd",
"zknh"};
1112void RISCVISAInfo::updateImplication() {
1113 bool HasE = Exts.count(
"e") != 0;
1114 bool HasI = Exts.count(
"i") != 0;
1118 if (!HasE && !HasI) {
1128 for (
auto const &Ext : Exts)
1131 while (!WorkList.
empty()) {
1135 for (
const char *ImpliedExt :
I->Exts) {
1136 if (WorkList.
count(ImpliedExt))
1138 if (Exts.count(ImpliedExt))
1142 WorkList.
insert(ImpliedExt);
1148 if (XLen == 32 && Exts.count(
"zce") && Exts.count(
"f") &&
1149 !Exts.count(
"zcf")) {
1172void RISCVISAInfo::updateCombination() {
1173 bool IsNewCombine =
false;
1175 IsNewCombine =
false;
1177 auto CombineExt = CombineIntoExt.CombineExt;
1178 auto RequiredExts = CombineIntoExt.RequiredExts;
1181 bool IsAllRequiredFeatureExist =
true;
1182 for (
const char *Ext : RequiredExts)
1184 if (IsAllRequiredFeatureExist) {
1187 IsNewCombine =
true;
1190 }
while (IsNewCombine);
1193void RISCVISAInfo::updateFLen() {
1196 if (Exts.count(
"d"))
1198 else if (Exts.count(
"f"))
1202void RISCVISAInfo::updateMinVLen() {
1203 for (
auto const &Ext : Exts) {
1209 MinVLen = std::max(MinVLen, ZvlLen);
1214void RISCVISAInfo::updateMaxELen() {
1216 for (
auto const &Ext : Exts) {
1220 if (ExtName.
back() ==
'f')
1221 MaxELenFp = std::max(MaxELenFp, 32u);
1222 if (ExtName.
back() ==
'd')
1223 MaxELenFp = std::max(MaxELenFp, 64u);
1227 MaxELen = std::max(MaxELen, ZveELen);
1236 Arch <<
"rv" << XLen;
1238 ListSeparator LS(
"_");
1239 for (
auto const &Ext : Exts) {
1241 auto ExtInfo = Ext.second;
1242 Arch << LS << ExtName;
1243 Arch << ExtInfo.MajorVersion <<
"p" << ExtInfo.MinorVersion;
1250 std::vector<std::string> FeatureVector;
1251 for (
auto const &Ext : Exts) {
1252 std::string ExtName = Ext.first;
1258 ?
"+experimental-" + ExtName
1260 FeatureVector.push_back(Feature);
1262 return FeatureVector;
1267 ISAInfo->updateImplication();
1268 ISAInfo->updateCombination();
1269 ISAInfo->updateFLen();
1270 ISAInfo->updateMinVLen();
1271 ISAInfo->updateMaxELen();
1273 if (
Error Result = ISAInfo->checkDependency())
1274 return std::move(Result);
1275 return std::move(ISAInfo);
1285 }
else if (XLen == 64) {
1305 unsigned Major, Minor, ConsumeLength;
1317 return std::string();
1323 return std::string();
1326 return std::string();
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
std::optional< std::vector< StOtherPiece > > Other
static void verifyTables()
static const char * ImpliedExtsZcd[]
static const char * ImpliedExtsZvl8192b[]
static const char * ImpliedExtsZks[]
static const char * ImpliedExtsZcb[]
static const char * ImpliedExtsZvksg[]
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 size_t findLastNonVersionCharacter(StringRef Ext)
static const char * ImpliedExtsZicntr[]
static const char * ImpliedExtsZvl1024b[]
static const char * ImpliedExtsZhinx[]
static constexpr CombinedExtsEntry CombineIntoExts[]
static const char * ImpliedExtsZcmt[]
static const char * ImpliedExtsZvkng[]
static const char * ImpliedExtsZvks[]
static const char * ImpliedExtsZve64x[]
static const char * ImpliedExtsZk[]
static const char * ImpliedExtsZce[]
static const RISCVSupportedExtension SupportedExperimentalExtensions[]
static const char * ImpliedExtsZvfbfwma[]
static const char * ImpliedExtsZvl256b[]
static StringRef getExtensionType(StringRef Ext)
static const char * ImpliedExtsZfhmin[]
static std::optional< RISCVExtensionVersion > isExperimentalExtension(StringRef Ext)
static const char * ImpliedExtsZcf[]
static const char * ImpliedExtsZvknc[]
static const char * ImpliedExtsZacas[]
static const char * ImpliedExtsZcmp[]
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 * ImpliedExtsZihpm[]
static const char * ImpliedExtsZvl16384b[]
static const char * ImpliedExtsZvl128b[]
static const char * ImpliedExtsZvfbfmin[]
static constexpr StringLiteral AllStdExts
static const char * ImpliedExtsZfbfmin[]
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 const char * ImpliedExtsZvksc[]
static void PrintExtension(const std::string Name, const std::string Version, const std::string Description)
static const char * ImpliedExtsXsfvcp[]
static const char * ImpliedExtsZvbb[]
static unsigned getExtensionRank(const std::string &ExtName)
static const char * ImpliedExtsZdinx[]
static unsigned singleLetterExtensionRank(char Ext)
static const char * ImpliedExtsZhinxmin[]
static const char * RISCVGImplications[]
static const char * ImpliedExtsV[]
static const char * ImpliedExtsZve64d[]
static const char * ImpliedExtsZvfhmin[]
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 std::string getTargetFeatureForExtension(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
std::map< std::string, RISCVExtensionInfo, ExtensionComparator > OrderedExtensionMap
OrderedExtensionMap is std::map, it's specialized to keep entries in canonical order of extension.
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.
static bool isSupportedExtensionWithVersion(StringRef Ext)
size_type count(const key_type &key) const
Count the number of elements of a given key in the SetVector.
bool empty() const
Determine if the SetVector is empty or not.
bool insert(const value_type &X)
Insert a new element into the SetVector.
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...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
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.
bool operator<(int64_t V1, const APSInt &V2)
raw_fd_ostream & outs()
This returns a reference to a raw_fd_ostream for standard output.
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...
void riscvExtensionsHelp(StringMap< StringRef > DescMap)
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound 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
Description of the encoding of one expression Op.