@@ -171,11 +171,6 @@ findDefaultVersion(StringRef ExtName) {
171
171
return std::nullopt;
172
172
}
173
173
174
- bool RISCVISAInfo::addExtension (StringRef ExtName,
175
- RISCVISAUtils::ExtensionVersion Version) {
176
- return Exts.emplace (ExtName, Version).second ;
177
- }
178
-
179
174
static StringRef getExtensionTypeDesc (StringRef Ext) {
180
175
if (Ext.starts_with (' s' ))
181
176
return " standard supervisor-level extension" ;
@@ -431,7 +426,7 @@ RISCVISAInfo::parseFeatures(unsigned XLen,
431
426
continue ;
432
427
433
428
if (Add)
434
- ISAInfo->addExtension ( ExtName, ExtensionInfoIterator->Version ) ;
429
+ ISAInfo->Exts [ ExtName. str ()] = ExtensionInfoIterator->Version ;
435
430
else
436
431
ISAInfo->Exts .erase (ExtName.str ());
437
432
}
@@ -513,7 +508,11 @@ RISCVISAInfo::parseNormalizedArchString(StringRef Arch) {
513
508
" '" + Twine (ExtName[0 ]) +
514
509
" ' must be followed by a letter" );
515
510
516
- if (!ISAInfo->addExtension (ExtName, {MajorVersion, MinorVersion}))
511
+ if (!ISAInfo->Exts
512
+ .emplace (
513
+ ExtName.str (),
514
+ RISCVISAUtils::ExtensionVersion{MajorVersion, MinorVersion})
515
+ .second )
517
516
return createStringError (errc::invalid_argument,
518
517
" duplicate extension '" + ExtName + " '" );
519
518
}
@@ -722,11 +721,10 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
722
721
// Check all Extensions are supported.
723
722
for (auto &SeenExtAndVers : SeenExtMap) {
724
723
const std::string &ExtName = SeenExtAndVers.first ;
725
- RISCVISAUtils::ExtensionVersion ExtVers = SeenExtAndVers.second ;
726
724
727
725
if (!RISCVISAInfo::isSupportedExtension (ExtName))
728
726
return getStringErrorForInvalidExt (ExtName);
729
- ISAInfo->addExtension ( ExtName, ExtVers) ;
727
+ ISAInfo->Exts [ ExtName] = SeenExtAndVers. second ;
730
728
}
731
729
732
730
return RISCVISAInfo::postProcessAndChecking (std::move (ISAInfo));
@@ -830,7 +828,7 @@ void RISCVISAInfo::updateImplication() {
830
828
// implied
831
829
if (!HasE && !HasI) {
832
830
auto Version = findDefaultVersion (" i" );
833
- addExtension ( " i" , *Version) ;
831
+ Exts[ " i" ] = *Version;
834
832
}
835
833
836
834
if (HasE && HasI)
@@ -854,7 +852,7 @@ void RISCVISAInfo::updateImplication() {
854
852
if (Exts.count (ImpliedExt))
855
853
return ;
856
854
auto Version = findDefaultVersion (ImpliedExt);
857
- addExtension ( ImpliedExt, *Version) ;
855
+ Exts[ ImpliedExt] = *Version;
858
856
WorkList.push_back (ImpliedExt);
859
857
});
860
858
}
@@ -863,7 +861,7 @@ void RISCVISAInfo::updateImplication() {
863
861
if (XLen == 32 && Exts.count (" zce" ) && Exts.count (" f" ) &&
864
862
!Exts.count (" zcf" )) {
865
863
auto Version = findDefaultVersion (" zcf" );
866
- addExtension ( " zcf" , *Version) ;
864
+ Exts[ " zcf" ] = *Version;
867
865
}
868
866
}
869
867
@@ -890,7 +888,7 @@ void RISCVISAInfo::updateCombination() {
890
888
});
891
889
if (HasAllRequiredFeatures) {
892
890
auto Version = findDefaultVersion (CombineExt);
893
- addExtension ( CombineExt, *Version) ;
891
+ Exts[ CombineExt. str ()] = *Version;
894
892
MadeChange = true ;
895
893
}
896
894
}
0 commit comments