r238324 - ARMTargetParser FIXME getCPUProfile A/R/M

Renato Golin renato.golin at linaro.org
Wed May 27 07:15:12 PDT 2015


Author: rengolin
Date: Wed May 27 09:15:12 2015
New Revision: 238324

URL: http://llvm.org/viewvc/llvm-project?rev=238324&view=rev
Log:
ARMTargetParser FIXME getCPUProfile A/R/M

This is the last of the easy ones.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=238324&r1=238323&r2=238324&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed May 27 09:15:12 2015
@@ -4346,16 +4346,21 @@ public:
       }
     }
 
-    // FIXME: Use ARMTargetParser
-    return llvm::StringSwitch<const char *>(Name)
-        .Cases("cortex-a5", "cortex-a7", "cortex-a8", "A")
-        .Cases("cortex-a9", "cortex-a12", "cortex-a15", "cortex-a17", "krait",
-               "A")
-        .Cases("cortex-a53", "cortex-a57", "cortex-a72", "A")
-        .Cases("cortex-m3", "cortex-m4", "cortex-m0", "cortex-m0plus", "M")
-        .Cases("cortex-m1", "cortex-m7", "sc000", "sc300", "M")
-        .Cases("cortex-r4",  "cortex-r4f", "cortex-r5", "cortex-r7", "R")
-        .Default("");
+    unsigned CPUArch = llvm::ARMTargetParser::parseCPUArch(Name);
+    if (CPUArch == llvm::ARM::AK_INVALID)
+      return "";
+
+    StringRef ArchName = llvm::ARMTargetParser::getArchName(CPUArch);
+    switch(llvm::ARMTargetParser::parseArchProfile(ArchName)) {
+      case llvm::ARM::PK_A:
+        return "A";
+      case llvm::ARM::PK_R:
+        return "R";
+      case llvm::ARM::PK_M:
+        return "M";
+      default:
+        return "";
+    }
   }
   bool setCPU(const std::string &Name) override {
     if (!getCPUDefineSuffix(Name))





More information about the cfe-commits mailing list