================
@@ -388,6 +388,76 @@ bool LoongArchTargetInfo::handleTargetFeatures(
return true;
}
+enum class AttrFeatureKind { Arch, Tune, NoFeature, Feature, Invalid };
+
+static std::pair<AttrFeatureKind, llvm::StringRef>
+getAttrFeatureTypeAndValue(llvm::StringRef AttrFeature) {
+ if (auto Split = AttrFeature.split("="); !Split.second.empty()) {
+ if (Split.first.trim() == "arch")
+ return {AttrFeatureKind::Arch, Split.second.trim()};
+ if (Split.first.trim() == "tune")
+ return {AttrFeatureKind::Tune, Split.second.trim()};
+ }
+ if (AttrFeature.starts_with("no-"))
+ return {AttrFeatureKind::NoFeature, AttrFeature.drop_front(3)};
+ return {AttrFeatureKind::Feature, AttrFeature};
----------------
Ami-zhang wrote:
Appreciate the review suggestion. The validation will be handled in
isValidFeatureName(), with corresponding test cases added.Thanks!
https://github.com/llvm/llvm-project/pull/140700
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits