29struct RISCVSupportedExtension {
34 bool operator<(
const RISCVSupportedExtension &RHS)
const {
47 "i",
"m",
"a",
"f",
"d",
"zicsr",
"zifencei"
61 {
"shcounterenw", {1, 0}},
65 {
"shvstvala", {1, 0}},
66 {
"shvstvecd", {1, 0}},
72 {
"sscounterenw", {1, 0}},
73 {
"ssstateen", {1, 0}},
91 {
"xcvbitmanip", {1, 0}},
98 {
"xsfvfnrclipxfqf", {1, 0}},
99 {
"xsfvfwmaccqqq", {1, 0}},
100 {
"xsfvqmaccdod", {1, 0}},
101 {
"xsfvqmaccqoq", {1, 0}},
102 {
"xsifivecdiscarddlone", {1, 0}},
103 {
"xsifivecflushdlone", {1, 0}},
104 {
"xtheadba", {1, 0}},
105 {
"xtheadbb", {1, 0}},
106 {
"xtheadbs", {1, 0}},
107 {
"xtheadcmo", {1, 0}},
108 {
"xtheadcondmov", {1, 0}},
109 {
"xtheadfmemidx", {1, 0}},
110 {
"xtheadmac", {1, 0}},
111 {
"xtheadmemidx", {1, 0}},
112 {
"xtheadmempair", {1, 0}},
113 {
"xtheadsync", {1, 0}},
114 {
"xtheadvdot", {1, 0}},
115 {
"xventanacondops", {1, 0}},
148 {
"zhinxmin", {1, 0}},
154 {
"ziccamoa", {1, 0}},
161 {
"zifencei", {2, 0}},
162 {
"zihintntl", {1, 0}},
163 {
"zihintpause", {2, 0}},
208 {
"zvl1024b", {1, 0}},
210 {
"zvl16384b", {1, 0}},
211 {
"zvl2048b", {1, 0}},
213 {
"zvl32768b", {1, 0}},
215 {
"zvl4096b", {1, 0}},
218 {
"zvl65536b", {1, 0}},
219 {
"zvl8192b", {1, 0}},
244 {
"zvfbfmin", {1, 0}},
245 {
"zvfbfwma", {1, 0}},
250 {
"rvi20u32",
"rv32i"},
251 {
"rvi20u64",
"rv64i"},
252 {
"rva20u64",
"rv64imafdc_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_za128rs"},
253 {
"rva20s64",
"rv64imafdc_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_zifencei_"
254 "za128rs_ssccptr_sstvala_sstvecd_svade_svbare"},
256 "rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
257 "zicntr_zihintpause_zihpm_za64rs_zfhmin_zba_zbb_zbs_zkt"},
259 "rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
260 "zicntr_zifencei_zihintpause_zihpm_za64rs_zfhmin_zba_zbb_zbs_zkt_ssccptr_"
261 "sscounterenw_sstvala_sstvecd_svade_svbare_svinval_svpbmt"},
263 "rv64imafdcv_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
264 "zicntr_zicond_zihintntl_zihintpause_zihpm_zimop_za64rs_zawrs_zfa_zfhmin_"
265 "zcb_zcmop_zba_zbb_zbs_zkt_zvbb_zvfhmin_zvkt"},
267 "rv64imafdcvh_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
268 "zicntr_zicond_zifencei_zihintntl_zihintpause_zihpm_zimop_za64rs_zawrs_"
269 "zfa_zfhmin_zcb_zcmop_zba_zbb_zbs_zkt_zvbb_zvfhmin_zvkt_shcounterenw_"
270 "shgatpa_shtvala_shvsatpa_shvstvala_shvstvecd_ssccptr_sscofpmf_"
271 "sscounterenw_ssnpm0p8_ssstateen_sstc_sstvala_sstvecd_ssu64xl_svade_"
272 "svbare_svinval_svnapot_svpbmt"},
273 {
"rvb23u64",
"rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_"
274 "zicclsm_ziccrse_zicntr_zicond_zihintntl_zihintpause_zihpm_"
275 "zimop_za64rs_zawrs_zfa_zcb_zcmop_zba_zbb_zbs_zkt"},
277 "rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
278 "zicntr_zicond_zifencei_zihintntl_zihintpause_zihpm_zimop_za64rs_zawrs_"
279 "zfa_zcb_zcmop_zba_zbb_zbs_zkt_ssccptr_sscofpmf_sscounterenw_sstc_sstvala_"
280 "sstvecd_ssu64xl_svade_svbare_svinval_svnapot_svpbmt"},
281 {
"rvm23u32",
"rv32im_zicbop_zicond_zicsr_zihintntl_zihintpause_zimop_zca_"
282 "zcb_zce_zcmop_zcmp_zcmt_zba_zbb_zbs"},
287 static std::atomic<bool> TableChecked(
false);
288 if (!TableChecked.load(std::memory_order_relaxed)) {
290 "Extensions are not sorted by name");
292 "Experimental extensions are not sorted by name");
293 TableChecked.store(
true, std::memory_order_relaxed);
301 unsigned VersionWidth = Description.
empty() ? 0 : 10;
303 << Description <<
"\n";
308 outs() <<
"All available -march extensions for RISC-V\n\n";
313 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
314 for (
const auto &E : ExtMap) {
315 std::string Version =
316 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
320 outs() <<
"\nExperimental extensions\n";
323 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
324 for (
const auto &E : ExtMap) {
325 std::string Version =
326 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
327 PrintExtension(E.first, Version, DescMap[
"experimental-" + E.first]);
330 outs() <<
"\nUse -march to specify the target's extension.\n"
331 "For example, clang -march=rv32i_v1p0\n";
335 return Ext.consume_front(
"experimental-");
347 "Already guarded by if-statement in ::parseArchString");
349 int Pos = Ext.size() - 1;
350 while (Pos > 0 &&
isDigit(Ext[Pos]))
352 if (Pos > 0 && Ext[Pos] ==
'p' &&
isDigit(Ext[Pos - 1])) {
354 while (Pos > 0 &&
isDigit(Ext[Pos]))
362 bool operator()(
const RISCVSupportedExtension &LHS,
StringRef RHS) {
365 bool operator()(
StringRef LHS,
const RISCVSupportedExtension &RHS) {
371static std::optional<RISCVISAUtils::ExtensionVersion>
379 if (
I == ExtInfo.end() ||
I->Name != ExtName)
387void RISCVISAInfo::addExtension(
StringRef ExtName,
393 if (Ext.starts_with(
"s"))
394 return "standard supervisor-level extension";
395 if (Ext.starts_with(
"x"))
396 return "non-standard user-level extension";
397 if (Ext.starts_with(
"z"))
398 return "standard user-level extension";
403 if (Ext.starts_with(
"s"))
405 if (Ext.starts_with(
"x"))
407 if (Ext.starts_with(
"z"))
412static std::optional<RISCVISAUtils::ExtensionVersion>
430 return I != ExtInfo.
end() &&
I->Name == Ext;
439 if (
I != ExtInfo.end() &&
I->Name == Ext)
447 unsigned MinorVersion) {
451 std::equal_range(ExtInfo.begin(), ExtInfo.end(), Ext, LessExtName());
452 for (
auto I = Range.first, E = Range.second;
I != E; ++
I)
453 if (
I->Version.Major == MajorVersion &&
I->Version.Minor == MinorVersion)
466 return Exts.count(Ext.str()) != 0;
470 bool IgnoreUnknown)
const {
471 std::vector<std::string> Features;
472 for (
const auto &[ExtName,
_] : Exts) {
482 Features.push_back((
llvm::Twine(
"+experimental-") + ExtName).str());
484 Features.push_back((
llvm::Twine(
"+") + ExtName).str());
487 if (AddAllExtensions) {
489 if (Exts.count(Ext.Name))
491 Features.push_back((
llvm::Twine(
"-") + Ext.Name).str());
495 if (Exts.count(Ext.Name))
497 Features.push_back((
llvm::Twine(
"-experimental-") + Ext.Name).str());
504 if (ExtName.size() == 1) {
506 "unsupported standard user-level extension '" +
511 " '" + ExtName +
"'");
520 unsigned &Minor,
unsigned &ConsumeLength,
521 bool EnableExperimentalExtension,
522 bool ExperimentalExtensionVersionCheck) {
527 MajorStr = In.take_while(
isDigit);
528 In = In.substr(MajorStr.
size());
530 if (!MajorStr.
empty() && In.consume_front(
"p")) {
531 MinorStr = In.take_while(
isDigit);
532 In = In.substr(MajorStr.
size() + MinorStr.
size() - 1);
535 if (MinorStr.
empty()) {
538 "minor version number missing after 'p' for extension '" + Ext +
"'");
545 "Failed to parse major version number for extension '" + Ext +
"'");
550 "Failed to parse minor version number for extension '" + Ext +
"'");
552 ConsumeLength = MajorStr.
size();
554 if (!MinorStr.
empty())
555 ConsumeLength += MinorStr.
size() + 1 ;
560 if (Ext.size() > 1 && In.size())
563 "multi-character extensions must be separated by underscores");
567 if (!EnableExperimentalExtension)
569 "requires '-menable-experimental-extensions' "
570 "for experimental extension '" +
573 if (ExperimentalExtensionVersionCheck &&
577 "experimental extension requires explicit version number `" + Ext +
580 auto SupportedVers = *ExperimentalExtension;
581 if (ExperimentalExtensionVersionCheck &&
582 (Major != SupportedVers.Major || Minor != SupportedVers.Minor)) {
583 std::string
Error =
"unsupported version number " + MajorStr.
str();
584 if (!MinorStr.
empty())
586 Error +=
" for experimental extension '" + Ext.str() +
587 "' (this compiler supports " + utostr(SupportedVers.Major) +
588 "." + utostr(SupportedVers.Minor) +
")";
601 Major = DefaultVersion->Major;
602 Minor = DefaultVersion->Minor;
615 std::string
Error =
"unsupported version number " + std::string(MajorStr);
616 if (!MinorStr.
empty())
618 Error +=
" for extension '" + Ext.str() +
"'";
624 const std::vector<std::string> &Features) {
625 assert(XLen == 32 || XLen == 64);
626 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
628 for (
auto &Feature : Features) {
630 bool Experimental =
false;
631 assert(ExtName.
size() > 1 && (ExtName[0] ==
'+' || ExtName[0] ==
'-'));
632 bool Add = ExtName[0] ==
'+';
635 auto ExtensionInfos = Experimental
638 auto ExtensionInfoIterator =
643 if (ExtensionInfoIterator == ExtensionInfos.end() ||
644 ExtensionInfoIterator->Name != ExtName)
648 ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version);
650 ISAInfo->Exts.erase(ExtName.
str());
660 "string must be lowercase");
670 "arch string must begin with valid base ISA");
671 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
679 Arch.
split(Split,
'_');
682 std::tie(Prefix, MinorVersionStr) = Ext.rsplit(
'p');
683 if (MinorVersionStr.
empty())
685 "extension lacks version in expected format");
686 unsigned MajorVersion, MinorVersion;
689 "failed to parse minor version number");
693 int TrailingDigits = 0;
695 while (!ExtName.
empty()) {
703 "extension lacks version in expected format");
705 StringRef MajorVersionStr = Prefix.take_back(TrailingDigits);
708 "failed to parse major version number");
709 ISAInfo->addExtension(ExtName, {MajorVersion, MinorVersion});
711 ISAInfo->updateFLen();
712 ISAInfo->updateMinVLen();
713 ISAInfo->updateMaxELen();
714 return std::move(ISAInfo);
718 std::vector<std::string> &SplitExts) {
723 Exts.
split(Split,
"_");
725 for (
auto Ext : Split) {
728 "extension name missing after separator '_'");
730 SplitExts.push_back(Ext.str());
738 std::map<std::string, unsigned>> &SeenExtMap,
739 bool IgnoreUnknown,
bool EnableExperimentalExtension,
740 bool ExperimentalExtensionVersionCheck) {
751 "invalid extension prefix '" + RawExt +
"'");
754 if (!IgnoreUnknown &&
Name.size() ==
Type.size())
756 Desc +
" name missing after '" +
Type +
"'");
758 unsigned Major, Minor, ConsumeLength;
760 EnableExperimentalExtension,
761 ExperimentalExtensionVersionCheck)) {
770 if (!IgnoreUnknown && SeenExtMap.contains(
Name.str()))
772 "duplicated " +
Desc +
" '" +
Name +
"'");
777 SeenExtMap[
Name.str()] = {Major, Minor};
784 std::map<std::string, unsigned>> &SeenExtMap,
785 bool IgnoreUnknown,
bool EnableExperimentalExtension,
786 bool ExperimentalExtensionVersionCheck) {
787 unsigned Major, Minor, ConsumeLength;
791 EnableExperimentalExtension,
792 ExperimentalExtensionVersionCheck)) {
795 RawExt = RawExt.
substr(ConsumeLength);
801 RawExt = RawExt.
substr(ConsumeLength);
804 if (!IgnoreUnknown && SeenExtMap.contains(
Name.str()))
806 "duplicated standard user-level extension '" +
812 SeenExtMap[
Name.str()] = {Major, Minor};
818 bool ExperimentalExtensionVersionCheck,
819 bool IgnoreUnknown) {
823 "string must be lowercase");
828 const auto *FoundProfile =
836 std::string NewArch = FoundProfile->MArch.str();
838 if (!ArchWithoutProfile.
empty()) {
842 "additional extensions must be after separator '_'");
843 NewArch += ArchWithoutProfile.
str();
846 ExperimentalExtensionVersionCheck, IgnoreUnknown);
854 "string must begin with rv32{i,e,g} or rv64{i,e,g}");
857 unsigned XLen = HasRV64 ? 64 : 32;
858 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
860 std::map<std::string, unsigned>>
865 char Baseline = Arch[4];
871 "first letter should be 'e', 'i' or 'g'");
879 "version not supported for 'g'");
883 if (Arch.
back() ==
'_')
885 "extension name missing after separator '_'");
890 unsigned Major, Minor, ConsumeLength;
891 if (Baseline ==
'g') {
901 SeenExtMap[Ext] = {Version->Major, Version->Minor};
908 StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
909 EnableExperimentalExtension, ExperimentalExtensionVersionCheck)) {
916 Major = Version->Major;
917 Minor = Version->Minor;
921 SeenExtMap[
StringRef(&Baseline, 1).
str()] = {Major, Minor};
929 std::vector<std::string> SplitExts;
933 for (
auto &Ext : SplitExts) {
935 while (!CurrExt.
empty()) {
938 CurrExt, SeenExtMap, IgnoreUnknown, EnableExperimentalExtension,
939 ExperimentalExtensionVersionCheck))
941 }
else if (CurrExt.
front() ==
'z' || CurrExt.
front() ==
's' ||
942 CurrExt.
front() ==
'x') {
952 CurrExt, SeenExtMap, IgnoreUnknown, EnableExperimentalExtension,
953 ExperimentalExtensionVersionCheck))
961 "invalid standard user-level extension '" +
968 for (
auto &SeenExtAndVers : SeenExtMap) {
969 const std::string &ExtName = SeenExtAndVers.first;
974 ISAInfo->addExtension(ExtName, ExtVers);
980Error RISCVISAInfo::checkDependency() {
981 bool HasC = Exts.count(
"c") != 0;
982 bool HasF = Exts.count(
"f") != 0;
983 bool HasZfinx = Exts.count(
"zfinx") != 0;
984 bool HasVector = Exts.count(
"zve32x") != 0;
985 bool HasZvl = MinVLen != 0;
986 bool HasZcmt = Exts.count(
"zcmt") != 0;
988 if (HasF && HasZfinx)
990 "'f' and 'zfinx' extensions are incompatible");
992 if (HasZvl && !HasVector)
995 "'zvl*b' requires 'v' or 'zve*' extension to also be specified");
997 if (Exts.count(
"zvbb") && !HasVector)
1000 "'zvbb' requires 'v' or 'zve*' extension to also be specified");
1002 if (Exts.count(
"zvbc") && !Exts.count(
"zve64x"))
1005 "'zvbc' requires 'v' or 'zve64*' extension to also be specified");
1007 if ((Exts.count(
"zvkb") || Exts.count(
"zvkg") || Exts.count(
"zvkned") ||
1008 Exts.count(
"zvknha") || Exts.count(
"zvksed") || Exts.count(
"zvksh")) &&
1012 "'zvk*' requires 'v' or 'zve*' extension to also be specified");
1014 if (Exts.count(
"zvknhb") && !Exts.count(
"zve64x"))
1017 "'zvknhb' requires 'v' or 'zve64*' extension to also be specified");
1019 if ((HasZcmt || Exts.count(
"zcmp")) && Exts.count(
"d") &&
1020 (HasC || Exts.count(
"zcd")))
1023 Twine(
"'") + (HasZcmt ?
"zcmt" :
"zcmp") +
1024 "' extension is incompatible with '" + (HasC ?
"c" :
"zcd") +
1025 "' extension when 'd' extension is enabled");
1027 if (XLen != 32 && Exts.count(
"zcf"))
1029 "'zcf' is only supported for 'rv32'");
1031 if (Exts.count(
"zacas") && !(Exts.count(
"a") || Exts.count(
"zamo")))
1034 "'zacas' requires 'a' or 'zaamo' extension to also be specified");
1036 if (Exts.count(
"zabha") && !(Exts.count(
"a") || Exts.count(
"zamo")))
1039 "'zabha' requires 'a' or 'zaamo' extension to also be specified");
1073 "zkne",
"zknd",
"zknh"};
1177void RISCVISAInfo::updateImplication() {
1178 bool HasE = Exts.count(
"e") != 0;
1179 bool HasI = Exts.count(
"i") != 0;
1183 if (!HasE && !HasI) {
1185 addExtension(
"i",
Version.value());
1193 for (
auto const &Ext : Exts)
1196 while (!WorkList.
empty()) {
1200 for (
const char *ImpliedExt :
I->Exts) {
1201 if (WorkList.
count(ImpliedExt))
1203 if (Exts.count(ImpliedExt))
1206 addExtension(ImpliedExt,
Version.value());
1207 WorkList.
insert(ImpliedExt);
1213 if (XLen == 32 && Exts.count(
"zce") && Exts.count(
"f") &&
1214 !Exts.count(
"zcf")) {
1216 addExtension(
"zcf",
Version.value());
1237void RISCVISAInfo::updateCombination() {
1238 bool IsNewCombine =
false;
1240 IsNewCombine =
false;
1242 auto CombineExt = CombineIntoExt.CombineExt;
1243 auto RequiredExts = CombineIntoExt.RequiredExts;
1246 bool IsAllRequiredFeatureExist =
true;
1247 for (
const char *Ext : RequiredExts)
1249 if (IsAllRequiredFeatureExist) {
1251 addExtension(CombineExt,
Version.value());
1252 IsNewCombine =
true;
1255 }
while (IsNewCombine);
1258void RISCVISAInfo::updateFLen() {
1261 if (Exts.count(
"d"))
1263 else if (Exts.count(
"f"))
1267void RISCVISAInfo::updateMinVLen() {
1268 for (
auto const &Ext : Exts) {
1274 MinVLen = std::max(MinVLen, ZvlLen);
1279void RISCVISAInfo::updateMaxELen() {
1281 for (
auto const &Ext : Exts) {
1285 if (ExtName.
back() ==
'f')
1286 MaxELenFp = std::max(MaxELenFp, 32u);
1287 if (ExtName.
back() ==
'd')
1288 MaxELenFp = std::max(MaxELenFp, 64u);
1292 MaxELen = std::max(MaxELen, ZveELen);
1301 Arch <<
"rv" << XLen;
1303 ListSeparator LS(
"_");
1304 for (
auto const &Ext : Exts) {
1306 auto ExtInfo = Ext.second;
1307 Arch << LS << ExtName;
1308 Arch << ExtInfo.Major <<
"p" << ExtInfo.Minor;
1316 ISAInfo->updateImplication();
1317 ISAInfo->updateCombination();
1318 ISAInfo->updateFLen();
1319 ISAInfo->updateMinVLen();
1320 ISAInfo->updateMaxELen();
1322 if (
Error Result = ISAInfo->checkDependency())
1323 return std::move(Result);
1324 return std::move(ISAInfo);
1336 }
else if (XLen == 64) {
1358 unsigned Major, Minor, ConsumeLength;
1370 return std::string();
1376 return std::string();
1379 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 Error processSingleLetterExtension(StringRef &RawExt, MapVector< std::string, RISCVISAUtils::ExtensionVersion, std::map< std::string, unsigned > > &SeenExtMap, bool IgnoreUnknown, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck)
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 std::optional< RISCVISAUtils::ExtensionVersion > findDefaultVersion(StringRef ExtName)
static size_t findLastNonVersionCharacter(StringRef Ext)
static const char * ImpliedExtsZicntr[]
static constexpr RISCVProfile SupportedProfiles[]
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 * 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 * ImpliedExtsZicfiss[]
static const char * ImpliedExtsZcmp[]
static const char * ImpliedExtsD[]
static const char * ImpliedExtsZkn[]
static const char * ImpliedExtsXSfvqmaccdod[]
static bool stripExperimentalPrefix(StringRef &Ext)
static Error processMultiLetterExtension(StringRef RawExt, MapVector< std::string, RISCVISAUtils::ExtensionVersion, std::map< std::string, unsigned > > &SeenExtMap, bool IgnoreUnknown, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck)
static std::optional< RISCVISAUtils::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 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 const char * ImpliedExtsZcmop[]
static const char * ImpliedExtsZvbb[]
static const char * ImpliedExtsZdinx[]
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.
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
static void verifyTables()
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.
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
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::map< std::string, RISCVISAUtils::ExtensionVersion, RISCVISAUtils::ExtensionComparator > OrderedExtensionMap
OrderedExtensionMap is std::map, it's specialized to keep entries in canonical order of extension.
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 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.
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.
constexpr StringLiteral AllStdExts
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.