29struct RISCVSupportedExtension {
34 bool operator<(
const RISCVSupportedExtension &RHS)
const {
47 "i",
"m",
"a",
"f",
"d",
"zicsr",
"zifencei"
50#define GET_SUPPORTED_EXTENSIONS
51#include "llvm/TargetParser/RISCVTargetParserDef.inc"
54 {
"rvi20u32",
"rv32i"},
55 {
"rvi20u64",
"rv64i"},
56 {
"rva20u64",
"rv64imafdc_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_za128rs"},
57 {
"rva20s64",
"rv64imafdc_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_zifencei_"
58 "za128rs_ssccptr_sstvala_sstvecd_svade_svbare"},
60 "rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
61 "zicntr_zihintpause_zihpm_za64rs_zfhmin_zba_zbb_zbs_zkt"},
63 "rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
64 "zicntr_zifencei_zihintpause_zihpm_za64rs_zfhmin_zba_zbb_zbs_zkt_ssccptr_"
65 "sscounterenw_sstvala_sstvecd_svade_svbare_svinval_svpbmt"},
67 "rv64imafdcv_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
68 "zicntr_zicond_zihintntl_zihintpause_zihpm_zimop_za64rs_zawrs_zfa_zfhmin_"
69 "zcb_zcmop_zba_zbb_zbs_zkt_zvbb_zvfhmin_zvkt"},
71 "rv64imafdcvh_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
72 "zicntr_zicond_zifencei_zihintntl_zihintpause_zihpm_zimop_za64rs_zawrs_"
73 "zfa_zfhmin_zcb_zcmop_zba_zbb_zbs_zkt_zvbb_zvfhmin_zvkt_shcounterenw_"
74 "shgatpa_shtvala_shvsatpa_shvstvala_shvstvecd_ssccptr_sscofpmf_"
75 "sscounterenw_ssnpm0p8_ssstateen_sstc_sstvala_sstvecd_ssu64xl_svade_"
76 "svbare_svinval_svnapot_svpbmt"},
77 {
"rvb23u64",
"rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_"
78 "zicclsm_ziccrse_zicntr_zicond_zihintntl_zihintpause_zihpm_"
79 "zimop_za64rs_zawrs_zfa_zcb_zcmop_zba_zbb_zbs_zkt"},
81 "rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_"
82 "zicntr_zicond_zifencei_zihintntl_zihintpause_zihpm_zimop_za64rs_zawrs_"
83 "zfa_zcb_zcmop_zba_zbb_zbs_zkt_ssccptr_sscofpmf_sscounterenw_sstc_sstvala_"
84 "sstvecd_ssu64xl_svade_svbare_svinval_svnapot_svpbmt"},
85 {
"rvm23u32",
"rv32im_zicbop_zicond_zicsr_zihintntl_zihintpause_zimop_zca_"
86 "zcb_zce_zcmop_zcmp_zcmt_zba_zbb_zbs"},
91 static std::atomic<bool> TableChecked(
false);
92 if (!TableChecked.load(std::memory_order_relaxed)) {
94 "Extensions are not sorted by name");
96 "Experimental extensions are not sorted by name");
97 TableChecked.store(
true, std::memory_order_relaxed);
105 unsigned VersionWidth = Description.
empty() ? 0 : 10;
107 << Description <<
"\n";
112 outs() <<
"All available -march extensions for RISC-V\n\n";
116 for (
const auto &E : SupportedExtensions)
117 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
118 for (
const auto &E : ExtMap) {
119 std::string Version =
120 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
124 outs() <<
"\nExperimental extensions\n";
126 for (
const auto &E : SupportedExperimentalExtensions)
127 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
128 for (
const auto &E : ExtMap) {
129 std::string Version =
130 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
131 PrintExtension(E.first, Version, DescMap[
"experimental-" + E.first]);
134 outs() <<
"\nUse -march to specify the target's extension.\n"
135 "For example, clang -march=rv32i_v1p0\n";
139 return Ext.consume_front(
"experimental-");
151 "Already guarded by if-statement in ::parseArchString");
153 int Pos = Ext.size() - 1;
154 while (Pos > 0 &&
isDigit(Ext[Pos]))
156 if (Pos > 0 && Ext[Pos] ==
'p' &&
isDigit(Ext[Pos - 1])) {
158 while (Pos > 0 &&
isDigit(Ext[Pos]))
166 bool operator()(
const RISCVSupportedExtension &LHS,
StringRef RHS) {
169 bool operator()(
StringRef LHS,
const RISCVSupportedExtension &RHS) {
175static std::optional<RISCVISAUtils::ExtensionVersion>
179 for (
auto &ExtInfo : {
ArrayRef(SupportedExtensions),
180 ArrayRef(SupportedExperimentalExtensions)}) {
183 if (
I == ExtInfo.end() ||
I->Name != ExtName)
191void RISCVISAInfo::addExtension(
StringRef ExtName,
197 if (Ext.starts_with(
"s"))
198 return "standard supervisor-level extension";
199 if (Ext.starts_with(
"x"))
200 return "non-standard user-level extension";
201 if (Ext.starts_with(
"z"))
202 return "standard user-level extension";
207 if (Ext.starts_with(
"s"))
209 if (Ext.starts_with(
"x"))
211 if (Ext.starts_with(
"z"))
216static std::optional<RISCVISAUtils::ExtensionVersion>
220 if (
I == std::end(SupportedExperimentalExtensions) ||
I->Name != Ext)
230 IsExperimental ?
ArrayRef(SupportedExperimentalExtensions)
234 return I != ExtInfo.
end() &&
I->Name == Ext;
240 for (
auto ExtInfo : {
ArrayRef(SupportedExtensions),
241 ArrayRef(SupportedExperimentalExtensions)}) {
243 if (
I != ExtInfo.end() &&
I->Name == Ext)
251 unsigned MinorVersion) {
252 for (
auto ExtInfo : {
ArrayRef(SupportedExtensions),
253 ArrayRef(SupportedExperimentalExtensions)}) {
255 std::equal_range(ExtInfo.begin(), ExtInfo.end(), Ext, LessExtName());
256 for (
auto I = Range.first, E = Range.second;
I != E; ++
I)
257 if (
I->Version.Major == MajorVersion &&
I->Version.Minor == MinorVersion)
270 return Exts.count(Ext.str()) != 0;
274 bool IgnoreUnknown)
const {
275 std::vector<std::string> Features;
276 for (
const auto &[ExtName,
_] : Exts) {
286 Features.push_back((
llvm::Twine(
"+experimental-") + ExtName).str());
288 Features.push_back((
llvm::Twine(
"+") + ExtName).str());
291 if (AddAllExtensions) {
292 for (
const RISCVSupportedExtension &Ext : SupportedExtensions) {
293 if (Exts.count(Ext.Name))
295 Features.push_back((
llvm::Twine(
"-") + Ext.Name).str());
298 for (
const RISCVSupportedExtension &Ext : SupportedExperimentalExtensions) {
299 if (Exts.count(Ext.Name))
301 Features.push_back((
llvm::Twine(
"-experimental-") + Ext.Name).str());
308 if (ExtName.size() == 1) {
310 "unsupported standard user-level extension '" +
315 " '" + ExtName +
"'");
324 unsigned &Minor,
unsigned &ConsumeLength,
325 bool EnableExperimentalExtension,
326 bool ExperimentalExtensionVersionCheck) {
331 MajorStr = In.take_while(
isDigit);
332 In = In.substr(MajorStr.
size());
334 if (!MajorStr.
empty() && In.consume_front(
"p")) {
335 MinorStr = In.take_while(
isDigit);
336 In = In.substr(MajorStr.
size() + MinorStr.
size() - 1);
339 if (MinorStr.
empty()) {
342 "minor version number missing after 'p' for extension '" + Ext +
"'");
349 "Failed to parse major version number for extension '" + Ext +
"'");
354 "Failed to parse minor version number for extension '" + Ext +
"'");
356 ConsumeLength = MajorStr.
size();
358 if (!MinorStr.
empty())
359 ConsumeLength += MinorStr.
size() + 1 ;
364 if (Ext.size() > 1 && In.size())
367 "multi-character extensions must be separated by underscores");
371 if (!EnableExperimentalExtension)
373 "requires '-menable-experimental-extensions' "
374 "for experimental extension '" +
377 if (ExperimentalExtensionVersionCheck &&
381 "experimental extension requires explicit version number `" + Ext +
384 auto SupportedVers = *ExperimentalExtension;
385 if (ExperimentalExtensionVersionCheck &&
386 (Major != SupportedVers.Major || Minor != SupportedVers.Minor)) {
387 std::string
Error =
"unsupported version number " + MajorStr.
str();
388 if (!MinorStr.
empty())
390 Error +=
" for experimental extension '" + Ext.str() +
391 "' (this compiler supports " + utostr(SupportedVers.Major) +
392 "." + utostr(SupportedVers.Minor) +
")";
405 Major = DefaultVersion->Major;
406 Minor = DefaultVersion->Minor;
419 std::string
Error =
"unsupported version number " + std::string(MajorStr);
420 if (!MinorStr.
empty())
422 Error +=
" for extension '" + Ext.str() +
"'";
428 const std::vector<std::string> &Features) {
429 assert(XLen == 32 || XLen == 64);
430 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
432 for (
auto &Feature : Features) {
434 bool Experimental =
false;
435 assert(ExtName.
size() > 1 && (ExtName[0] ==
'+' || ExtName[0] ==
'-'));
436 bool Add = ExtName[0] ==
'+';
439 auto ExtensionInfos = Experimental
440 ?
ArrayRef(SupportedExperimentalExtensions)
442 auto ExtensionInfoIterator =
447 if (ExtensionInfoIterator == ExtensionInfos.end() ||
448 ExtensionInfoIterator->Name != ExtName)
452 ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version);
454 ISAInfo->Exts.erase(ExtName.
str());
464 "string must be lowercase");
474 "arch string must begin with valid base ISA");
475 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
483 Arch.
split(Split,
'_');
486 std::tie(Prefix, MinorVersionStr) = Ext.rsplit(
'p');
487 if (MinorVersionStr.
empty())
489 "extension lacks version in expected format");
490 unsigned MajorVersion, MinorVersion;
493 "failed to parse minor version number");
497 int TrailingDigits = 0;
499 while (!ExtName.
empty()) {
507 "extension lacks version in expected format");
509 StringRef MajorVersionStr = Prefix.take_back(TrailingDigits);
512 "failed to parse major version number");
513 ISAInfo->addExtension(ExtName, {MajorVersion, MinorVersion});
515 ISAInfo->updateFLen();
516 ISAInfo->updateMinVLen();
517 ISAInfo->updateMaxELen();
518 return std::move(ISAInfo);
522 std::vector<std::string> &SplitExts) {
527 Exts.
split(Split,
"_");
529 for (
auto Ext : Split) {
532 "extension name missing after separator '_'");
534 SplitExts.push_back(Ext.str());
542 std::map<std::string, unsigned>> &SeenExtMap,
543 bool IgnoreUnknown,
bool EnableExperimentalExtension,
544 bool ExperimentalExtensionVersionCheck) {
555 "invalid extension prefix '" + RawExt +
"'");
558 if (!IgnoreUnknown &&
Name.size() ==
Type.size())
560 Desc +
" name missing after '" +
Type +
"'");
562 unsigned Major, Minor, ConsumeLength;
564 EnableExperimentalExtension,
565 ExperimentalExtensionVersionCheck)) {
574 if (!IgnoreUnknown && SeenExtMap.contains(
Name.str()))
576 "duplicated " +
Desc +
" '" +
Name +
"'");
581 SeenExtMap[
Name.str()] = {Major, Minor};
588 std::map<std::string, unsigned>> &SeenExtMap,
589 bool IgnoreUnknown,
bool EnableExperimentalExtension,
590 bool ExperimentalExtensionVersionCheck) {
591 unsigned Major, Minor, ConsumeLength;
595 EnableExperimentalExtension,
596 ExperimentalExtensionVersionCheck)) {
599 RawExt = RawExt.
substr(ConsumeLength);
605 RawExt = RawExt.
substr(ConsumeLength);
608 if (!IgnoreUnknown && SeenExtMap.contains(
Name.str()))
610 "duplicated standard user-level extension '" +
616 SeenExtMap[
Name.str()] = {Major, Minor};
622 bool ExperimentalExtensionVersionCheck,
623 bool IgnoreUnknown) {
627 "string must be lowercase");
632 const auto *FoundProfile =
640 std::string NewArch = FoundProfile->MArch.str();
642 if (!ArchWithoutProfile.
empty()) {
646 "additional extensions must be after separator '_'");
647 NewArch += ArchWithoutProfile.
str();
650 ExperimentalExtensionVersionCheck, IgnoreUnknown);
658 "string must begin with rv32{i,e,g} or rv64{i,e,g}");
661 unsigned XLen = HasRV64 ? 64 : 32;
662 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
664 std::map<std::string, unsigned>>
669 char Baseline = Arch[4];
675 "first letter should be 'e', 'i' or 'g'");
683 "version not supported for 'g'");
687 if (Arch.
back() ==
'_')
689 "extension name missing after separator '_'");
694 unsigned Major, Minor, ConsumeLength;
695 if (Baseline ==
'g') {
705 SeenExtMap[Ext] = {Version->Major, Version->Minor};
712 StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
713 EnableExperimentalExtension, ExperimentalExtensionVersionCheck)) {
720 Major = Version->Major;
721 Minor = Version->Minor;
725 SeenExtMap[
StringRef(&Baseline, 1).
str()] = {Major, Minor};
733 std::vector<std::string> SplitExts;
737 for (
auto &Ext : SplitExts) {
739 while (!CurrExt.
empty()) {
742 CurrExt, SeenExtMap, IgnoreUnknown, EnableExperimentalExtension,
743 ExperimentalExtensionVersionCheck))
745 }
else if (CurrExt.
front() ==
'z' || CurrExt.
front() ==
's' ||
746 CurrExt.
front() ==
'x') {
756 CurrExt, SeenExtMap, IgnoreUnknown, EnableExperimentalExtension,
757 ExperimentalExtensionVersionCheck))
765 "invalid standard user-level extension '" +
772 for (
auto &SeenExtAndVers : SeenExtMap) {
773 const std::string &ExtName = SeenExtAndVers.first;
778 ISAInfo->addExtension(ExtName, ExtVers);
784Error RISCVISAInfo::checkDependency() {
785 bool HasC = Exts.count(
"c") != 0;
786 bool HasF = Exts.count(
"f") != 0;
787 bool HasZfinx = Exts.count(
"zfinx") != 0;
788 bool HasVector = Exts.count(
"zve32x") != 0;
789 bool HasZvl = MinVLen != 0;
790 bool HasZcmt = Exts.count(
"zcmt") != 0;
792 if (HasF && HasZfinx)
794 "'f' and 'zfinx' extensions are incompatible");
796 if (HasZvl && !HasVector)
799 "'zvl*b' requires 'v' or 'zve*' extension to also be specified");
801 if (Exts.count(
"zvbb") && !HasVector)
804 "'zvbb' requires 'v' or 'zve*' extension to also be specified");
806 if (Exts.count(
"zvbc") && !Exts.count(
"zve64x"))
809 "'zvbc' requires 'v' or 'zve64*' extension to also be specified");
811 if ((Exts.count(
"zvkb") || Exts.count(
"zvkg") || Exts.count(
"zvkned") ||
812 Exts.count(
"zvknha") || Exts.count(
"zvksed") || Exts.count(
"zvksh")) &&
816 "'zvk*' requires 'v' or 'zve*' extension to also be specified");
818 if (Exts.count(
"zvknhb") && !Exts.count(
"zve64x"))
821 "'zvknhb' requires 'v' or 'zve64*' extension to also be specified");
823 if ((HasZcmt || Exts.count(
"zcmp")) && Exts.count(
"d") &&
824 (HasC || Exts.count(
"zcd")))
827 Twine(
"'") + (HasZcmt ?
"zcmt" :
"zcmp") +
828 "' extension is incompatible with '" + (HasC ?
"c" :
"zcd") +
829 "' extension when 'd' extension is enabled");
831 if (XLen != 32 && Exts.count(
"zcf"))
833 "'zcf' is only supported for 'rv32'");
835 if (Exts.count(
"zacas") && !(Exts.count(
"a") || Exts.count(
"zamo")))
838 "'zacas' requires 'a' or 'zaamo' extension to also be specified");
840 if (Exts.count(
"zabha") && !(Exts.count(
"a") || Exts.count(
"zamo")))
843 "'zabha' requires 'a' or 'zaamo' extension to also be specified");
865#define GET_IMPLIED_EXTENSIONS
866#include "llvm/TargetParser/RISCVTargetParserDef.inc"
868void RISCVISAInfo::updateImplication() {
869 bool HasE = Exts.count(
"e") != 0;
870 bool HasI = Exts.count(
"i") != 0;
874 if (!HasE && !HasI) {
876 addExtension(
"i", Version.value());
884 for (
auto const &Ext : Exts)
885 WorkList.
insert(Ext.first);
887 while (!WorkList.
empty()) {
889 auto Range = std::equal_range(std::begin(ImpliedExts),
890 std::end(ImpliedExts), ExtName);
891 std::for_each(Range.first, Range.second,
893 const char *ImpliedExt = Implied.ImpliedExt;
894 if (WorkList.count(ImpliedExt))
896 if (Exts.count(ImpliedExt))
898 auto Version = findDefaultVersion(ImpliedExt);
899 addExtension(ImpliedExt, Version.value());
900 WorkList.insert(ImpliedExt);
905 if (XLen == 32 && Exts.count(
"zce") && Exts.count(
"f") &&
906 !Exts.count(
"zcf")) {
908 addExtension(
"zcf", Version.value());
913 {
"zk"}, {
"zkn"}, {
"zks"}, {
"zvkn"}, {
"zvknc"},
914 {
"zvkng"}, {
"zvks"}, {
"zvksc"}, {
"zvksg"},
917void RISCVISAInfo::updateCombination() {
918 bool MadeChange =
false;
927 auto Range = std::equal_range(std::begin(ImpliedExts),
928 std::end(ImpliedExts), CombineExt);
929 bool HasAllRequiredFeatures = std::all_of(
931 return hasExtension(Implied.ImpliedExt);
933 if (HasAllRequiredFeatures) {
935 addExtension(CombineExt,
Version.value());
939 }
while (MadeChange);
942void RISCVISAInfo::updateFLen() {
947 else if (Exts.count(
"f"))
951void RISCVISAInfo::updateMinVLen() {
952 for (
auto const &Ext : Exts) {
958 MinVLen = std::max(MinVLen, ZvlLen);
963void RISCVISAInfo::updateMaxELen() {
965 for (
auto const &Ext : Exts) {
969 if (ExtName.
back() ==
'f')
970 MaxELenFp = std::max(MaxELenFp, 32u);
971 if (ExtName.
back() ==
'd')
972 MaxELenFp = std::max(MaxELenFp, 64u);
976 MaxELen = std::max(MaxELen, ZveELen);
985 Arch <<
"rv" << XLen;
987 ListSeparator LS(
"_");
988 for (
auto const &Ext : Exts) {
990 auto ExtInfo = Ext.second;
991 Arch << LS << ExtName;
992 Arch << ExtInfo.Major <<
"p" << ExtInfo.Minor;
1000 ISAInfo->updateImplication();
1001 ISAInfo->updateCombination();
1002 ISAInfo->updateFLen();
1003 ISAInfo->updateMinVLen();
1004 ISAInfo->updateMaxELen();
1006 if (
Error Result = ISAInfo->checkDependency())
1007 return std::move(Result);
1008 return std::move(ISAInfo);
1020 }
else if (XLen == 64) {
1042 unsigned Major, Minor, ConsumeLength;
1054 return std::string();
1060 return std::string();
1063 return std::string();
std::optional< std::vector< StOtherPiece > > Other
This file implements a map that provides insertion order iteration.
static void verifyTables()
static StringRef getExtensionTypeDesc(StringRef Ext)
static Error processSingleLetterExtension(StringRef &RawExt, MapVector< std::string, RISCVISAUtils::ExtensionVersion, std::map< std::string, unsigned > > &SeenExtMap, bool IgnoreUnknown, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck)
static std::optional< RISCVISAUtils::ExtensionVersion > findDefaultVersion(StringRef ExtName)
static size_t findLastNonVersionCharacter(StringRef Ext)
static constexpr RISCVProfile SupportedProfiles[]
static StringRef getExtensionType(StringRef Ext)
static constexpr StringLiteral CombineIntoExts[]
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 void PrintExtension(StringRef Name, StringRef Version, StringRef Description)
static bool operator<(const ImpliedExtsEntry &LHS, StringRef RHS)
static Error getExtensionVersion(StringRef Ext, StringRef In, unsigned &Major, unsigned &Minor, unsigned &ConsumeLength, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck)
static const char * RISCVGImplications[]
static Error getStringErrorForInvalidExt(std::string_view ExtName)
static Error splitExtsByUnderscore(StringRef Exts, std::vector< std::string > &SplitExts)
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::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)
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
std::map< std::string, ExtensionVersion, ExtensionComparator > OrderedExtensionMap
OrderedExtensionMap is std::map, it's specialized to keep entries in canonical order of extension.
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.
bool operator<(const ImpliedExtsEntry &Other) const
Description of the encoding of one expression Op.
Represents the major and version number components of a RISC-V extension.