[PATCH] D78308: [NFC][PowerPC] Refactor ppcUserFeaturesCheck()
Lei Huang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 16 15:04:51 PDT 2020
lei updated this revision to Diff 258175.
lei added a comment.
updated.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78308/new/
https://reviews.llvm.org/D78308
Files:
clang/lib/Basic/Targets/PPC.cpp
Index: clang/lib/Basic/Targets/PPC.cpp
===================================================================
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -228,33 +228,23 @@
static bool ppcUserFeaturesCheck(DiagnosticsEngine &Diags,
const std::vector<std::string> &FeaturesVec) {
- if (llvm::find(FeaturesVec, "-vsx") != FeaturesVec.end()) {
- if (llvm::find(FeaturesVec, "+power8-vector") != FeaturesVec.end()) {
- Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower8-vector"
- << "-mno-vsx";
- return false;
- }
+ if (llvm::find(FeaturesVec, "-vsx") == FeaturesVec.end())
+ return true;
- if (llvm::find(FeaturesVec, "+direct-move") != FeaturesVec.end()) {
- Diags.Report(diag::err_opt_not_valid_with_opt) << "-mdirect-move"
- << "-mno-vsx";
+ auto CheckVSXSubfeature = [&](StringRef Feature, StringRef Option) {
+ if (llvm::find(FeaturesVec, Feature) != FeaturesVec.end()) {
+ Diags.Report(diag::err_opt_not_valid_with_opt) << Option << "-mno-vsx";
return false;
}
+ return true;
+ };
- if (llvm::find(FeaturesVec, "+float128") != FeaturesVec.end()) {
- Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfloat128"
- << "-mno-vsx";
- return false;
- }
+ bool Passed = CheckVSXSubfeature("+power8-vector", "-mpower8-vector");
+ Passed |= CheckVSXSubfeature("+direct-move", "-mdirect-move");
+ Passed |= CheckVSXSubfeature("+float128", "-mfloat128");
+ Passed |= CheckVSXSubfeature("+power9-vector", "-mpower9-vector");
- if (llvm::find(FeaturesVec, "+power9-vector") != FeaturesVec.end()) {
- Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower9-vector"
- << "-mno-vsx";
- return false;
- }
- }
-
- return true;
+ return Passed;
}
bool PPCTargetInfo::initFeatureMap(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78308.258175.patch
Type: text/x-patch
Size: 2060 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200416/536adff6/attachment-0001.bin>
More information about the cfe-commits
mailing list