[llvm] r197792 - Add support for krait cpu in llvm::sys::getHostCPUName()

Kai Nacke kai.nacke at redstar.de
Fri Dec 20 01:24:14 PST 2013


Author: redstar
Date: Fri Dec 20 03:24:13 2013
New Revision: 197792

URL: http://llvm.org/viewvc/llvm-project?rev=197792&view=rev
Log:
Add support for krait cpu in llvm::sys::getHostCPUName()

Recently, support for krait cpu was added. This commit extends getHostCPUName()
to return krait as cpu for the APQ8064 (a Krait 300).

Modified:
    llvm/trunk/lib/Support/Host.cpp

Modified: llvm/trunk/lib/Support/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Host.cpp?rev=197792&r1=197791&r2=197792&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Host.cpp (original)
+++ llvm/trunk/lib/Support/Host.cpp Fri Dec 20 03:24:13 2013
@@ -620,6 +620,17 @@ StringRef sys::getHostCPUName() {
           .Case("0xc24", "cortex-m4")
           .Default("generic");
 
+  if (Implementer == "0x51") // Qualcomm Technologies, Inc.
+    // Look for the CPU part line.
+    for (unsigned I = 0, E = Lines.size(); I != E; ++I)
+      if (Lines[I].startswith("CPU part"))
+        // The CPU part is a 3 digit hexadecimal number with a 0x prefix. The
+        // values correspond to the "Part number" in the CP15/c0 register. The
+        // contents are specified in the various processor manuals.
+        return StringSwitch<const char *>(Lines[I].substr(8).ltrim("\t :"))
+          .Case("0x06f", "krait") // APQ8064
+          .Default("generic");
+
   return "generic";
 }
 #elif defined(__linux__) && defined(__s390x__)





More information about the llvm-commits mailing list