29struct RISCVSupportedExtension {
34 bool operator<(
const RISCVSupportedExtension &RHS)
const {
49 "i",
"m",
"a",
"f",
"d",
"zicsr",
"zifencei"
63 {
"shcounterenw", {1, 0}},
67 {
"shvstvala", {1, 0}},
68 {
"shvstvecd", {1, 0}},
74 {
"sscounterenw", {1, 0}},
75 {
"ssstateen", {1, 0}},
93 {
"xcvbitmanip", {1, 0}},
100 {
"xsfvfnrclipxfqf", {1, 0}},
101 {
"xsfvfwmaccqqq", {1, 0}},
102 {
"xsfvqmaccdod", {1, 0}},
103 {
"xsfvqmaccqoq", {1, 0}},
104 {
"xsifivecdiscarddlone", {1, 0}},
105 {
"xsifivecflushdlone", {1, 0}},
106 {
"xtheadba", {1, 0}},
107 {
"xtheadbb", {1, 0}},
108 {
"xtheadbs", {1, 0}},
109 {
"xtheadcmo", {1, 0}},
110 {
"xtheadcondmov", {1, 0}},
111 {
"xtheadfmemidx", {1, 0}},
112 {
"xtheadmac", {1, 0}},
113 {
"xtheadmemidx", {1, 0}},
114 {
"xtheadmempair", {1, 0}},
115 {
"xtheadsync", {1, 0}},
116 {
"xtheadvdot", {1, 0}},
117 {
"xventanacondops", {1, 0}},
150 {
"zhinxmin", {1, 0}},
156 {
"ziccamoa", {1, 0}},
163 {
"zifencei", {2, 0}},
164 {
"zihintntl", {1, 0}},
165 {
"zihintpause", {2, 0}},
210 {
"zvl1024b", {1, 0}},
212 {
"zvl16384b", {1, 0}},
213 {
"zvl2048b", {1, 0}},
215 {
"zvl32768b", {1, 0}},
217 {
"zvl4096b", {1, 0}},
220 {
"zvl65536b", {1, 0}},
221 {
"zvl8192b", {1, 0}},
246 {
"zvfbfmin", {1, 0}},
247 {
"zvfbfwma", {1, 0}},
252 {
"rvi20u32",
"rv32i"},
253 {
"rvi20u64",
"rv64i"},
254 {
"rva20u64",
"rv64imafdc_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_za128rs"},
255 {
"rva20s64",
"rv64imafdc_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_zifencei_"
256 "za128rs_ssccptr_sstvala_sstvecd_svade_svbare"},
258 "rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
259 "zicntr_zihintpause_zihpm_za64rs_zfhmin_zba_zbb_zbs_zkt"},
261 "rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
262 "zicntr_zifencei_zihintpause_zihpm_za64rs_zfhmin_zba_zbb_zbs_zkt_ssccptr_"
263 "sscounterenw_sstvala_sstvecd_svade_svbare_svinval_svpbmt"},
265 "rv64imafdcv_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
266 "zicntr_zicond_zihintntl_zihintpause_zihpm_zimop_za64rs_zawrs_zfa_zfhmin_"
267 "zcb_zcmop_zba_zbb_zbs_zkt_zvbb_zvfhmin_zvkt"},
269 "rv64imafdcvh_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
270 "zicntr_zicond_zifencei_zihintntl_zihintpause_zihpm_zimop_za64rs_zawrs_"
271 "zfa_zfhmin_zcb_zcmop_zba_zbb_zbs_zkt_zvbb_zvfhmin_zvkt_shcounterenw_"
272 "shgatpa_shtvala_shvsatpa_shvstvala_shvstvecd_ssccptr_sscofpmf_"
273 "sscounterenw_ssnpm0p8_ssstateen_sstc_sstvala_sstvecd_ssu64xl_svade_"
274 "svbare_svinval_svnapot_svpbmt"},
275 {
"rvb23u64",
"rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_"
276 "zicclsm_ziccrse_zicntr_zicond_zihintntl_zihintpause_zihpm_"
277 "zimop_za64rs_zawrs_zfa_zcb_zcmop_zba_zbb_zbs_zkt"},
279 "rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
280 "zicntr_zicond_zifencei_zihintntl_zihintpause_zihpm_zimop_za64rs_zawrs_"
281 "zfa_zcb_zcmop_zba_zbb_zbs_zkt_ssccptr_sscofpmf_sscounterenw_sstc_sstvala_"
282 "sstvecd_ssu64xl_svade_svbare_svinval_svnapot_svpbmt"},
283 {
"rvm23u32",
"rv32im_zicbop_zicond_zicsr_zihintntl_zihintpause_zimop_zca_"
284 "zcb_zce_zcmop_zcmp_zcmt_zba_zbb_zbs"},
289 static std::atomic<bool> TableChecked(
false);
290 if (!TableChecked.load(std::memory_order_relaxed)) {
292 "Extensions are not sorted by name");
294 "Experimental extensions are not sorted by name");
295 TableChecked.store(
true, std::memory_order_relaxed);
303 unsigned VersionWidth = Description.
empty() ? 0 : 10;
305 << Description <<
"\n";
310 outs() <<
"All available -march extensions for RISC-V\n\n";
315 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
316 for (
const auto &E : ExtMap) {
317 std::string Version =
318 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
322 outs() <<
"\nExperimental extensions\n";
325 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
326 for (
const auto &E : ExtMap) {
327 std::string Version =
328 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
329 PrintExtension(E.first, Version, DescMap[
"experimental-" + E.first]);
332 outs() <<
"\nUse -march to specify the target's extension.\n"
333 "For example, clang -march=rv32i_v1p0\n";
337 return Ext.consume_front(
"experimental-");
349 "Already guarded by if-statement in ::parseArchString");
351 int Pos = Ext.size() - 1;
352 while (Pos > 0 &&
isDigit(Ext[Pos]))
354 if (Pos > 0 && Ext[Pos] ==
'p' &&
isDigit(Ext[Pos - 1])) {
356 while (Pos > 0 &&
isDigit(Ext[Pos]))
364 bool operator()(
const RISCVSupportedExtension &LHS,
StringRef RHS) {
367 bool operator()(
StringRef LHS,
const RISCVSupportedExtension &RHS) {
373static std::optional<RISCVISAInfo::ExtensionVersion>
381 if (
I == ExtInfo.end() ||
I->Name != ExtName)
389void RISCVISAInfo::addExtension(
StringRef ExtName,
395 if (Ext.starts_with(
"s"))
396 return "standard supervisor-level extension";
397 if (Ext.starts_with(
"x"))
398 return "non-standard user-level extension";
399 if (Ext.starts_with(
"z"))
400 return "standard user-level extension";
405 if (Ext.starts_with(
"s"))
407 if (Ext.starts_with(
"x"))
409 if (Ext.starts_with(
"z"))
414static std::optional<RISCVISAInfo::ExtensionVersion>
432 return I != ExtInfo.
end() &&
I->Name == Ext;
441 if (
I != ExtInfo.end() &&
I->Name == Ext)
449 unsigned MinorVersion) {
453 std::equal_range(ExtInfo.begin(), ExtInfo.end(), Ext, LessExtName());
454 for (
auto I = Range.first, E = Range.second;
I != E; ++
I)
455 if (
I->Version.Major == MajorVersion &&
I->Version.Minor == MinorVersion)
468 return Exts.count(Ext.str()) != 0;
491 assert(Ext >=
'a' && Ext <=
'z');
511 assert(ExtName.size() >= 1);
512 switch (ExtName[0]) {
516 assert(ExtName.size() >= 2);
523 assert(ExtName.size() == 1);
531 const std::string &RHS) {
536 if (LHSRank != RHSRank)
537 return LHSRank < RHSRank;
544 bool IgnoreUnknown)
const {
545 std::vector<std::string> Features;
546 for (
const auto &[ExtName,
_] : Exts) {
556 Features.push_back((
llvm::Twine(
"+experimental-") + ExtName).str());
558 Features.push_back((
llvm::Twine(
"+") + ExtName).str());
561 if (AddAllExtensions) {
563 if (Exts.count(Ext.Name))
565 Features.push_back((
llvm::Twine(
"-") + Ext.Name).str());
569 if (Exts.count(Ext.Name))
571 Features.push_back((
llvm::Twine(
"-experimental-") + Ext.Name).str());
578 if (ExtName.size() == 1) {
580 "unsupported standard user-level extension '" +
585 " '" + ExtName +
"'");
594 unsigned &Minor,
unsigned &ConsumeLength,
595 bool EnableExperimentalExtension,
596 bool ExperimentalExtensionVersionCheck) {
601 MajorStr = In.take_while(
isDigit);
602 In = In.substr(MajorStr.
size());
604 if (!MajorStr.
empty() && In.consume_front(
"p")) {
605 MinorStr = In.take_while(
isDigit);
606 In = In.substr(MajorStr.
size() + MinorStr.
size() - 1);
609 if (MinorStr.
empty()) {
612 "minor version number missing after 'p' for extension '" + Ext +
"'");
619 "Failed to parse major version number for extension '" + Ext +
"'");
624 "Failed to parse minor version number for extension '" + Ext +
"'");
626 ConsumeLength = MajorStr.
size();
628 if (!MinorStr.
empty())
629 ConsumeLength += MinorStr.
size() + 1 ;
634 if (Ext.size() > 1 && In.size())
637 "multi-character extensions must be separated by underscores");
641 if (!EnableExperimentalExtension)
643 "requires '-menable-experimental-extensions' "
644 "for experimental extension '" +
647 if (ExperimentalExtensionVersionCheck &&
651 "experimental extension requires explicit version number `" + Ext +
654 auto SupportedVers = *ExperimentalExtension;
655 if (ExperimentalExtensionVersionCheck &&
656 (Major != SupportedVers.Major || Minor != SupportedVers.Minor)) {
657 std::string
Error =
"unsupported version number " + MajorStr.
str();
658 if (!MinorStr.
empty())
660 Error +=
" for experimental extension '" + Ext.str() +
661 "' (this compiler supports " + utostr(SupportedVers.Major) +
662 "." + utostr(SupportedVers.Minor) +
")";
675 Major = DefaultVersion->Major;
676 Minor = DefaultVersion->Minor;
689 std::string
Error =
"unsupported version number " + std::string(MajorStr);
690 if (!MinorStr.
empty())
692 Error +=
" for extension '" + Ext.str() +
"'";
698 const std::vector<std::string> &Features) {
699 assert(XLen == 32 || XLen == 64);
700 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
702 for (
auto &Feature : Features) {
704 bool Experimental =
false;
705 assert(ExtName.
size() > 1 && (ExtName[0] ==
'+' || ExtName[0] ==
'-'));
706 bool Add = ExtName[0] ==
'+';
709 auto ExtensionInfos = Experimental
712 auto ExtensionInfoIterator =
717 if (ExtensionInfoIterator == ExtensionInfos.end() ||
718 ExtensionInfoIterator->Name != ExtName)
722 ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version);
724 ISAInfo->Exts.erase(ExtName.
str());
734 "string must be lowercase");
744 "arch string must begin with valid base ISA");
745 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
753 Arch.
split(Split,
'_');
756 std::tie(Prefix, MinorVersionStr) = Ext.rsplit(
'p');
757 if (MinorVersionStr.
empty())
759 "extension lacks version in expected format");
760 unsigned MajorVersion, MinorVersion;
763 "failed to parse minor version number");
767 int TrailingDigits = 0;
769 while (!ExtName.
empty()) {
777 "extension lacks version in expected format");
779 StringRef MajorVersionStr = Prefix.take_back(TrailingDigits);
782 "failed to parse major version number");
783 ISAInfo->addExtension(ExtName, {MajorVersion, MinorVersion});
785 ISAInfo->updateFLen();
786 ISAInfo->updateMinVLen();
787 ISAInfo->updateMaxELen();
788 return std::move(ISAInfo);
792 std::vector<std::string> &SplitExts) {
797 Exts.
split(Split,
"_");
799 for (
auto Ext : Split) {
802 "extension name missing after separator '_'");
804 SplitExts.push_back(Ext.str());
812 std::map<std::string, unsigned>> &SeenExtMap,
813 bool IgnoreUnknown,
bool EnableExperimentalExtension,
814 bool ExperimentalExtensionVersionCheck) {
825 "invalid extension prefix '" + RawExt +
"'");
828 if (!IgnoreUnknown &&
Name.size() ==
Type.size())
830 Desc +
" name missing after '" +
Type +
"'");
832 unsigned Major, Minor, ConsumeLength;
834 EnableExperimentalExtension,
835 ExperimentalExtensionVersionCheck)) {
844 if (!IgnoreUnknown && SeenExtMap.contains(
Name.str()))
846 "duplicated " +
Desc +
" '" +
Name +
"'");
851 SeenExtMap[
Name.str()] = {Major, Minor};
858 std::map<std::string, unsigned>> &SeenExtMap,
859 bool IgnoreUnknown,
bool EnableExperimentalExtension,
860 bool ExperimentalExtensionVersionCheck) {
861 unsigned Major, Minor, ConsumeLength;
865 EnableExperimentalExtension,
866 ExperimentalExtensionVersionCheck)) {
869 RawExt = RawExt.
substr(ConsumeLength);
875 RawExt = RawExt.
substr(ConsumeLength);
878 if (!IgnoreUnknown && SeenExtMap.contains(
Name.str()))
880 "duplicated standard user-level extension '" +
886 SeenExtMap[
Name.str()] = {Major, Minor};
892 bool ExperimentalExtensionVersionCheck,
893 bool IgnoreUnknown) {
897 "string must be lowercase");
902 const auto *FoundProfile =
910 std::string NewArch = FoundProfile->MArch.str();
912 if (!ArchWithoutProfile.
empty()) {
916 "additional extensions must be after separator '_'");
917 NewArch += ArchWithoutProfile.
str();
920 ExperimentalExtensionVersionCheck, IgnoreUnknown);
928 "string must begin with rv32{i,e,g} or rv64{i,e,g}");
931 unsigned XLen = HasRV64 ? 64 : 32;
932 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
934 std::map<std::string, unsigned>>
939 char Baseline = Arch[4];
945 "first letter should be 'e', 'i' or 'g'");
953 "version not supported for 'g'");
957 if (Arch.
back() ==
'_')
959 "extension name missing after separator '_'");
964 unsigned Major, Minor, ConsumeLength;
965 if (Baseline ==
'g') {
975 SeenExtMap[Ext] = {Version->Major, Version->Minor};
982 StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
983 EnableExperimentalExtension, ExperimentalExtensionVersionCheck)) {
990 Major = Version->Major;
991 Minor = Version->Minor;
995 SeenExtMap[
StringRef(&Baseline, 1).
str()] = {Major, Minor};
1003 std::vector<std::string> SplitExts;
1005 return std::move(E);
1007 for (
auto &Ext : SplitExts) {
1009 while (!CurrExt.
empty()) {
1012 CurrExt, SeenExtMap, IgnoreUnknown, EnableExperimentalExtension,
1013 ExperimentalExtensionVersionCheck))
1014 return std::move(E);
1015 }
else if (CurrExt.
front() ==
'z' || CurrExt.
front() ==
's' ||
1016 CurrExt.
front() ==
'x') {
1026 CurrExt, SeenExtMap, IgnoreUnknown, EnableExperimentalExtension,
1027 ExperimentalExtensionVersionCheck))
1028 return std::move(E);
1035 "invalid standard user-level extension '" +
1042 for (
auto &SeenExtAndVers : SeenExtMap) {
1043 const std::string &ExtName = SeenExtAndVers.first;
1048 ISAInfo->addExtension(ExtName, ExtVers);
1054Error RISCVISAInfo::checkDependency() {
1055 bool HasC = Exts.count(
"c") != 0;
1056 bool HasF = Exts.count(
"f") != 0;
1057 bool HasZfinx = Exts.count(
"zfinx") != 0;
1058 bool HasVector = Exts.count(
"zve32x") != 0;
1059 bool HasZvl = MinVLen != 0;
1060 bool HasZcmt = Exts.count(
"zcmt") != 0;
1062 if (HasF && HasZfinx)
1064 "'f' and 'zfinx' extensions are incompatible");
1066 if (HasZvl && !HasVector)
1069 "'zvl*b' requires 'v' or 'zve*' extension to also be specified");
1071 if (Exts.count(
"zvbb") && !HasVector)
1074 "'zvbb' requires 'v' or 'zve*' extension to also be specified");
1076 if (Exts.count(
"zvbc") && !Exts.count(
"zve64x"))
1079 "'zvbc' requires 'v' or 'zve64*' extension to also be specified");
1081 if ((Exts.count(
"zvkb") || Exts.count(
"zvkg") || Exts.count(
"zvkned") ||
1082 Exts.count(
"zvknha") || Exts.count(
"zvksed") || Exts.count(
"zvksh")) &&
1086 "'zvk*' requires 'v' or 'zve*' extension to also be specified");
1088 if (Exts.count(
"zvknhb") && !Exts.count(
"zve64x"))
1091 "'zvknhb' requires 'v' or 'zve64*' extension to also be specified");
1093 if ((HasZcmt || Exts.count(
"zcmp")) && Exts.count(
"d") &&
1094 (HasC || Exts.count(
"zcd")))
1097 Twine(
"'") + (HasZcmt ?
"zcmt" :
"zcmp") +
1098 "' extension is incompatible with '" + (HasC ?
"c" :
"zcd") +
1099 "' extension when 'd' extension is enabled");
1101 if (XLen != 32 && Exts.count(
"zcf"))
1103 "'zcf' is only supported for 'rv32'");
1139 "zkne",
"zknd",
"zknh"};
1245void RISCVISAInfo::updateImplication() {
1246 bool HasE = Exts.count(
"e") != 0;
1247 bool HasI = Exts.count(
"i") != 0;
1251 if (!HasE && !HasI) {
1253 addExtension(
"i",
Version.value());
1261 for (
auto const &Ext : Exts)
1264 while (!WorkList.
empty()) {
1268 for (
const char *ImpliedExt :
I->Exts) {
1269 if (WorkList.
count(ImpliedExt))
1271 if (Exts.count(ImpliedExt))
1274 addExtension(ImpliedExt,
Version.value());
1275 WorkList.
insert(ImpliedExt);
1281 if (XLen == 32 && Exts.count(
"zce") && Exts.count(
"f") &&
1282 !Exts.count(
"zcf")) {
1284 addExtension(
"zcf",
Version.value());
1305void RISCVISAInfo::updateCombination() {
1306 bool IsNewCombine =
false;
1308 IsNewCombine =
false;
1310 auto CombineExt = CombineIntoExt.CombineExt;
1311 auto RequiredExts = CombineIntoExt.RequiredExts;
1314 bool IsAllRequiredFeatureExist =
true;
1315 for (
const char *Ext : RequiredExts)
1317 if (IsAllRequiredFeatureExist) {
1319 addExtension(CombineExt,
Version.value());
1320 IsNewCombine =
true;
1323 }
while (IsNewCombine);
1326void RISCVISAInfo::updateFLen() {
1329 if (Exts.count(
"d"))
1331 else if (Exts.count(
"f"))
1335void RISCVISAInfo::updateMinVLen() {
1336 for (
auto const &Ext : Exts) {
1342 MinVLen = std::max(MinVLen, ZvlLen);
1347void RISCVISAInfo::updateMaxELen() {
1349 for (
auto const &Ext : Exts) {
1353 if (ExtName.
back() ==
'f')
1354 MaxELenFp = std::max(MaxELenFp, 32u);
1355 if (ExtName.
back() ==
'd')
1356 MaxELenFp = std::max(MaxELenFp, 64u);
1360 MaxELen = std::max(MaxELen, ZveELen);
1369 Arch <<
"rv" << XLen;
1371 ListSeparator LS(
"_");
1372 for (
auto const &Ext : Exts) {
1374 auto ExtInfo = Ext.second;
1375 Arch << LS << ExtName;
1376 Arch << ExtInfo.Major <<
"p" << ExtInfo.Minor;
1384 ISAInfo->updateImplication();
1385 ISAInfo->updateCombination();
1386 ISAInfo->updateFLen();
1387 ISAInfo->updateMinVLen();
1388 ISAInfo->updateMaxELen();
1390 if (
Error Result = ISAInfo->checkDependency())
1391 return std::move(Result);
1392 return std::move(ISAInfo);
1404 }
else if (XLen == 64) {
1426 unsigned Major, Minor, ConsumeLength;
1438 return std::string();
1444 return std::string();
1447 return std::string();
std::optional< std::vector< StOtherPiece > > Other
This file implements a map that provides insertion order iteration.
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 * ImpliedExtsXSfvqmaccqoq[]
static const char * ImpliedExtsZvfh[]
static const char * ImpliedExtsZvl65536b[]
static const char * ImpliedExtsZvkn[]
static const char * ImpliedExtsZve64f[]
static const char * ImpliedExtsXSfvfnrclipxfqf[]
static size_t findLastNonVersionCharacter(StringRef Ext)
static const char * ImpliedExtsZicntr[]
static constexpr RISCVProfile SupportedProfiles[]
static Error processMultiLetterExtension(StringRef RawExt, MapVector< std::string, RISCVISAInfo::ExtensionVersion, std::map< std::string, unsigned > > &SeenExtMap, bool IgnoreUnknown, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck)
static const char * ImpliedExtsZvl1024b[]
static const char * ImpliedExtsZhinx[]
static constexpr CombinedExtsEntry CombineIntoExts[]
static std::optional< RISCVISAInfo::ExtensionVersion > findDefaultVersion(StringRef ExtName)
static const char * ImpliedExtsZcmt[]
static const char * ImpliedExtsZvkng[]
static const char * ImpliedExtsZvks[]
static const char * ImpliedExtsZve64x[]
static const char * ImpliedExtsZk[]
static const char * ImpliedExtsXSfvfwmaccqqq[]
static const char * ImpliedExtsZce[]
static const RISCVSupportedExtension SupportedExperimentalExtensions[]
static const char * ImpliedExtsXSfvcp[]
static const char * ImpliedExtsZvfbfwma[]
static const char * ImpliedExtsZvl256b[]
static StringRef getExtensionType(StringRef Ext)
static const char * ImpliedExtsZfhmin[]
static const char * ImpliedExtsZcf[]
static const char * ImpliedExtsZvknc[]
static const char * ImpliedExtsZacas[]
static const char * ImpliedExtsZicfiss[]
static const char * ImpliedExtsZcmp[]
static const char * ImpliedExtsD[]
static const char * ImpliedExtsZkn[]
static const char * ImpliedExtsXSfvqmaccdod[]
static bool stripExperimentalPrefix(StringRef &Ext)
static std::optional< RISCVISAInfo::ExtensionVersion > isExperimentalExtension(StringRef Ext)
static const char * ImpliedExtsZvl64b[]
static void PrintExtension(StringRef Name, StringRef Version, StringRef Description)
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 * ImpliedExtsZabha[]
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 const char * ImpliedExtsZcmop[]
static Error processSingleLetterExtension(StringRef &RawExt, MapVector< std::string, RISCVISAInfo::ExtensionVersion, std::map< std::string, unsigned > > &SeenExtMap, bool IgnoreUnknown, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck)
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 Error getStringErrorForInvalidExt(std::string_view ExtName)
static const char * ImpliedExtsZve64d[]
static Error splitExtsByUnderscore(StringRef Exts, std::vector< std::string > &SplitExts)
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.
This class implements a map that also provides access to all stored values in a deterministic order.
std::map< std::string, ExtensionVersion, ExtensionComparator > OrderedExtensionMap
OrderedExtensionMap is std::map, it's specialized to keep entries in canonical order of extension.
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
static llvm::Expected< std::unique_ptr< RISCVISAInfo > > postProcessAndChecking(std::unique_ptr< RISCVISAInfo > &&ISAInfo)
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.
std::vector< std::string > toFeatures(bool AddAllExtensions=false, bool IgnoreUnknown=true) 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.
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).
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
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.
char front() const
front - Get the first character in the string.
bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
StringRef take_front(size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
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.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
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.
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)
FormattedString left_justify(StringRef Str, unsigned Width)
left_justify - append spaces after string so total output is Width characters.
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.
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.
Represents the major and version number components of a RISC-V extension.