]> granicus.if.org Git - clang/commitdiff
[mips] Rename getSupportedNanEncoding() to getIEEE754Standard()
authorPetar Jovanovic <petar.jovanovic@imgtec.com>
Tue, 22 Aug 2017 13:35:27 +0000 (13:35 +0000)
committerPetar Jovanovic <petar.jovanovic@imgtec.com>
Tue, 22 Aug 2017 13:35:27 +0000 (13:35 +0000)
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

lib/Basic/Targets/Mips.h
lib/Driver/ToolChains/Arch/Mips.cpp
lib/Driver/ToolChains/Arch/Mips.h

index 20382b280a6746adc75dbd605ab598cb31406b90..f46aea1e5e7c6d4ba151ba17901a547673c146c6 100644 (file)
@@ -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;
index 2a855fa4b76f9e0fabd9fc24b97ec57130571d8c..b96938feb78eaeecdee870167949e221786357ad 100644 (file)
@@ -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<int>(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<int>(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) {
index 0b788660948c4e86dac9cc8be55e8d5e36665248..89eea9a1514cde55c8ac787d1f1b6fe1b0f68003 100644 (file)
@@ -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,