29struct RISCVSupportedExtension {
34 bool operator<(
const RISCVSupportedExtension &RHS)
const {
43 bool operator<(
const RISCVProfile &RHS)
const {
51 "i",
"m",
"a",
"f",
"d",
"zicsr",
"zifencei"
54#define GET_SUPPORTED_EXTENSIONS
55#include "llvm/TargetParser/RISCVTargetParserDef.inc"
57#define GET_SUPPORTED_PROFILES
58#include "llvm/TargetParser/RISCVTargetParserDef.inc"
62 static std::atomic<bool> TableChecked(
false);
63 if (!TableChecked.load(std::memory_order_relaxed)) {
65 "Extensions are not sorted by name");
67 "Experimental extensions are not sorted by name");
69 "Profiles are not sorted by name");
71 "Experimental profiles are not sorted by name");
72 TableChecked.store(
true, std::memory_order_relaxed);
80 unsigned VersionWidth = Description.
empty() ? 0 : 10;
82 << Description <<
"\n";
87 outs() <<
"All available -march extensions for RISC-V\n\n";
91 for (
const auto &E : SupportedExtensions)
92 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
93 for (
const auto &E : ExtMap) {
95 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
99 outs() <<
"\nExperimental extensions\n";
101 for (
const auto &E : SupportedExperimentalExtensions)
102 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
103 for (
const auto &E : ExtMap) {
104 std::string Version =
105 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
106 PrintExtension(E.first, Version, DescMap[
"experimental-" + E.first]);
109 outs() <<
"\nSupported Profiles\n";
110 for (
const auto &
P : SupportedProfiles)
113 outs() <<
"\nExperimental Profiles\n";
114 for (
const auto &
P : SupportedExperimentalProfiles)
117 outs() <<
"\nUse -march to specify the target's extension.\n"
118 "For example, clang -march=rv32i_v1p0\n";
122 return Ext.consume_front(
"experimental-");
134 "Already guarded by if-statement in ::parseArchString");
136 int Pos = Ext.size() - 1;
137 while (Pos > 0 &&
isDigit(Ext[Pos]))
139 if (Pos > 0 && Ext[Pos] ==
'p' &&
isDigit(Ext[Pos - 1])) {
141 while (Pos > 0 &&
isDigit(Ext[Pos]))
149 bool operator()(
const RISCVSupportedExtension &LHS,
StringRef RHS) {
152 bool operator()(
StringRef LHS,
const RISCVSupportedExtension &RHS) {
158static std::optional<RISCVISAUtils::ExtensionVersion>
162 for (
auto &ExtInfo : {
ArrayRef(SupportedExtensions),
163 ArrayRef(SupportedExperimentalExtensions)}) {
166 if (
I == ExtInfo.end() ||
I->Name != ExtName)
174bool RISCVISAInfo::addExtension(
StringRef ExtName,
176 return Exts.emplace(ExtName,
Version).second;
180 if (Ext.starts_with(
"s"))
181 return "standard supervisor-level extension";
182 if (Ext.starts_with(
"x"))
183 return "non-standard user-level extension";
184 if (Ext.starts_with(
"z"))
185 return "standard user-level extension";
190 if (Ext.starts_with(
"s"))
192 if (Ext.starts_with(
"x"))
194 if (Ext.starts_with(
"z"))
199static std::optional<RISCVISAUtils::ExtensionVersion>
203 if (
I == std::end(SupportedExperimentalExtensions) ||
I->Name != Ext)
213 IsExperimental ?
ArrayRef(SupportedExperimentalExtensions)
217 return I != ExtInfo.
end() &&
I->Name == Ext;
223 for (
auto ExtInfo : {
ArrayRef(SupportedExtensions),
224 ArrayRef(SupportedExperimentalExtensions)}) {
226 if (
I != ExtInfo.end() &&
I->Name == Ext)
234 unsigned MinorVersion) {
235 for (
auto ExtInfo : {
ArrayRef(SupportedExtensions),
236 ArrayRef(SupportedExperimentalExtensions)}) {
238 std::equal_range(ExtInfo.begin(), ExtInfo.end(), Ext, LessExtName());
239 for (
auto I = Range.first, E = Range.second;
I != E; ++
I)
240 if (
I->Version.Major == MajorVersion &&
I->Version.Minor == MinorVersion)
253 return Exts.count(Ext.str()) != 0;
257 bool IgnoreUnknown)
const {
258 std::vector<std::string> Features;
259 for (
const auto &[ExtName,
_] : Exts) {
269 Features.push_back((
llvm::Twine(
"+experimental-") + ExtName).str());
271 Features.push_back((
llvm::Twine(
"+") + ExtName).str());
274 if (AddAllExtensions) {
275 for (
const RISCVSupportedExtension &Ext : SupportedExtensions) {
276 if (Exts.count(Ext.Name))
278 Features.push_back((
llvm::Twine(
"-") + Ext.Name).str());
281 for (
const RISCVSupportedExtension &Ext : SupportedExperimentalExtensions) {
282 if (Exts.count(Ext.Name))
284 Features.push_back((
llvm::Twine(
"-experimental-") + Ext.Name).str());
291 if (ExtName.size() == 1) {
293 "unsupported standard user-level extension '" +
298 " '" + ExtName +
"'");
307 unsigned &Minor,
unsigned &ConsumeLength,
308 bool EnableExperimentalExtension,
309 bool ExperimentalExtensionVersionCheck) {
314 MajorStr = In.take_while(
isDigit);
315 In = In.substr(MajorStr.
size());
317 if (!MajorStr.
empty() && In.consume_front(
"p")) {
318 MinorStr = In.take_while(
isDigit);
319 In = In.substr(MajorStr.
size() + MinorStr.
size() - 1);
322 if (MinorStr.
empty()) {
325 "minor version number missing after 'p' for extension '" + Ext +
"'");
332 "Failed to parse major version number for extension '" + Ext +
"'");
337 "Failed to parse minor version number for extension '" + Ext +
"'");
339 ConsumeLength = MajorStr.
size();
341 if (!MinorStr.
empty())
342 ConsumeLength += MinorStr.
size() + 1 ;
347 if (Ext.size() > 1 && In.size())
350 "multi-character extensions must be separated by underscores");
354 if (!EnableExperimentalExtension)
356 "requires '-menable-experimental-extensions' "
357 "for experimental extension '" +
360 if (ExperimentalExtensionVersionCheck &&
364 "experimental extension requires explicit version number `" + Ext +
367 auto SupportedVers = *ExperimentalExtension;
368 if (ExperimentalExtensionVersionCheck &&
369 (Major != SupportedVers.Major || Minor != SupportedVers.Minor)) {
370 std::string
Error =
"unsupported version number " + MajorStr.
str();
371 if (!MinorStr.
empty())
373 Error +=
" for experimental extension '" + Ext.str() +
374 "' (this compiler supports " + utostr(SupportedVers.Major) +
375 "." + utostr(SupportedVers.Minor) +
")";
388 Major = DefaultVersion->Major;
389 Minor = DefaultVersion->Minor;
402 std::string
Error =
"unsupported version number " + std::string(MajorStr);
403 if (!MinorStr.
empty())
405 Error +=
" for extension '" + Ext.str() +
"'";
411 const std::vector<std::string> &Features) {
412 assert(XLen == 32 || XLen == 64);
413 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
415 for (
auto &Feature : Features) {
417 assert(ExtName.
size() > 1 && (ExtName[0] ==
'+' || ExtName[0] ==
'-'));
418 bool Add = ExtName[0] ==
'+';
421 auto ExtensionInfos = Experimental
422 ?
ArrayRef(SupportedExperimentalExtensions)
424 auto ExtensionInfoIterator =
429 if (ExtensionInfoIterator == ExtensionInfos.end() ||
430 ExtensionInfoIterator->Name != ExtName)
434 ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version);
436 ISAInfo->Exts.erase(ExtName.
str());
448 "string may only contain [a-z0-9_]");
457 if (XLen == 0 || Arch.
empty() || (Arch[0] !=
'i' && Arch[0] !=
'e'))
459 "arch string must begin with valid base ISA");
461 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
466 while (!Arch.
empty()) {
467 if (Arch[0] ==
'_') {
468 if (Arch.
size() == 1 || Arch[1] ==
'_')
470 "extension name missing after separator '_'");
479 std::tie(Prefix, MinorVersionStr) = Ext.rsplit(
'p');
480 if (MinorVersionStr.
empty())
482 "extension lacks version in expected format");
483 unsigned MajorVersion, MinorVersion;
486 "failed to parse minor version number");
490 size_t VersionStart = Prefix.size();
491 while (VersionStart != 0) {
492 if (!
isDigit(Prefix[VersionStart - 1]))
496 if (VersionStart == Prefix.size())
498 "extension lacks version in expected format");
500 if (VersionStart == 0)
502 "missing extension name");
504 StringRef ExtName = Prefix.slice(0, VersionStart);
508 "failed to parse major version number");
510 if ((ExtName[0] ==
'z' || ExtName[0] ==
's' || ExtName[0] ==
'x') &&
513 "'" +
Twine(ExtName[0]) +
514 "' must be followed by a letter");
516 if (!ISAInfo->addExtension(ExtName, {MajorVersion, MinorVersion}))
518 "duplicate extension '" + ExtName +
"'");
520 ISAInfo->updateImpliedLengths();
521 return std::move(ISAInfo);
527 std::map<std::string, unsigned>> &SeenExtMap,
528 bool IgnoreUnknown,
bool EnableExperimentalExtension,
529 bool ExperimentalExtensionVersionCheck) {
540 "invalid extension prefix '" + RawExt +
"'");
543 if (!IgnoreUnknown &&
Name.size() ==
Type.size())
545 Desc +
" name missing after '" +
Type +
"'");
547 unsigned Major, Minor, ConsumeLength;
549 EnableExperimentalExtension,
550 ExperimentalExtensionVersionCheck)) {
559 if (!IgnoreUnknown && SeenExtMap.contains(
Name.str()))
561 "duplicated " +
Desc +
" '" +
Name +
"'");
566 SeenExtMap[
Name.str()] = {Major, Minor};
573 std::map<std::string, unsigned>> &SeenExtMap,
574 bool IgnoreUnknown,
bool EnableExperimentalExtension,
575 bool ExperimentalExtensionVersionCheck) {
576 unsigned Major, Minor, ConsumeLength;
580 EnableExperimentalExtension,
581 ExperimentalExtensionVersionCheck)) {
584 RawExt = RawExt.
substr(ConsumeLength);
590 RawExt = RawExt.
substr(ConsumeLength);
593 if (!IgnoreUnknown && SeenExtMap.contains(
Name.str()))
595 "duplicated standard user-level extension '" +
601 SeenExtMap[
Name.str()] = {Major, Minor};
607 bool ExperimentalExtensionVersionCheck,
608 bool IgnoreUnknown) {
613 "string may only contain [a-z0-9_]");
627 bool FoundProfile =
I != std::begin(SupportedProfiles) &&
631 FoundProfile = (
I != std::begin(SupportedExperimentalProfiles) &&
633 if (FoundProfile && !EnableExperimentalExtension) {
635 "requires '-menable-experimental-extensions' "
637 std::prev(
I)->
Name +
"'");
642 std::string NewArch =
I->MArch.str();
644 if (!ArchWithoutProfile.
empty()) {
645 if (ArchWithoutProfile.
front() !=
'_')
648 "additional extensions must be after separator '_'");
649 NewArch += ArchWithoutProfile.
str();
652 ExperimentalExtensionVersionCheck, IgnoreUnknown);
656 if (XLen == 0 || Arch.
empty())
659 "string must begin with rv32{i,e,g}, rv64{i,e,g}, or a supported "
662 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
664 std::map<std::string, unsigned>>
669 char Baseline = Arch.
front();
675 "first letter after \'rv" +
Twine(XLen) +
676 "\' should be 'e', 'i' or 'g'");
684 "version not supported for 'g'");
691 unsigned Major, Minor, ConsumeLength;
692 if (Baseline ==
'g') {
708 StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
709 EnableExperimentalExtension, ExperimentalExtensionVersionCheck)) {
721 SeenExtMap[
StringRef(&Baseline, 1).
str()] = {Major, Minor};
728 while (!Exts.
empty()) {
729 if (Exts.
front() ==
'_') {
730 if (Exts.
size() == 1 || Exts[1] ==
'_')
732 "extension name missing after separator '_'");
743 Ext, SeenExtMap, IgnoreUnknown, EnableExperimentalExtension,
744 ExperimentalExtensionVersionCheck))
746 }
else if (Ext.front() ==
'z' || Ext.front() ==
's' ||
747 Ext.front() ==
'x') {
757 Ext, SeenExtMap, IgnoreUnknown, EnableExperimentalExtension,
758 ExperimentalExtensionVersionCheck))
766 "invalid standard user-level extension '" +
767 Twine(Ext.front()) +
"'");
769 }
while (!Ext.empty());
773 for (
auto &SeenExtAndVers : SeenExtMap) {
774 const std::string &ExtName = SeenExtAndVers.first;
779 ISAInfo->addExtension(ExtName, ExtVers);
785Error RISCVISAInfo::checkDependency() {
786 bool HasE = Exts.count(
"e") != 0;
787 bool HasI = Exts.count(
"i") != 0;
788 bool HasC = Exts.count(
"c") != 0;
789 bool HasF = Exts.count(
"f") != 0;
790 bool HasZfinx = Exts.count(
"zfinx") != 0;
791 bool HasVector = Exts.count(
"zve32x") != 0;
792 bool HasZvl = MinVLen != 0;
793 bool HasZcmt = Exts.count(
"zcmt") != 0;
797 "'I' and 'E' extensions are incompatible");
799 if (HasF && HasZfinx)
801 "'f' and 'zfinx' extensions are incompatible");
803 if (HasZvl && !HasVector)
806 "'zvl*b' requires 'v' or 'zve*' extension to also be specified");
808 if (Exts.count(
"zvbb") && !HasVector)
811 "'zvbb' requires 'v' or 'zve*' extension to also be specified");
813 if (Exts.count(
"zvbc") && !Exts.count(
"zve64x"))
816 "'zvbc' requires 'v' or 'zve64*' extension to also be specified");
818 if ((Exts.count(
"zvkb") || Exts.count(
"zvkg") || Exts.count(
"zvkned") ||
819 Exts.count(
"zvknha") || Exts.count(
"zvksed") || Exts.count(
"zvksh")) &&
823 "'zvk*' requires 'v' or 'zve*' extension to also be specified");
825 if (Exts.count(
"zvknhb") && !Exts.count(
"zve64x"))
828 "'zvknhb' requires 'v' or 'zve64*' extension to also be specified");
830 if ((HasZcmt || Exts.count(
"zcmp")) && Exts.count(
"d") &&
831 (HasC || Exts.count(
"zcd")))
834 Twine(
"'") + (HasZcmt ?
"zcmt" :
"zcmp") +
835 "' extension is incompatible with '" + (HasC ?
"c" :
"zcd") +
836 "' extension when 'd' extension is enabled");
838 if (XLen != 32 && Exts.count(
"zcf"))
840 "'zcf' is only supported for 'rv32'");
842 if (Exts.count(
"zacas") && !(Exts.count(
"a") || Exts.count(
"zamo")))
845 "'zacas' requires 'a' or 'zaamo' extension to also be specified");
847 if (Exts.count(
"zabha") && !(Exts.count(
"a") || Exts.count(
"zamo")))
850 "'zabha' requires 'a' or 'zaamo' extension to also be specified");
872#define GET_IMPLIED_EXTENSIONS
873#include "llvm/TargetParser/RISCVTargetParserDef.inc"
875void RISCVISAInfo::updateImplication() {
876 bool HasE = Exts.count(
"e") != 0;
877 bool HasI = Exts.count(
"i") != 0;
881 if (!HasE && !HasI) {
883 addExtension(
"i",
Version.value());
894 for (
auto const &Ext : Exts)
895 WorkList.
insert(Ext.first);
897 while (!WorkList.
empty()) {
899 auto Range = std::equal_range(std::begin(ImpliedExts),
900 std::end(ImpliedExts), ExtName);
901 std::for_each(Range.first, Range.second,
903 const char *ImpliedExt = Implied.ImpliedExt;
904 if (WorkList.count(ImpliedExt))
906 if (Exts.count(ImpliedExt))
908 auto Version = findDefaultVersion(ImpliedExt);
909 addExtension(ImpliedExt, Version.value());
910 WorkList.insert(ImpliedExt);
915 if (XLen == 32 && Exts.count(
"zce") && Exts.count(
"f") &&
916 !Exts.count(
"zcf")) {
918 addExtension(
"zcf",
Version.value());
923 {
"zk"}, {
"zkn"}, {
"zks"}, {
"zvkn"}, {
"zvknc"},
924 {
"zvkng"}, {
"zvks"}, {
"zvksc"}, {
"zvksg"},
927void RISCVISAInfo::updateCombination() {
928 bool MadeChange =
false;
932 if (Exts.count(CombineExt.str()))
937 auto Range = std::equal_range(std::begin(ImpliedExts),
938 std::end(ImpliedExts), CombineExt);
939 bool HasAllRequiredFeatures = std::all_of(
941 return Exts.count(Implied.ImpliedExt);
943 if (HasAllRequiredFeatures) {
945 addExtension(CombineExt,
Version.value());
949 }
while (MadeChange);
952void RISCVISAInfo::updateImpliedLengths() {
953 assert(FLen == 0 && MaxELenFp == 0 && MaxELen == 0 && MinVLen == 0 &&
954 "Expected lengths to be initialied to zero");
959 else if (Exts.count(
"f"))
962 if (Exts.count(
"v")) {
963 MaxELenFp = std::max(MaxELenFp, 64u);
964 MaxELen = std::max(MaxELen, 64u);
967 for (
auto const &Ext : Exts) {
976 MaxELenFp = std::max(MaxELenFp, 32u);
977 else if (ExtName ==
"d")
978 MaxELenFp = std::max(MaxELenFp, 64u);
979 else if (ExtName !=
"x")
982 MaxELen = std::max(MaxELen, ZveELen);
995 MinVLen = std::max(MinVLen, ZvlLen);
1005 Arch <<
"rv" << XLen;
1007 ListSeparator LS(
"_");
1008 for (
auto const &Ext : Exts) {
1010 auto ExtInfo = Ext.second;
1011 Arch << LS << ExtName;
1012 Arch << ExtInfo.Major <<
"p" << ExtInfo.Minor;
1020 ISAInfo->updateImplication();
1021 ISAInfo->updateCombination();
1022 ISAInfo->updateImpliedLengths();
1024 if (
Error Result = ISAInfo->checkDependency())
1025 return std::move(Result);
1026 return std::move(ISAInfo);
1031 if (Exts.count(
"e"))
1033 if (Exts.count(
"d"))
1035 if (Exts.count(
"f"))
1038 }
else if (XLen == 64) {
1039 if (Exts.count(
"e"))
1041 if (Exts.count(
"d"))
1043 if (Exts.count(
"f"))
1060 unsigned Major, Minor, ConsumeLength;
1072 return std::string();
1078 return std::string();
1081 return std::string();
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
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 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 bool isDigit(const char C)
static bool isLower(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.
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.
bool consumeInteger(unsigned Radix, T &Result)
Parse the current string as an integer of the specified radix.
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.
StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
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.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
static constexpr size_t npos
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.
@ C
The default llvm calling convention, compatible with C.
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)
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
raw_fd_ostream & outs()
This returns a reference to a raw_fd_ostream for standard output.
auto upper_bound(R &&Range, T &&Value)
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
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...
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.