.Default(Target.hasFeature(Feature) ||
isPlatformEnvironment(Target, Feature));
if (!HasFeature)
- HasFeature = std::find(LangOpts.ModuleFeatures.begin(),
- LangOpts.ModuleFeatures.end(),
- Feature) != LangOpts.ModuleFeatures.end();
+ HasFeature = llvm::is_contained(LangOpts.ModuleFeatures, Feature);
return HasFeature;
}
WavefrontSize = 64;
bool IsOn = F.front() == '+';
StringRef Name = StringRef(F).drop_front();
- if (llvm::find(TargetIDFeatures, Name) == TargetIDFeatures.end())
+ if (!llvm::is_contained(TargetIDFeatures, Name))
return;
assert(OffloadArchFeatures.find(Name) == OffloadArchFeatures.end());
OffloadArchFeatures[Name] = IsOn;
"avrxmega6", "avrxmega7", "avrtiny"};
bool AVRTargetInfo::isValidCPUName(StringRef Name) const {
- bool IsFamily =
- llvm::find(ValidFamilyNames, Name) != std::end(ValidFamilyNames);
+ bool IsFamily = llvm::is_contained(ValidFamilyNames, Name);
bool IsMCU =
llvm::find_if(AVRMcus, [&](const MCUInfo &Info) {
"v3", "probe"};
bool BPFTargetInfo::isValidCPUName(StringRef Name) const {
- return llvm::find(ValidCPUNames, Name) != std::end(ValidCPUNames);
+ return llvm::is_contained(ValidCPUNames, Name);
}
void BPFTargetInfo::fillValidCPUList(SmallVectorImpl<StringRef> &Values) const {
{"octeon"}, {"octeon+"}, {"p5600"}};
bool MipsTargetInfo::isValidCPUName(StringRef Name) const {
- return llvm::find(ValidCPUNames, Name) != std::end(ValidCPUNames);
+ return llvm::is_contained(ValidCPUNames, Name);
}
void MipsTargetInfo::fillValidCPUList(
const std::vector<std::string> &FeaturesVec) {
// vsx was not explicitly turned off.
- if (llvm::find(FeaturesVec, "-vsx") == FeaturesVec.end())
+ if (!llvm::is_contained(FeaturesVec, "-vsx"))
return true;
auto FindVSXSubfeature = [&](StringRef Feature, StringRef Option) {
- if (llvm::find(FeaturesVec, Feature) != FeaturesVec.end()) {
+ if (llvm::is_contained(FeaturesVec, Feature)) {
Diags.Report(diag::err_opt_not_valid_with_opt) << Option << "-mno-vsx";
return true;
}
return false;
if (!(ArchDefs & ArchDefinePwr9) && (ArchDefs & ArchDefinePpcgr) &&
- llvm::find(FeaturesVec, "+float128") != FeaturesVec.end()) {
+ llvm::is_contained(FeaturesVec, "+float128")) {
// We have __float128 on PPC but not power 9 and above.
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfloat128" << CPU;
return false;
}
if (!(ArchDefs & ArchDefinePwr10) &&
- llvm::find(FeaturesVec, "+mma") != FeaturesVec.end()) {
+ llvm::is_contained(FeaturesVec, "+mma")) {
// We have MMA on PPC but not power 10 and above.
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mmma" << CPU;
return false;
}
if (!(ArchDefs & ArchDefinePwr8) &&
- llvm::find(FeaturesVec, "+rop-protect") != FeaturesVec.end()) {
+ llvm::is_contained(FeaturesVec, "+rop-protect")) {
// We can turn on ROP Protect on Power 8 and above.
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mrop-protect" << CPU;
return false;
}
if (!(ArchDefs & ArchDefinePwr8) &&
- llvm::find(FeaturesVec, "+privileged") != FeaturesVec.end()) {
+ llvm::is_contained(FeaturesVec, "+privileged")) {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mprivileged" << CPU;
return false;
}
{"powerpc64le"}, {"ppc64le"}, {"future"}};
bool PPCTargetInfo::isValidCPUName(StringRef Name) const {
- return llvm::find(ValidCPUNames, Name) != std::end(ValidCPUNames);
+ return llvm::is_contained(ValidCPUNames, Name);
}
void PPCTargetInfo::fillValidCPUList(SmallVectorImpl<StringRef> &Values) const {
bool handleTargetFeatures(std::vector<std::string> &Features,
DiagnosticsEngine &Diags) override {
// Check if software floating point is enabled
- auto Feature = llvm::find(Features, "+soft-float");
- if (Feature != Features.end()) {
+ if (llvm::is_contained(Features, "+soft-float"))
SoftFloat = true;
- }
return true;
}
void getTargetDefines(const LangOptions &Opts,
}
bool WebAssemblyTargetInfo::isValidCPUName(StringRef Name) const {
- return llvm::find(ValidCPUNames, Name) != std::end(ValidCPUNames);
+ return llvm::is_contained(ValidCPUNames, Name);
}
void WebAssemblyTargetInfo::fillValidCPUList(
// Enable popcnt if sse4.2 is enabled and popcnt is not explicitly disabled.
auto I = Features.find("sse4.2");
if (I != Features.end() && I->getValue() &&
- llvm::find(UpdatedFeaturesVec, "-popcnt") == UpdatedFeaturesVec.end())
+ !llvm::is_contained(UpdatedFeaturesVec, "-popcnt"))
Features["popcnt"] = true;
// Additionally, if SSE is enabled and mmx is not explicitly disabled,
// then enable MMX.
I = Features.find("sse");
if (I != Features.end() && I->getValue() &&
- llvm::find(UpdatedFeaturesVec, "-mmx") == UpdatedFeaturesVec.end())
+ !llvm::is_contained(UpdatedFeaturesVec, "-mmx"))
Features["mmx"] = true;
// Enable xsave if avx is enabled and xsave is not explicitly disabled.
I = Features.find("avx");
if (I != Features.end() && I->getValue() &&
- llvm::find(UpdatedFeaturesVec, "-xsave") == UpdatedFeaturesVec.end())
+ !llvm::is_contained(UpdatedFeaturesVec, "-xsave"))
Features["xsave"] = true;
// Enable CRC32 if SSE4.2 is enabled and CRC32 is not explicitly disabled.
I = Features.find("sse4.2");
if (I != Features.end() && I->getValue() &&
- llvm::find(UpdatedFeaturesVec, "-crc32") == UpdatedFeaturesVec.end())
+ !llvm::is_contained(UpdatedFeaturesVec, "-crc32"))
Features["crc32"] = true;
return true;