27struct RISCVSupportedExtension {
32 bool operator<(
const RISCVSupportedExtension &RHS)
const {
41 bool operator<(
const RISCVProfile &RHS)
const {
51#define GET_SUPPORTED_EXTENSIONS
52#include "llvm/TargetParser/RISCVTargetParserDef.inc"
54#define GET_SUPPORTED_PROFILES
55#include "llvm/TargetParser/RISCVTargetParserDef.inc"
59 static std::atomic<bool> TableChecked(
false);
60 if (!TableChecked.load(std::memory_order_relaxed)) {
62 "Extensions are not sorted by name");
64 "Experimental extensions are not sorted by name");
66 "Profiles are not sorted by name");
68 "Experimental profiles are not sorted by name");
69 TableChecked.store(
true, std::memory_order_relaxed);
77 unsigned VersionWidth = Description.
empty() ? 0 : 10;
79 << Description <<
"\n";
83 outs() <<
"All available -march extensions for RISC-V\n\n";
87 for (
const auto &E : SupportedExtensions)
88 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
89 for (
const auto &E : ExtMap) {
91 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
95 outs() <<
"\nExperimental extensions\n";
97 for (
const auto &E : SupportedExperimentalExtensions)
98 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
99 for (
const auto &E : ExtMap) {
101 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
105 outs() <<
"\nSupported Profiles\n";
106 for (
const auto &
P : SupportedProfiles)
109 outs() <<
"\nExperimental Profiles\n";
110 for (
const auto &
P : SupportedExperimentalProfiles)
113 outs() <<
"\nUse -march to specify the target's extension.\n"
114 "For example, clang -march=rv32i_v1p0\n";
118 bool IsRV64, std::set<StringRef> &EnabledFeatureNames,
120 outs() <<
"Extensions enabled for the given RISC-V target\n\n";
125 for (
const auto &E : SupportedExtensions)
126 if (EnabledFeatureNames.count(E.Name) != 0) {
127 FullExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
128 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
130 for (
const auto &E : ExtMap) {
132 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
136 outs() <<
"\nExperimental extensions\n";
138 for (
const auto &E : SupportedExperimentalExtensions) {
140 if (EnabledFeatureNames.count(
"experimental-" +
Name.str()) != 0) {
141 FullExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
142 ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
145 for (
const auto &E : ExtMap) {
147 std::to_string(E.second.Major) +
"." + std::to_string(E.second.Minor);
151 unsigned XLen = IsRV64 ? 64 : 32;
153 outs() <<
"\nISA String: " << ISAString.get()->toString() <<
"\n";
157 return Ext.consume_front(
"experimental-");
169 "Already guarded by if-statement in ::parseArchString");
171 int Pos = Ext.size() - 1;
172 while (Pos > 0 &&
isDigit(Ext[Pos]))
174 if (Pos > 0 && Ext[Pos] ==
'p' &&
isDigit(Ext[Pos - 1])) {
176 while (Pos > 0 &&
isDigit(Ext[Pos]))
193static std::optional<RISCVISAUtils::ExtensionVersion>
197 for (
auto &ExtInfo : {
ArrayRef(SupportedExtensions),
198 ArrayRef(SupportedExperimentalExtensions)}) {
201 if (
I == ExtInfo.end() ||
I->Name != ExtName)
210 if (Ext.starts_with(
's'))
211 return "standard supervisor-level extension";
212 if (Ext.starts_with(
'x'))
213 return "non-standard user-level extension";
214 if (Ext.starts_with(
'z'))
215 return "standard user-level extension";
220 if (Ext.starts_with(
's'))
222 if (Ext.starts_with(
'x'))
224 if (Ext.starts_with(
'z'))
229static std::optional<RISCVISAUtils::ExtensionVersion>
233 if (
I == std::end(SupportedExperimentalExtensions) ||
I->Name != Ext)
243 IsExperimental ?
ArrayRef(SupportedExperimentalExtensions)
247 return I != ExtInfo.
end() &&
I->Name == Ext;
253 for (
auto ExtInfo : {
ArrayRef(SupportedExtensions),
254 ArrayRef(SupportedExperimentalExtensions)}) {
256 if (
I != ExtInfo.end() &&
I->Name == Ext)
264 unsigned MinorVersion) {
265 for (
auto ExtInfo : {
ArrayRef(SupportedExtensions),
266 ArrayRef(SupportedExperimentalExtensions)}) {
268 std::equal_range(ExtInfo.begin(), ExtInfo.end(), Ext, LessExtName());
270 if (
I->Version.Major == MajorVersion &&
I->Version.Minor == MinorVersion)
283 return Exts.count(Ext.str()) != 0;
287 bool IgnoreUnknown)
const {
288 std::vector<std::string> Features;
289 for (
const auto &[ExtName,
_] : Exts) {
299 Features.push_back((
llvm::Twine(
"+experimental-") + ExtName).str());
301 Features.push_back((
llvm::Twine(
"+") + ExtName).str());
304 if (AddAllExtensions) {
305 for (
const RISCVSupportedExtension &Ext : SupportedExtensions) {
306 if (Exts.count(Ext.Name))
308 Features.push_back((
llvm::Twine(
"-") + Ext.Name).str());
311 for (
const RISCVSupportedExtension &Ext : SupportedExperimentalExtensions) {
312 if (Exts.count(Ext.Name))
314 Features.push_back((
llvm::Twine(
"-experimental-") + Ext.Name).str());
325 if (ExtName.
size() == 1) {
326 return getError(
"unsupported standard user-level extension '" + ExtName +
339 unsigned &Minor,
unsigned &ConsumeLength,
340 bool EnableExperimentalExtension,
341 bool ExperimentalExtensionVersionCheck) {
346 MajorStr = In.take_while(
isDigit);
347 In = In.substr(MajorStr.
size());
349 if (!MajorStr.
empty() && In.consume_front(
"p")) {
350 MinorStr = In.take_while(
isDigit);
351 In = In.substr(MajorStr.
size() + MinorStr.
size() - 1);
354 if (MinorStr.
empty()) {
355 return getError(
"minor version number missing after 'p' for extension '" +
361 return getError(
"Failed to parse major version number for extension '" +
365 return getError(
"Failed to parse minor version number for extension '" +
368 ConsumeLength = MajorStr.
size();
370 if (!MinorStr.
empty())
371 ConsumeLength += MinorStr.
size() + 1 ;
376 if (Ext.size() > 1 && In.size())
378 "multi-character extensions must be separated by underscores");
382 if (!EnableExperimentalExtension)
383 return getError(
"requires '-menable-experimental-extensions' "
384 "for experimental extension '" +
387 if (ExperimentalExtensionVersionCheck &&
390 "experimental extension requires explicit version number `" + Ext +
393 auto SupportedVers = *ExperimentalExtension;
394 if (ExperimentalExtensionVersionCheck &&
395 (Major != SupportedVers.Major || Minor != SupportedVers.Minor)) {
396 std::string
Error =
"unsupported version number " + MajorStr.
str();
397 if (!MinorStr.
empty())
399 Error +=
" for experimental extension '" + Ext.str() +
400 "' (this compiler supports " + utostr(SupportedVers.Major) +
401 "." + utostr(SupportedVers.Minor) +
")";
414 Major = DefaultVersion->Major;
415 Minor = DefaultVersion->Minor;
428 std::string
Error =
"unsupported version number " + MajorStr.
str();
429 if (!MinorStr.
empty())
431 Error +=
" for extension '" + Ext.str() +
"'";
438 assert(XLen == 32 || XLen == 64);
439 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
441 ISAInfo->Exts = Exts;
443 return RISCVISAInfo::postProcessAndChecking(std::move(ISAInfo));
448 const std::vector<std::string> &Features) {
449 assert(XLen == 32 || XLen == 64);
450 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
453 assert(ExtName.size() > 1 && (ExtName[0] ==
'+' || ExtName[0] ==
'-'));
454 bool Add = ExtName[0] ==
'+';
455 ExtName = ExtName.drop_front(1);
457 auto ExtensionInfos = Experimental
458 ?
ArrayRef(SupportedExperimentalExtensions)
460 auto ExtensionInfoIterator =
465 if (ExtensionInfoIterator == ExtensionInfos.end() ||
466 ExtensionInfoIterator->Name != ExtName)
470 ISAInfo->Exts[ExtName.str()] = ExtensionInfoIterator->Version;
472 ISAInfo->Exts.erase(ExtName.str());
475 return RISCVISAInfo::postProcessAndChecking(std::move(ISAInfo));
483 return getError(
"string may only contain [a-z0-9_]");
492 if (XLen == 0 || Arch.
empty() || (Arch[0] !=
'i' && Arch[0] !=
'e'))
493 return getError(
"arch string must begin with valid base ISA");
495 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
500 while (!Arch.
empty()) {
501 if (Arch[0] ==
'_') {
502 if (Arch.
size() == 1 || Arch[1] ==
'_')
503 return getError(
"extension name missing after separator '_'");
512 std::tie(Prefix, MinorVersionStr) = Ext.rsplit(
'p');
513 if (MinorVersionStr.
empty())
514 return getError(
"extension lacks version in expected format");
515 unsigned MajorVersion, MinorVersion;
517 return getError(
"failed to parse minor version number");
521 size_t VersionStart = Prefix.size();
522 while (VersionStart != 0) {
523 if (!
isDigit(Prefix[VersionStart - 1]))
527 if (VersionStart == Prefix.size())
528 return getError(
"extension lacks version in expected format");
530 if (VersionStart == 0)
531 return getError(
"missing extension name");
533 StringRef ExtName = Prefix.slice(0, VersionStart);
534 StringRef MajorVersionStr = Prefix.substr(VersionStart);
536 return getError(
"failed to parse major version number");
538 if ((ExtName[0] ==
'z' || ExtName[0] ==
's' || ExtName[0] ==
'x') &&
541 "' must be followed by a letter");
548 return getError(
"duplicate extension '" + ExtName +
"'");
550 ISAInfo->updateImpliedLengths();
551 return std::move(ISAInfo);
556 bool ExperimentalExtensionVersionCheck) {
560 return getError(
"string may only contain [a-z0-9_]");
574 bool FoundProfile =
I != std::begin(SupportedProfiles) &&
578 FoundProfile = (
I != std::begin(SupportedExperimentalProfiles) &&
580 if (FoundProfile && !EnableExperimentalExtension) {
581 return getError(
"requires '-menable-experimental-extensions' "
583 std::prev(
I)->
Name +
"'");
588 std::string NewArch =
I->MArch.str();
590 if (!ArchWithoutProfile.
empty()) {
591 if (ArchWithoutProfile.
front() !=
'_')
592 return getError(
"additional extensions must be after separator '_'");
593 NewArch += ArchWithoutProfile.
str();
596 ExperimentalExtensionVersionCheck);
600 if (XLen == 0 || Arch.
empty())
602 "string must begin with rv32{i,e,g}, rv64{i,e,g}, or a supported "
605 std::unique_ptr<RISCVISAInfo> ISAInfo(
new RISCVISAInfo(XLen));
609 char Baseline = Arch.
front();
613 unsigned Major, Minor, ConsumeLength;
619 "\' should be 'e', 'i' or 'g'");
624 StringRef(&Baseline, 1), Arch, Major, Minor, ConsumeLength,
625 EnableExperimentalExtension, ExperimentalExtensionVersionCheck))
628 ISAInfo->Exts[std::string(1, Baseline)] = {Major, Minor};
633 return getError(
"version not supported for 'g'");
644 ISAInfo->Exts[std::string(Ext)] = {
Version->Major,
Version->Minor};
653 while (!Arch.
empty()) {
654 if (Arch.
front() ==
'_') {
655 if (Arch.
size() == 1 || Arch[1] ==
'_')
656 return getError(
"extension name missing after separator '_'");
667 Name = Ext.take_front(1);
668 Ext = Ext.drop_front();
670 Desc =
"standard user-level extension";
671 }
else if (Ext.front() ==
'z' || Ext.front() ==
's' ||
672 Ext.front() ==
'x') {
684 Name = Ext.substr(0, Pos);
685 Vers = Ext.substr(Pos);
692 return getError(
"invalid standard user-level extension '" +
693 Twine(Ext.front()) +
"'");
696 unsigned Major, Minor, ConsumeLength;
698 EnableExperimentalExtension,
699 ExperimentalExtensionVersionCheck))
702 if (
Name.size() == 1)
703 Ext = Ext.substr(ConsumeLength);
715 }
while (!Ext.empty());
720 if (Baseline ==
'g') {
722 if (ISAInfo->Exts.count(Ext))
727 ISAInfo->Exts[std::string(Ext)] = {
Version->Major,
Version->Minor};
731 return RISCVISAInfo::postProcessAndChecking(std::move(ISAInfo));
735 return getError(
"'" + Ext1 +
"' and '" + Ext2 +
736 "' extensions are incompatible");
740 return getError(
"'" + Ext +
"' requires '" + ReqExt +
741 "' extension to also be specified");
744Error RISCVISAInfo::checkDependency() {
745 bool HasE = Exts.count(
"e") != 0;
746 bool HasI = Exts.count(
"i") != 0;
747 bool HasC = Exts.count(
"c") != 0;
748 bool HasF = Exts.count(
"f") != 0;
749 bool HasD = Exts.count(
"d") != 0;
750 bool HasZfinx = Exts.count(
"zfinx") != 0;
751 bool HasVector = Exts.count(
"zve32x") != 0;
752 bool HasZvl = MinVLen != 0;
753 bool HasZcmp = Exts.count(
"zcmp") != 0;
754 bool HasXqccmp = Exts.count(
"xqccmp") != 0;
757 {
"xqcia"}, {
"xqciac"}, {
"xqcibi"}, {
"xqcibm"}, {
"xqcicli"},
758 {
"xqcicm"}, {
"xqcics"}, {
"xqcicsr"}, {
"xqciint"}, {
"xqciio"},
759 {
"xqcilb"}, {
"xqcili"}, {
"xqcilia"}, {
"xqcilo"}, {
"xqcilsm"},
760 {
"xqcisim"}, {
"xqcisls"}, {
"xqcisync"}};
762 {
"zcmt"}, {
"zcmp"}, {
"xqccmp"}, {
"xqciac"}, {
"xqcicm"}};
767 if (HasF && HasZfinx)
770 if (HasZvl && !HasVector)
773 if (HasD && (HasC || Exts.count(
"zcd")))
774 for (
auto Ext : ZcdOverlaps)
775 if (Exts.count(
Ext.str()))
777 Twine(
"'") + Ext +
"' extension is incompatible with '" +
778 (HasC ?
"c" :
"zcd") +
"' extension when 'd' extension is enabled");
780 if (XLen != 32 && Exts.count(
"zcf"))
781 return getError(
"'zcf' is only supported for 'rv32'");
783 if (Exts.count(
"xwchc") != 0) {
785 return getError(
"'xwchc' is only supported for 'rv32'");
790 if (Exts.count(
"zcb") != 0)
794 if (Exts.count(
"zclsd") != 0) {
796 return getError(
"'zclsd' is only supported for 'rv32'");
798 if (Exts.count(
"zcf") != 0)
802 if (XLen != 32 && Exts.count(
"zilsd") != 0)
803 return getError(
"'zilsd' is only supported for 'rv32'");
805 for (
auto Ext : XqciExts)
806 if (Exts.count(
Ext.str()) && (XLen != 32))
807 return getError(
"'" +
Twine(Ext) +
"'" +
" is only supported for 'rv32'");
809 if (HasZcmp && HasXqccmp)
832#define GET_IMPLIED_EXTENSIONS
833#include "llvm/TargetParser/RISCVTargetParserDef.inc"
835void RISCVISAInfo::updateImplication() {
841 for (
auto const &Ext : Exts)
844 while (!WorkList.
empty()) {
846 auto Range = std::equal_range(std::begin(ImpliedExts),
847 std::end(ImpliedExts), ExtName);
849 const char *ImpliedExt = Implied.ImpliedExt;
850 auto [It, Inserted] = Exts.try_emplace(ImpliedExt);
860 if (Exts.count(
"c") && Exts.count(
"d") && !Exts.count(
"zcd")) {
866 if (XLen == 32 && Exts.count(
"c") && Exts.count(
"f") && !Exts.count(
"zcf")) {
872 if (XLen == 32 && Exts.count(
"zce") && Exts.count(
"f") &&
873 !Exts.count(
"zcf")) {
880 bool HasE = Exts.count(
"e") != 0;
881 bool HasI = Exts.count(
"i") != 0;
885 if (!HasE && !HasI) {
895 {
"b"}, {
"zk"}, {
"zkn"}, {
"zks"}, {
"zvkn"},
896 {
"zvknc"}, {
"zvkng"}, {
"zvks"}, {
"zvksc"}, {
"zvksg"},
899void RISCVISAInfo::updateCombination() {
900 bool MadeChange =
false;
904 if (Exts.count(CombineExt.str()))
909 auto Range = std::equal_range(std::begin(ImpliedExts),
910 std::end(ImpliedExts), CombineExt);
911 bool HasAllRequiredFeatures = std::all_of(
913 return Exts.count(Implied.ImpliedExt);
915 if (HasAllRequiredFeatures) {
917 Exts[CombineExt.str()] = *
Version;
921 }
while (MadeChange);
924void RISCVISAInfo::updateImpliedLengths() {
925 assert(FLen == 0 && MaxELenFp == 0 && MaxELen == 0 && MinVLen == 0 &&
926 "Expected lengths to be initialied to zero");
930 else if (Exts.count(
"d"))
932 else if (Exts.count(
"f"))
935 if (Exts.count(
"v")) {
936 MaxELenFp = std::max(MaxELenFp, 64u);
937 MaxELen = std::max(MaxELen, 64u);
940 for (
auto const &Ext : Exts) {
949 MaxELenFp = std::max(MaxELenFp, 32u);
950 else if (ExtName ==
"d")
951 MaxELenFp = std::max(MaxELenFp, 64u);
952 else if (ExtName !=
"x")
955 MaxELen = std::max(MaxELen, ZveELen);
968 MinVLen = std::max(MinVLen, ZvlLen);
978 Arch <<
"rv" << XLen;
980 ListSeparator LS(
"_");
981 for (
auto const &Ext : Exts) {
983 auto ExtInfo = Ext.second;
984 Arch << LS << ExtName;
985 Arch << ExtInfo.Major <<
"p" << ExtInfo.Minor;
992RISCVISAInfo::postProcessAndChecking(std::unique_ptr<RISCVISAInfo> &&ISAInfo) {
993 ISAInfo->updateImplication();
994 ISAInfo->updateCombination();
995 ISAInfo->updateImpliedLengths();
997 if (
Error Result = ISAInfo->checkDependency())
998 return std::move(Result);
999 return std::move(ISAInfo);
1004 if (Exts.count(
"e"))
1006 if (Exts.count(
"d"))
1008 if (Exts.count(
"f"))
1011 }
else if (XLen == 64) {
1012 if (Exts.count(
"e"))
1014 if (Exts.count(
"d"))
1016 if (Exts.count(
"f"))
1033 unsigned Major, Minor, ConsumeLength;
1045 return std::string();
1051 return std::string();
1054 return std::string();
1072#define GET_RISCVExtensionBitmaskTable_IMPL
1073#include "llvm/TargetParser/RISCVTargetParserDef.inc"
1079 for (
auto E : ExtensionBitmask)
1080 if (Ext.equals_insensitive(E.Name))
1081 return std::make_pair(E.GroupID, E.BitPosition);
1082 return std::make_pair(-1, -1);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
static void verifyTables()
static StringRef getExtensionTypeDesc(StringRef Ext)
static const char * RISCVGImplicationsZi[]
static std::optional< RISCVISAUtils::ExtensionVersion > findDefaultVersion(StringRef ExtName)
static size_t findLastNonVersionCharacter(StringRef Ext)
static Error getExtensionRequiresError(StringRef Ext, StringRef ReqExt)
static StringRef getExtensionType(StringRef Ext)
static Error getErrorForInvalidExt(StringRef ExtName)
static constexpr StringLiteral CombineIntoExts[]
static bool stripExperimentalPrefix(StringRef &Ext)
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 Error getIncompatibleError(StringRef Ext1, StringRef Ext2)
static Error getError(const Twine &Message)
static const char * RISCVGImplications[]
static bool isDigit(const char C)
static bool isLower(const char C)
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.
static LLVM_ABI bool isSupportedExtensionFeature(StringRef Ext)
static LLVM_ABI std::string getTargetFeatureForExtension(StringRef Ext)
static LLVM_ABI 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...
LLVM_ABI bool hasExtension(StringRef Ext) const
LLVM_ABI std::string toString() const
LLVM_ABI StringRef computeDefaultABI() const
static LLVM_ABI llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseArchString(StringRef Arch, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck=true)
Parse RISC-V ISA info from arch string.
static LLVM_ABI bool isSupportedExtension(StringRef Ext)
static LLVM_ABI void printEnabledExtensions(bool IsRV64, std::set< StringRef > &EnabledFeatureNames, StringMap< StringRef > &DescMap)
static LLVM_ABI void printSupportedExtensions(StringMap< StringRef > &DescMap)
static LLVM_ABI llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseFeatures(unsigned XLen, const std::vector< std::string > &Features)
Parse RISC-V ISA info from feature vector.
static LLVM_ABI std::pair< int, int > getRISCVFeaturesBitsInfo(StringRef Ext)
Return the group id and bit position of __riscv_feature_bits.
static LLVM_ABI llvm::Expected< std::unique_ptr< RISCVISAInfo > > createFromExtMap(unsigned XLen, const RISCVISAUtils::OrderedExtensionMap &Exts)
LLVM_ABI std::vector< std::string > toFeatures(bool AddAllExtensions=false, bool IgnoreUnknown=true) const
Convert RISC-V ISA info to a feature vector.
static LLVM_ABI bool isSupportedExtensionWithVersion(StringRef Ext)
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...
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.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
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.
LLVM_ABI raw_fd_ostream & outs()
This returns a reference to a raw_fd_ostream for standard output.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
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...
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.