From: Petar Jovanovic Date: Tue, 22 Aug 2017 13:35:27 +0000 (+0000) Subject: [mips] Rename getSupportedNanEncoding() to getIEEE754Standard() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff2cadec02ece3a0588227018e74537c521c6097;p=clang [mips] Rename getSupportedNanEncoding() to getIEEE754Standard() Rename the function getSupportedNanEncoding() to getIEEE754Standard(), since this function will be used for non-nan related features. Patch by Aleksandar Beserminji. Differential Revision: https://reviews.llvm.org/D36824 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311454 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets/Mips.h b/lib/Basic/Targets/Mips.h index 20382b280a..f46aea1e5e 100644 --- a/lib/Basic/Targets/Mips.h +++ b/lib/Basic/Targets/Mips.h @@ -77,7 +77,7 @@ public: Triple.getOS() == llvm::Triple::OpenBSD; } - bool isNaN2008Default() const { + bool isIEEE754_2008Default() const { return CPU == "mips32r6" || CPU == "mips64r6"; } @@ -299,7 +299,7 @@ public: DiagnosticsEngine &Diags) override { IsMips16 = false; IsMicromips = false; - IsNan2008 = isNaN2008Default(); + IsNan2008 = isIEEE754_2008Default(); IsSingleFloat = false; FloatABI = HardFloat; DspRev = NoDSP; diff --git a/lib/Driver/ToolChains/Arch/Mips.cpp b/lib/Driver/ToolChains/Arch/Mips.cpp index 2a855fa4b7..b96938feb7 100644 --- a/lib/Driver/ToolChains/Arch/Mips.cpp +++ b/lib/Driver/ToolChains/Arch/Mips.cpp @@ -265,14 +265,14 @@ void mips::getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple, if (Arg *A = Args.getLastArg(options::OPT_mnan_EQ)) { StringRef Val = StringRef(A->getValue()); if (Val == "2008") { - if (mips::getSupportedNanEncoding(CPUName) & mips::Nan2008) + if (mips::getIEEE754Standard(CPUName) & mips::Std2008) Features.push_back("+nan2008"); else { Features.push_back("-nan2008"); D.Diag(diag::warn_target_unsupported_nan2008) << CPUName; } } else if (Val == "legacy") { - if (mips::getSupportedNanEncoding(CPUName) & mips::NanLegacy) + if (mips::getIEEE754Standard(CPUName) & mips::Legacy) Features.push_back("-nan2008"); else { Features.push_back("+nan2008"); @@ -323,27 +323,28 @@ void mips::getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple, AddTargetFeature(Args, Features, options::OPT_mmt, options::OPT_mno_mt, "mt"); } -mips::NanEncoding mips::getSupportedNanEncoding(StringRef &CPU) { - // Strictly speaking, mips32r2 and mips64r2 are NanLegacy-only since Nan2008 - // was first introduced in Release 3. However, other compilers have - // traditionally allowed it for Release 2 so we should do the same. - return (NanEncoding)llvm::StringSwitch(CPU) - .Case("mips1", NanLegacy) - .Case("mips2", NanLegacy) - .Case("mips3", NanLegacy) - .Case("mips4", NanLegacy) - .Case("mips5", NanLegacy) - .Case("mips32", NanLegacy) - .Case("mips32r2", NanLegacy | Nan2008) - .Case("mips32r3", NanLegacy | Nan2008) - .Case("mips32r5", NanLegacy | Nan2008) - .Case("mips32r6", Nan2008) - .Case("mips64", NanLegacy) - .Case("mips64r2", NanLegacy | Nan2008) - .Case("mips64r3", NanLegacy | Nan2008) - .Case("mips64r5", NanLegacy | Nan2008) - .Case("mips64r6", Nan2008) - .Default(NanLegacy); +mips::IEEE754Standard mips::getIEEE754Standard(StringRef &CPU) { + // Strictly speaking, mips32r2 and mips64r2 do not conform to the + // IEEE754-2008 standard. Support for this standard was first introduced + // in Release 3. However, other compilers have traditionally allowed it + // for Release 2 so we should do the same. + return (IEEE754Standard)llvm::StringSwitch(CPU) + .Case("mips1", Legacy) + .Case("mips2", Legacy) + .Case("mips3", Legacy) + .Case("mips4", Legacy) + .Case("mips5", Legacy) + .Case("mips32", Legacy) + .Case("mips32r2", Legacy | Std2008) + .Case("mips32r3", Legacy | Std2008) + .Case("mips32r5", Legacy | Std2008) + .Case("mips32r6", Std2008) + .Case("mips64", Legacy) + .Case("mips64r2", Legacy | Std2008) + .Case("mips64r3", Legacy | Std2008) + .Case("mips64r5", Legacy | Std2008) + .Case("mips64r6", Std2008) + .Default(Std2008); } bool mips::hasCompactBranches(StringRef &CPU) { diff --git a/lib/Driver/ToolChains/Arch/Mips.h b/lib/Driver/ToolChains/Arch/Mips.h index 0b78866094..89eea9a151 100644 --- a/lib/Driver/ToolChains/Arch/Mips.h +++ b/lib/Driver/ToolChains/Arch/Mips.h @@ -24,7 +24,7 @@ namespace tools { bool isMipsArch(llvm::Triple::ArchType Arch); namespace mips { -typedef enum { NanLegacy = 1, Nan2008 = 2 } NanEncoding; +typedef enum { Legacy = 1, Std2008 = 2 } IEEE754Standard; enum class FloatABI { Invalid, @@ -32,7 +32,7 @@ enum class FloatABI { Hard, }; -NanEncoding getSupportedNanEncoding(StringRef &CPU); +IEEE754Standard getIEEE754Standard(StringRef &CPU); bool hasCompactBranches(StringRef &CPU); void getMipsCPUAndABI(const llvm::opt::ArgList &Args, const llvm::Triple &Triple, StringRef &CPUName,