forked from OSchip/llvm-project
Convert a bunch of loops to ranged-for and clean up accordingly.
llvm-svn: 246027
This commit is contained in:
parent
8dec46cf5a
commit
610fe11ad1
|
@ -1023,53 +1023,24 @@ const Builtin::Info PPCTargetInfo::BuiltinInfo[] = {
|
||||||
/// configured set of features.
|
/// configured set of features.
|
||||||
bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
|
bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
|
||||||
DiagnosticsEngine &Diags) {
|
DiagnosticsEngine &Diags) {
|
||||||
for (unsigned i = 0, e = Features.size(); i !=e; ++i) {
|
for (const auto &Feature : Features) {
|
||||||
// Ignore disabled features.
|
if (Feature == "+vsx") {
|
||||||
if (Features[i][0] == '-')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
StringRef Feature = StringRef(Features[i]).substr(1);
|
|
||||||
|
|
||||||
if (Feature == "vsx") {
|
|
||||||
HasVSX = true;
|
HasVSX = true;
|
||||||
continue;
|
} else if (Feature == "+bpermd") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "bpermd") {
|
|
||||||
HasBPERMD = true;
|
HasBPERMD = true;
|
||||||
continue;
|
} else if (Feature == "+extdiv") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "extdiv") {
|
|
||||||
HasExtDiv = true;
|
HasExtDiv = true;
|
||||||
continue;
|
} else if (Feature == "+power8-vector") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "power8-vector") {
|
|
||||||
HasP8Vector = true;
|
HasP8Vector = true;
|
||||||
continue;
|
} else if (Feature == "+crypto") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "crypto") {
|
|
||||||
HasP8Crypto = true;
|
HasP8Crypto = true;
|
||||||
continue;
|
} else if (Feature == "+direct-move") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "direct-move") {
|
|
||||||
HasDirectMove = true;
|
HasDirectMove = true;
|
||||||
continue;
|
} else if (Feature == "+qpx") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "qpx") {
|
|
||||||
HasQPX = true;
|
HasQPX = true;
|
||||||
continue;
|
} else if (Feature == "+htm") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "htm") {
|
|
||||||
HasHTM = true;
|
HasHTM = true;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Finish this list and add an assert that we've handled them
|
// TODO: Finish this list and add an assert that we've handled them
|
||||||
// all.
|
// all.
|
||||||
}
|
}
|
||||||
|
@ -2886,155 +2857,84 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
|
||||||
/// configured set of features.
|
/// configured set of features.
|
||||||
bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
|
bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
|
||||||
DiagnosticsEngine &Diags) {
|
DiagnosticsEngine &Diags) {
|
||||||
// Remember the maximum enabled sselevel.
|
for (const auto &Feature : Features) {
|
||||||
for (unsigned i = 0, e = Features.size(); i !=e; ++i) {
|
if (Feature[0] != '+')
|
||||||
// Ignore disabled features.
|
|
||||||
if (Features[i][0] == '-')
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
StringRef Feature = StringRef(Features[i]).substr(1);
|
if (Feature == "+aes") {
|
||||||
|
|
||||||
if (Feature == "aes") {
|
|
||||||
HasAES = true;
|
HasAES = true;
|
||||||
continue;
|
} else if (Feature == "+pclmul") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "pclmul") {
|
|
||||||
HasPCLMUL = true;
|
HasPCLMUL = true;
|
||||||
continue;
|
} else if (Feature == "+lzcnt") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "lzcnt") {
|
|
||||||
HasLZCNT = true;
|
HasLZCNT = true;
|
||||||
continue;
|
} else if (Feature == "+rdrnd") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "rdrnd") {
|
|
||||||
HasRDRND = true;
|
HasRDRND = true;
|
||||||
continue;
|
} else if (Feature == "+fsgsbase") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "fsgsbase") {
|
|
||||||
HasFSGSBASE = true;
|
HasFSGSBASE = true;
|
||||||
continue;
|
} else if (Feature == "+bmi") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "bmi") {
|
|
||||||
HasBMI = true;
|
HasBMI = true;
|
||||||
continue;
|
} else if (Feature == "+bmi2") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "bmi2") {
|
|
||||||
HasBMI2 = true;
|
HasBMI2 = true;
|
||||||
continue;
|
} else if (Feature == "+popcnt") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "popcnt") {
|
|
||||||
HasPOPCNT = true;
|
HasPOPCNT = true;
|
||||||
continue;
|
} else if (Feature == "+rtm") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "rtm") {
|
|
||||||
HasRTM = true;
|
HasRTM = true;
|
||||||
continue;
|
} else if (Feature == "+prfchw") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "prfchw") {
|
|
||||||
HasPRFCHW = true;
|
HasPRFCHW = true;
|
||||||
continue;
|
} else if (Feature == "+rdseed") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "rdseed") {
|
|
||||||
HasRDSEED = true;
|
HasRDSEED = true;
|
||||||
continue;
|
} else if (Feature == "+adx") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "adx") {
|
|
||||||
HasADX = true;
|
HasADX = true;
|
||||||
continue;
|
} else if (Feature == "+tbm") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "tbm") {
|
|
||||||
HasTBM = true;
|
HasTBM = true;
|
||||||
continue;
|
} else if (Feature == "+fma") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "fma") {
|
|
||||||
HasFMA = true;
|
HasFMA = true;
|
||||||
continue;
|
} else if (Feature == "+f16c") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "f16c") {
|
|
||||||
HasF16C = true;
|
HasF16C = true;
|
||||||
continue;
|
} else if (Feature == "+avx512cd") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "avx512cd") {
|
|
||||||
HasAVX512CD = true;
|
HasAVX512CD = true;
|
||||||
continue;
|
} else if (Feature == "+avx512er") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "avx512er") {
|
|
||||||
HasAVX512ER = true;
|
HasAVX512ER = true;
|
||||||
continue;
|
} else if (Feature == "+avx512pf") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "avx512pf") {
|
|
||||||
HasAVX512PF = true;
|
HasAVX512PF = true;
|
||||||
continue;
|
} else if (Feature == "+avx512dq") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "avx512dq") {
|
|
||||||
HasAVX512DQ = true;
|
HasAVX512DQ = true;
|
||||||
continue;
|
} else if (Feature == "+avx512bw") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "avx512bw") {
|
|
||||||
HasAVX512BW = true;
|
HasAVX512BW = true;
|
||||||
continue;
|
} else if (Feature == "+avx512vl") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "avx512vl") {
|
|
||||||
HasAVX512VL = true;
|
HasAVX512VL = true;
|
||||||
continue;
|
} else if (Feature == "+sha") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "sha") {
|
|
||||||
HasSHA = true;
|
HasSHA = true;
|
||||||
continue;
|
} else if (Feature == "+cx16") {
|
||||||
}
|
|
||||||
|
|
||||||
if (Feature == "cx16") {
|
|
||||||
HasCX16 = true;
|
HasCX16 = true;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(Features[i][0] == '+' && "Invalid target feature!");
|
assert(Feature[0] == '+' && "Invalid target feature!");
|
||||||
X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Feature)
|
X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Feature)
|
||||||
.Case("avx512f", AVX512F)
|
.Case("+avx512f", AVX512F)
|
||||||
.Case("avx2", AVX2)
|
.Case("+avx2", AVX2)
|
||||||
.Case("avx", AVX)
|
.Case("+avx", AVX)
|
||||||
.Case("sse4.2", SSE42)
|
.Case("+sse4.2", SSE42)
|
||||||
.Case("sse4.1", SSE41)
|
.Case("+sse4.1", SSE41)
|
||||||
.Case("ssse3", SSSE3)
|
.Case("+ssse3", SSSE3)
|
||||||
.Case("sse3", SSE3)
|
.Case("+sse3", SSE3)
|
||||||
.Case("sse2", SSE2)
|
.Case("+sse2", SSE2)
|
||||||
.Case("sse", SSE1)
|
.Case("+sse", SSE1)
|
||||||
.Default(NoSSE);
|
.Default(NoSSE);
|
||||||
SSELevel = std::max(SSELevel, Level);
|
SSELevel = std::max(SSELevel, Level);
|
||||||
|
|
||||||
MMX3DNowEnum ThreeDNowLevel =
|
MMX3DNowEnum ThreeDNowLevel =
|
||||||
llvm::StringSwitch<MMX3DNowEnum>(Feature)
|
llvm::StringSwitch<MMX3DNowEnum>(Feature)
|
||||||
.Case("3dnowa", AMD3DNowAthlon)
|
.Case("+3dnowa", AMD3DNowAthlon)
|
||||||
.Case("3dnow", AMD3DNow)
|
.Case("+3dnow", AMD3DNow)
|
||||||
.Case("mmx", MMX)
|
.Case("+mmx", MMX)
|
||||||
.Default(NoMMX3DNow);
|
.Default(NoMMX3DNow);
|
||||||
MMX3DNowLevel = std::max(MMX3DNowLevel, ThreeDNowLevel);
|
MMX3DNowLevel = std::max(MMX3DNowLevel, ThreeDNowLevel);
|
||||||
|
|
||||||
XOPEnum XLevel = llvm::StringSwitch<XOPEnum>(Feature)
|
XOPEnum XLevel = llvm::StringSwitch<XOPEnum>(Feature)
|
||||||
.Case("xop", XOP)
|
.Case("+xop", XOP)
|
||||||
.Case("fma4", FMA4)
|
.Case("+fma4", FMA4)
|
||||||
.Case("sse4a", SSE4A)
|
.Case("+sse4a", SSE4A)
|
||||||
.Default(NoXOP);
|
.Default(NoXOP);
|
||||||
XOPLevel = std::max(XOPLevel, XLevel);
|
XOPLevel = std::max(XOPLevel, XLevel);
|
||||||
}
|
}
|
||||||
|
@ -5247,12 +5147,12 @@ public:
|
||||||
FPU = FPUMode;
|
FPU = FPUMode;
|
||||||
CRC = 0;
|
CRC = 0;
|
||||||
Crypto = 0;
|
Crypto = 0;
|
||||||
for (unsigned i = 0, e = Features.size(); i != e; ++i) {
|
for (const auto &Feature : Features) {
|
||||||
if (Features[i] == "+neon")
|
if (Feature == "+neon")
|
||||||
FPU = NeonMode;
|
FPU = NeonMode;
|
||||||
if (Features[i] == "+crc")
|
if (Feature == "+crc")
|
||||||
CRC = 1;
|
CRC = 1;
|
||||||
if (Features[i] == "+crypto")
|
if (Feature == "+crypto")
|
||||||
Crypto = 1;
|
Crypto = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5926,10 +5826,10 @@ public:
|
||||||
bool handleTargetFeatures(std::vector<std::string> &Features,
|
bool handleTargetFeatures(std::vector<std::string> &Features,
|
||||||
DiagnosticsEngine &Diags) override {
|
DiagnosticsEngine &Diags) override {
|
||||||
HasTransactionalExecution = false;
|
HasTransactionalExecution = false;
|
||||||
for (unsigned i = 0, e = Features.size(); i != e; ++i) {
|
for (const auto &Feature : Features) {
|
||||||
if (Features[i] == "+transactional-execution")
|
if (Feature == "+transactional-execution")
|
||||||
HasTransactionalExecution = true;
|
HasTransactionalExecution = true;
|
||||||
if (Features[i] == "+vector")
|
else if (Feature == "+vector")
|
||||||
HasVector = true;
|
HasVector = true;
|
||||||
}
|
}
|
||||||
// If we use the vector ABI, vector types are 64-bit aligned.
|
// If we use the vector ABI, vector types are 64-bit aligned.
|
||||||
|
@ -6477,29 +6377,28 @@ public:
|
||||||
DspRev = NoDSP;
|
DspRev = NoDSP;
|
||||||
HasFP64 = isFP64Default();
|
HasFP64 = isFP64Default();
|
||||||
|
|
||||||
for (std::vector<std::string>::iterator it = Features.begin(),
|
for (const auto &Feature : Features) {
|
||||||
ie = Features.end(); it != ie; ++it) {
|
if (Feature == "+single-float")
|
||||||
if (*it == "+single-float")
|
|
||||||
IsSingleFloat = true;
|
IsSingleFloat = true;
|
||||||
else if (*it == "+soft-float")
|
else if (Feature == "+soft-float")
|
||||||
FloatABI = SoftFloat;
|
FloatABI = SoftFloat;
|
||||||
else if (*it == "+mips16")
|
else if (Feature == "+mips16")
|
||||||
IsMips16 = true;
|
IsMips16 = true;
|
||||||
else if (*it == "+micromips")
|
else if (Feature == "+micromips")
|
||||||
IsMicromips = true;
|
IsMicromips = true;
|
||||||
else if (*it == "+dsp")
|
else if (Feature == "+dsp")
|
||||||
DspRev = std::max(DspRev, DSP1);
|
DspRev = std::max(DspRev, DSP1);
|
||||||
else if (*it == "+dspr2")
|
else if (Feature == "+dspr2")
|
||||||
DspRev = std::max(DspRev, DSP2);
|
DspRev = std::max(DspRev, DSP2);
|
||||||
else if (*it == "+msa")
|
else if (Feature == "+msa")
|
||||||
HasMSA = true;
|
HasMSA = true;
|
||||||
else if (*it == "+fp64")
|
else if (Feature == "+fp64")
|
||||||
HasFP64 = true;
|
HasFP64 = true;
|
||||||
else if (*it == "-fp64")
|
else if (Feature == "-fp64")
|
||||||
HasFP64 = false;
|
HasFP64 = false;
|
||||||
else if (*it == "+nan2008")
|
else if (Feature == "+nan2008")
|
||||||
IsNan2008 = true;
|
IsNan2008 = true;
|
||||||
else if (*it == "-nan2008")
|
else if (Feature == "-nan2008")
|
||||||
IsNan2008 = false;
|
IsNan2008 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue