}
virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
- const std::string &Name,
+ StringRef Name,
bool Enabled) const;
};
}
bool PTXTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
- const std::string &Name,
+ StringRef Name,
bool Enabled) const {
if(std::binary_search(AvailableFeatures.begin(), AvailableFeatures.end(),
Name)) {
virtual void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const;
virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
- const std::string &Name,
+ StringRef Name,
bool Enabled) const;
virtual void getDefaultFeatures(llvm::StringMap<bool> &Features) const;
virtual bool hasFeature(StringRef Feature) const;
}
bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
- const std::string &Name,
+ StringRef Name,
bool Enabled) const {
// FIXME: This *really* should not be here. We need some way of translating
// options into llvm subtarget features.
if (Features[i][0] == '-')
continue;
- if (Features[i].substr(1) == "aes") {
+ StringRef Feature = StringRef(Features[i]).substr(1);
+
+ if (Feature == "aes") {
HasAES = true;
continue;
}
- if (Features[i].substr(1) == "lzcnt") {
+ if (Feature == "lzcnt") {
HasLZCNT = true;
continue;
}
- if (Features[i].substr(1) == "bmi") {
+ if (Feature == "bmi") {
HasBMI = true;
continue;
}
- if (Features[i].substr(1) == "bmi2") {
+ if (Feature == "bmi2") {
HasBMI2 = true;
continue;
}
- if (Features[i].substr(1) == "popcnt") {
+ if (Feature == "popcnt") {
HasPOPCNT = true;
continue;
}
- if (Features[i].substr(1) == "fma4") {
+ if (Feature == "fma4") {
HasFMA4 = true;
continue;
}
assert(Features[i][0] == '+' && "Invalid target feature!");
- X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Features[i].substr(1))
+ X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Feature)
.Case("avx2", AVX2)
.Case("avx", AVX)
.Case("sse42", SSE42)
SSELevel = std::max(SSELevel, Level);
MMX3DNowEnum ThreeDNowLevel =
- llvm::StringSwitch<MMX3DNowEnum>(Features[i].substr(1))
+ llvm::StringSwitch<MMX3DNowEnum>(Feature)
.Case("3dnowa", AMD3DNowAthlon)
.Case("3dnow", AMD3DNow)
.Case("mmx", MMX)
}
virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
- const std::string &Name,
+ StringRef Name,
bool Enabled) const {
if (Name == "soft-float" || Name == "soft-float-abi" ||
Name == "vfp2" || Name == "vfp3" || Name == "neon" || Name == "d16") {
"i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32";
}
virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
- const std::string &Name,
+ StringRef Name,
bool Enabled) const {
if (Name == "soft-float")
Features[Name] = Enabled;
Opts.Features.clear();
for (llvm::StringMap<bool>::const_iterator it = Features.begin(),
ie = Features.end(); it != ie; ++it)
- Opts.Features.push_back(std::string(it->second ? "+" : "-") +
- it->first().str());
+ Opts.Features.push_back((it->second ? "+" : "-") + it->first().str());
Target->HandleTargetFeatures(Opts.Features);
return Target.take();