Skip to content

Commit 7aa906d

Browse files
committed
[RISCV] Merge the Arch and Exts variables in RISCVISAInfo::parseArchString. NFC
1 parent bbd52dd commit 7aa906d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

llvm/lib/TargetParser/RISCVISAInfo.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
561561
// Ref: Table 22.1 in RISC-V User-Level ISA V2.2
562562
char Baseline = Arch.front();
563563
// Skip the baseline.
564-
StringRef Exts = Arch.drop_front();
564+
Arch = Arch.drop_front();
565565

566566
unsigned Major, Minor, ConsumeLength;
567567

@@ -574,15 +574,15 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
574574
case 'i':
575575
// Baseline is `i` or `e`
576576
if (auto E = getExtensionVersion(
577-
StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
577+
StringRef(&Baseline, 1), Arch, Major, Minor, ConsumeLength,
578578
EnableExperimentalExtension, ExperimentalExtensionVersionCheck))
579579
return std::move(E);
580580

581581
ISAInfo->Exts[std::string(1, Baseline)] = {Major, Minor};
582582
break;
583583
case 'g':
584584
// g expands to extensions in RISCVGImplications.
585-
if (Arch.size() > 1 && isDigit(Arch[1]))
585+
if (!Arch.empty() && isDigit(Arch.front()))
586586
return getError("version not supported for 'g'");
587587

588588
// Versions for g are disallowed, and this was checked for previously.
@@ -602,18 +602,18 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
602602

603603
// Consume the base ISA version number and any '_' between rvxxx and the
604604
// first extension
605-
Exts = Exts.drop_front(ConsumeLength);
605+
Arch = Arch.drop_front(ConsumeLength);
606606

607-
while (!Exts.empty()) {
608-
if (Exts.front() == '_') {
609-
if (Exts.size() == 1 || Exts[1] == '_')
607+
while (!Arch.empty()) {
608+
if (Arch.front() == '_') {
609+
if (Arch.size() == 1 || Arch[1] == '_')
610610
return getError("extension name missing after separator '_'");
611-
Exts = Exts.drop_front();
611+
Arch = Arch.drop_front();
612612
}
613613

614-
size_t Idx = Exts.find('_');
615-
StringRef Ext = Exts.slice(0, Idx);
616-
Exts = Exts.slice(Idx, StringRef::npos);
614+
size_t Idx = Arch.find('_');
615+
StringRef Ext = Arch.slice(0, Idx);
616+
Arch = Arch.slice(Idx, StringRef::npos);
617617

618618
do {
619619
StringRef Name, Vers, Desc;

0 commit comments

Comments
 (0)