Lines Matching refs:Ext
157 static bool stripExperimentalPrefix(StringRef &Ext) { in stripExperimentalPrefix() argument
158 return Ext.consume_front("experimental-"); in stripExperimentalPrefix()
168 static size_t findLastNonVersionCharacter(StringRef Ext) { in findLastNonVersionCharacter() argument
169 assert(!Ext.empty() && in findLastNonVersionCharacter()
172 int Pos = Ext.size() - 1; in findLastNonVersionCharacter()
173 while (Pos > 0 && isDigit(Ext[Pos])) in findLastNonVersionCharacter()
175 if (Pos > 0 && Ext[Pos] == 'p' && isDigit(Ext[Pos - 1])) { in findLastNonVersionCharacter()
177 while (Pos > 0 && isDigit(Ext[Pos])) in findLastNonVersionCharacter()
210 static StringRef getExtensionTypeDesc(StringRef Ext) { in getExtensionTypeDesc() argument
211 if (Ext.starts_with('s')) in getExtensionTypeDesc()
213 if (Ext.starts_with('x')) in getExtensionTypeDesc()
215 if (Ext.starts_with('z')) in getExtensionTypeDesc()
220 static StringRef getExtensionType(StringRef Ext) { in getExtensionType() argument
221 if (Ext.starts_with('s')) in getExtensionType()
223 if (Ext.starts_with('x')) in getExtensionType()
225 if (Ext.starts_with('z')) in getExtensionType()
231 isExperimentalExtension(StringRef Ext) { in isExperimentalExtension() argument
233 llvm::lower_bound(SupportedExperimentalExtensions, Ext, LessExtName()); in isExperimentalExtension()
234 if (I == std::end(SupportedExperimentalExtensions) || I->Name != Ext) in isExperimentalExtension()
240 bool RISCVISAInfo::isSupportedExtensionFeature(StringRef Ext) { in isSupportedExtensionFeature() argument
241 bool IsExperimental = stripExperimentalPrefix(Ext); in isSupportedExtensionFeature()
247 auto I = llvm::lower_bound(ExtInfo, Ext, LessExtName()); in isSupportedExtensionFeature()
248 return I != ExtInfo.end() && I->Name == Ext; in isSupportedExtensionFeature()
251 bool RISCVISAInfo::isSupportedExtension(StringRef Ext) { in isSupportedExtension() argument
256 auto I = llvm::lower_bound(ExtInfo, Ext, LessExtName()); in isSupportedExtension()
257 if (I != ExtInfo.end() && I->Name == Ext) in isSupportedExtension()
264 bool RISCVISAInfo::isSupportedExtension(StringRef Ext, unsigned MajorVersion, in isSupportedExtension() argument
269 std::equal_range(ExtInfo.begin(), ExtInfo.end(), Ext, LessExtName()); in isSupportedExtension()
278 bool RISCVISAInfo::hasExtension(StringRef Ext) const { in hasExtension()
279 stripExperimentalPrefix(Ext); in hasExtension()
281 if (!isSupportedExtension(Ext)) in hasExtension()
284 return Exts.count(Ext.str()) != 0; in hasExtension()
306 for (const RISCVSupportedExtension &Ext : SupportedExtensions) { in toFeatures() local
307 if (Exts.count(Ext.Name)) in toFeatures()
309 Features.push_back((llvm::Twine("-") + Ext.Name).str()); in toFeatures()
312 for (const RISCVSupportedExtension &Ext : SupportedExperimentalExtensions) { in toFeatures() local
313 if (Exts.count(Ext.Name)) in toFeatures()
315 Features.push_back((llvm::Twine("-experimental-") + Ext.Name).str()); in toFeatures()
339 static Error getExtensionVersion(StringRef Ext, StringRef In, unsigned &Major, in getExtensionVersion() argument
357 Ext + "'"); in getExtensionVersion()
363 Ext + "'"); in getExtensionVersion()
367 Ext + "'"); in getExtensionVersion()
377 if (Ext.size() > 1 && In.size()) in getExtensionVersion()
382 if (auto ExperimentalExtension = isExperimentalExtension(Ext)) { in getExtensionVersion()
386 Ext + "'"); in getExtensionVersion()
391 "experimental extension requires explicit version number `" + Ext + in getExtensionVersion()
400 Error += " for experimental extension '" + Ext.str() + in getExtensionVersion()
410 if (Ext == "g") in getExtensionVersion()
414 if (auto DefaultVersion = findDefaultVersion(Ext)) { in getExtensionVersion()
423 if (RISCVISAInfo::isSupportedExtension(Ext, Major, Minor)) in getExtensionVersion()
426 if (!RISCVISAInfo::isSupportedExtension(Ext)) in getExtensionVersion()
427 return getErrorForInvalidExt(Ext); in getExtensionVersion()
432 Error += " for extension '" + Ext.str() + "'"; in getExtensionVersion()
510 StringRef Ext = Arch.slice(0, Idx); in parseNormalizedArchString() local
514 std::tie(Prefix, MinorVersionStr) = Ext.rsplit('p'); in parseNormalizedArchString()
643 for (const char *Ext : RISCVGImplications) { in parseArchString() local
644 auto Version = findDefaultVersion(Ext); in parseArchString()
647 ISAInfo->Exts[std::string(Ext)] = {Version->Major, Version->Minor}; in parseArchString()
664 StringRef Ext = Arch.slice(0, Idx); in parseArchString() local
669 if (RISCVISAUtils::AllStdExts.contains(Ext.front())) { in parseArchString()
670 Name = Ext.take_front(1); in parseArchString()
671 Ext = Ext.drop_front(); in parseArchString()
672 Vers = Ext; in parseArchString()
674 } else if (Ext.front() == 'z' || Ext.front() == 's' || in parseArchString()
675 Ext.front() == 'x') { in parseArchString()
684 StringRef Type = getExtensionType(Ext); in parseArchString()
685 Desc = getExtensionTypeDesc(Ext); in parseArchString()
686 auto Pos = findLastNonVersionCharacter(Ext) + 1; in parseArchString()
687 Name = Ext.substr(0, Pos); in parseArchString()
688 Vers = Ext.substr(Pos); in parseArchString()
689 Ext = StringRef(); in parseArchString()
696 Twine(Ext.front()) + "'"); in parseArchString()
706 Ext = Ext.substr(ConsumeLength); in parseArchString()
718 } while (!Ext.empty()); in parseArchString()
833 for (auto const &Ext : Exts) in updateImplication() local
834 WorkList.push_back(Ext.first); in updateImplication()
904 for (auto const &Ext : Exts) { in updateImpliedLengths() local
905 StringRef ExtName = Ext.first; in updateImpliedLengths()
945 for (auto const &Ext : Exts) { in toString() local
946 StringRef ExtName = Ext.first; in toString()
947 auto ExtInfo = Ext.second; in toString()
987 bool RISCVISAInfo::isSupportedExtensionWithVersion(StringRef Ext) { in isSupportedExtensionWithVersion() argument
988 if (Ext.empty()) in isSupportedExtensionWithVersion()
991 auto Pos = findLastNonVersionCharacter(Ext) + 1; in isSupportedExtensionWithVersion()
992 StringRef Name = Ext.substr(0, Pos); in isSupportedExtensionWithVersion()
993 StringRef Vers = Ext.substr(Pos); in isSupportedExtensionWithVersion()
1007 std::string RISCVISAInfo::getTargetFeatureForExtension(StringRef Ext) { in getTargetFeatureForExtension() argument
1008 if (Ext.empty()) in getTargetFeatureForExtension()
1011 auto Pos = findLastNonVersionCharacter(Ext) + 1; in getTargetFeatureForExtension()
1012 StringRef Name = Ext.substr(0, Pos); in getTargetFeatureForExtension()
1014 if (Pos != Ext.size() && !isSupportedExtensionWithVersion(Ext)) in getTargetFeatureForExtension()