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 outs() <<
"All available -march extensions for RISC-V\n\n";
219 ExtMap[
E.Name] = {
E.Version.Major,
E.Version.Minor};
220 for (
const auto &
E : ExtMap)
221 outs() <<
format(
"\t%-20s%d.%d\n",
E.first.c_str(),
E.second.MajorVersion,
222 E.second.MinorVersion);
224 outs() <<
"\nExperimental extensions\n";
227 ExtMap[
E.Name] = {
E.Version.Major,
E.Version.Minor};
228 for (
const auto &
E : ExtMap)
229 outs() <<
format(
"\t%-20s%d.%d\n",
E.first.c_str(),
E.second.MajorVersion,
230 E.second.MinorVersion);
232 outs() <<
"\nUse -march to specify the target's extension.\n"
233 "For example, clang -march=rv32i_v1p0\n";
237 return Ext.consume_front(
"experimental-");
249 "Already guarded by if-statement in ::parseArchString");
251 int Pos = Ext.size() - 1;
252 while (Pos > 0 &&
isDigit(Ext[Pos]))
254 if (Pos > 0 && Ext[Pos] ==
'p' &&
isDigit(Ext[Pos - 1])) {
256 while (Pos > 0 &&
isDigit(Ext[Pos]))
264 bool operator()(
const RISCVSupportedExtension &LHS,
StringRef RHS) {
267 bool operator()(
StringRef LHS,
const RISCVSupportedExtension &RHS) {
273static std::optional<RISCVExtensionVersion>
281 if (
I == ExtInfo.end() ||
I->Name != ExtName)
289void RISCVISAInfo::addExtension(
StringRef ExtName,
unsigned MajorVersion,
290 unsigned MinorVersion) {
292 Ext.MajorVersion = MajorVersion;
293 Ext.MinorVersion = MinorVersion;
294 Exts[ExtName.
str()] =
Ext;
298 if (Ext.startswith(
"s"))
299 return "standard supervisor-level extension";
300 if (Ext.startswith(
"x"))
301 return "non-standard user-level extension";
302 if (Ext.startswith(
"z"))
303 return "standard user-level extension";
308 if (Ext.startswith(
"s"))
310 if (Ext.startswith(
"x"))
312 if (Ext.startswith(
"z"))
317static std::optional<RISCVExtensionVersion>
335 return I != ExtInfo.
end() &&
I->Name == Ext;
344 if (
I != ExtInfo.end() &&
I->Name == Ext)
352 unsigned MinorVersion) {
356 std::equal_range(ExtInfo.begin(), ExtInfo.end(), Ext, LessExtName());
357 for (
auto I = Range.first,
E = Range.second;
I !=
E; ++
I)
358 if (
I->Version.Major == MajorVersion &&
I->Version.Minor == MinorVersion)
371 return Exts.count(Ext.str()) != 0;
394 assert(Ext >=
'a' && Ext <=
'z');
414 assert(ExtName.size() >= 1);
415 switch (ExtName[0]) {
419 assert(ExtName.size() >= 2);
426 assert(ExtName.size() == 1);
434 const std::string &RHS) {
439 if (LHSRank != RHSRank)
440 return LHSRank < RHSRank;
447 std::vector<StringRef> &Features,
449 bool AddAllExtensions)
const {
450 for (
auto const &Ext : Exts) {
457 Features.push_back(StrAlloc(
"+experimental-" + ExtName));
459 Features.push_back(StrAlloc(
"+" + ExtName));
462 if (AddAllExtensions) {
464 if (Exts.count(Ext.Name))
466 Features.push_back(StrAlloc(
Twine(
"-") + Ext.Name));
470 if (Exts.count(Ext.Name))
472 Features.push_back(StrAlloc(
Twine(
"-experimental-") + Ext.Name));
483 unsigned &Minor,
unsigned &ConsumeLength,
484 bool EnableExperimentalExtension,
485 bool ExperimentalExtensionVersionCheck) {
490 MajorStr = In.take_while(
isDigit);
491 In = In.substr(MajorStr.
size());
493 if (!MajorStr.
empty() && In.consume_front(
"p")) {
494 MinorStr = In.take_while(
isDigit);
495 In = In.substr(MajorStr.
size() + MinorStr.
size() - 1);
498 if (MinorStr.
empty()) {
501 "minor version number missing after 'p' for extension '" + Ext +
"'");
508 "Failed to parse major version number for extension '" + Ext +
"'");
513 "Failed to parse minor version number for extension '" + Ext +
"'");
515 ConsumeLength = MajorStr.
size();
517 if (!MinorStr.
empty())
518 ConsumeLength += MinorStr.
size() + 1 ;
523 if (Ext.size() > 1 && In.size()) {
525 "multi-character extensions must be separated by underscores";
531 if (!EnableExperimentalExtension) {
532 std::string
Error =
"requires '-menable-experimental-extensions' for "
533 "experimental extension '" +
538 if (ExperimentalExtensionVersionCheck &&
541 "experimental extension requires explicit version number `" +
546 auto SupportedVers = *ExperimentalExtension;
547 if (ExperimentalExtensionVersionCheck &&
548 (Major != SupportedVers.Major || Minor != SupportedVers.Minor)) {
549 std::string
Error =
"unsupported version number " + MajorStr.
str();
550 if (!MinorStr.
empty())
552 Error +=
" for experimental extension '" + Ext.str() +
553 "' (this compiler supports " + utostr(SupportedVers.Major) +
554 "." + utostr(SupportedVers.Minor) +
")";
567 Major = DefaultVersion->Major;
568 Minor = DefaultVersion->Minor;
578 std::string
Error =
"unsupported version number " + std::string(MajorStr);
579 if (!MinorStr.
empty())
581 Error +=
" for extension '" + Ext.str() +
"'";
587 const std::vector<std::string> &Features) {
588 assert(XLen == 32 || XLen == 64);
589 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
591 for (
auto &Feature : Features) {
593 bool Experimental =
false;
594 assert(ExtName.
size() > 1 && (ExtName[0] ==
'+' || ExtName[0] ==
'-'));
595 bool Add = ExtName[0] ==
'+';
598 auto ExtensionInfos = Experimental
601 auto ExtensionInfoIterator =
606 if (ExtensionInfoIterator == ExtensionInfos.end() ||
607 ExtensionInfoIterator->Name != ExtName)
611 ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version.Major,
612 ExtensionInfoIterator->Version.Minor);
614 ISAInfo->Exts.erase(ExtName.
str());
624 "string must be lowercase");
634 "arch string must begin with valid base ISA");
635 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
643 Arch.
split(Split,
'_');
646 std::tie(Prefix, MinorVersionStr) = Ext.rsplit(
'p');
647 if (MinorVersionStr.
empty())
649 "extension lacks version in expected format");
650 unsigned MajorVersion, MinorVersion;
653 "failed to parse minor version number");
657 int TrailingDigits = 0;
659 while (!ExtName.
empty()) {
667 "extension lacks version in expected format");
669 StringRef MajorVersionStr = Prefix.take_back(TrailingDigits);
672 "failed to parse major version number");
673 ISAInfo->addExtension(ExtName, MajorVersion, MinorVersion);
675 ISAInfo->updateFLen();
676 ISAInfo->updateMinVLen();
677 ISAInfo->updateMaxELen();
678 return std::move(ISAInfo);
683 bool ExperimentalExtensionVersionCheck,
684 bool IgnoreUnknown) {
688 "string must be lowercase");
696 "string must begin with rv32{i,e,g} or rv64{i,e,g}");
699 unsigned XLen = HasRV64 ? 64 : 32;
700 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
705 char Baseline = Arch[4];
711 "first letter should be 'e', 'i' or 'g'");
719 "version not supported for 'g'");
724 if (Arch.
back() ==
'_')
726 "extension name missing after separator '_'");
738 OtherExts = Exts.
substr(Pos);
739 Exts = Exts.
substr(0, Pos);
742 unsigned Major, Minor, ConsumeLength;
743 if (Baseline ==
'g') {
752 ISAInfo->addExtension(Ext, Version->Major, Version->Minor);
759 StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
760 EnableExperimentalExtension, ExperimentalExtensionVersionCheck)) {
767 Major = Version->Major;
768 Minor = Version->Minor;
771 ISAInfo->addExtension(
StringRef(&Baseline, 1), Major, Minor);
779 auto StdExtsItr = StdExts.
begin();
780 auto StdExtsEnd = StdExts.
end();
783 I += 1 + ConsumeLength;
784 if (
I !=
E && *
I ==
'_')
791 while (StdExtsItr != StdExtsEnd && *StdExtsItr !=
C)
794 if (StdExtsItr == StdExtsEnd) {
800 "standard user-level extension not given in canonical order '%c'",
805 "invalid standard user-level extension '%c'",
C);
812 unsigned Major, Minor, ConsumeLength;
813 if (std::next(
I) !=
E)
816 ConsumeLength, EnableExperimentalExtension,
817 ExperimentalExtensionVersionCheck)) {
820 GoToNextExt(
I, ConsumeLength, Exts.
end());
830 GoToNextExt(
I, ConsumeLength, Exts.
end());
834 "unsupported standard user-level extension '%c'",
837 ISAInfo->addExtension(
StringRef(&
C, 1), Major, Minor);
841 GoToNextExt(
I, ConsumeLength, Exts.
end());
857 OtherExts.
split(Split,
'_');
860 if (Split.size() > 1 || Split[0] !=
"") {
864 "extension name missing after separator '_'");
876 "invalid extension prefix '" + Ext +
"'");
879 if (!IgnoreUnknown &&
Name.size() ==
Type.size()) {
881 "%s name missing after '%s'",
882 Desc.str().c_str(),
Type.str().c_str());
885 unsigned Major, Minor, ConsumeLength;
887 EnableExperimentalExtension,
888 ExperimentalExtensionVersionCheck)) {
899 Desc.str().c_str(),
Name.str().c_str());
905 ISAInfo->addExtension(
Name, Major, Minor);
912 for (
auto Ext : AllExts) {
916 Desc.str().c_str(), Ext.str().c_str());
923Error RISCVISAInfo::checkDependency() {
924 bool HasC = Exts.count(
"c") != 0;
925 bool HasF = Exts.count(
"f") != 0;
926 bool HasZfinx = Exts.count(
"zfinx") != 0;
927 bool HasVector = Exts.count(
"zve32x") != 0;
928 bool HasZvl = MinVLen != 0;
929 bool HasZcmt = Exts.count(
"zcmt") != 0;
931 if (HasF && HasZfinx)
933 "'f' and 'zfinx' extensions are incompatible");
935 if (HasZvl && !HasVector)
938 "'zvl*b' requires 'v' or 'zve*' extension to also be specified");
940 if (Exts.count(
"zvbb") && !HasVector)
943 "'zvbb' requires 'v' or 'zve*' extension to also be specified");
945 if (Exts.count(
"zvbc") && !Exts.count(
"zve64x"))
948 "'zvbc' requires 'v' or 'zve64*' extension to also be specified");
950 if ((Exts.count(
"zvkg") || Exts.count(
"zvkned") || Exts.count(
"zvknha") ||
951 Exts.count(
"zvksed") || Exts.count(
"zvksh")) &&
955 "'zvk*' requires 'v' or 'zve*' extension to also be specified");
957 if (Exts.count(
"zvknhb") && !Exts.count(
"zve64x"))
960 "'zvknhb' requires 'v' or 'zve64*' extension to also be specified");
962 if ((HasZcmt || Exts.count(
"zcmp")) && Exts.count(
"d") &&
963 (HasC || Exts.count(
"zcd")))
966 Twine(
"'") + (HasZcmt ?
"zcmt" :
"zcmp") +
967 "' extension is incompatible with '" + (HasC ?
"c" :
"zcd") +
968 "' extension when 'd' extension is enabled");
970 if (XLen != 32 && Exts.count(
"zcf"))
972 "'zcf' is only supported for 'rv32'");
1001 "zkne",
"zknd",
"zknh"};
1100void RISCVISAInfo::updateImplication() {
1101 bool HasE = Exts.count(
"e") != 0;
1102 bool HasI = Exts.count(
"i") != 0;
1106 if (!HasE && !HasI) {
1116 for (
auto const &Ext : Exts)
1119 while (!WorkList.
empty()) {
1123 for (
const char *ImpliedExt :
I->Exts) {
1124 if (WorkList.
count(ImpliedExt))
1126 if (Exts.count(ImpliedExt))
1130 WorkList.
insert(ImpliedExt);
1136 if (XLen == 32 && Exts.count(
"zce") && Exts.count(
"f") &&
1137 !Exts.count(
"zcf")) {
1160void RISCVISAInfo::updateCombination() {
1161 bool IsNewCombine =
false;
1163 IsNewCombine =
false;
1165 auto CombineExt = CombineIntoExt.CombineExt;
1166 auto RequiredExts = CombineIntoExt.RequiredExts;
1169 bool IsAllRequiredFeatureExist =
true;
1170 for (
const char *Ext : RequiredExts)
1172 if (IsAllRequiredFeatureExist) {
1175 IsNewCombine =
true;
1178 }
while (IsNewCombine);
1181void RISCVISAInfo::updateFLen() {
1184 if (Exts.count(
"d"))
1186 else if (Exts.count(
"f"))
1190void RISCVISAInfo::updateMinVLen() {
1191 for (
auto const &Ext : Exts) {
1197 MinVLen = std::max(MinVLen, ZvlLen);
1202void RISCVISAInfo::updateMaxELen() {
1204 for (
auto const &Ext : Exts) {
1208 if (ExtName.
back() ==
'f')
1209 MaxELenFp = std::max(MaxELenFp, 32u);
1210 if (ExtName.
back() ==
'd')
1211 MaxELenFp = std::max(MaxELenFp, 64u);
1215 MaxELen = std::max(MaxELen, ZveELen);
1224 Arch <<
"rv" << XLen;
1226 ListSeparator LS(
"_");
1227 for (
auto const &Ext : Exts) {
1229 auto ExtInfo = Ext.second;
1230 Arch << LS << ExtName;
1231 Arch << ExtInfo.MajorVersion <<
"p" << ExtInfo.MinorVersion;
1238 std::vector<std::string> FeatureVector;
1239 for (
auto const &Ext : Exts) {
1240 std::string ExtName = Ext.first;
1246 ?
"+experimental-" + ExtName
1248 FeatureVector.push_back(Feature);
1250 return FeatureVector;
1255 ISAInfo->updateImplication();
1256 ISAInfo->updateCombination();
1257 ISAInfo->updateFLen();
1258 ISAInfo->updateMinVLen();
1259 ISAInfo->updateMaxELen();
1261 if (
Error Result = ISAInfo->checkDependency())
1262 return std::move(Result);
1263 return std::move(ISAInfo);
1273 }
else if (XLen == 64) {
1293 unsigned Major, Minor, ConsumeLength;
1305 return std::string();
1311 return std::string();
1314 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 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...
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...
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
void riscvExtensionsHelp()
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...
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.