[llvm] r202253 - [mips] Treat -mcpu=generic the same way as an empty CPU string.

Daniel Sanders daniel.sanders at imgtec.com
Wed Feb 26 02:20:15 PST 2014


Author: dsanders
Date: Wed Feb 26 04:20:15 2014
New Revision: 202253

URL: http://llvm.org/viewvc/llvm-project?rev=202253&view=rev
Log:
[mips] Treat -mcpu=generic the same way as an empty CPU string.

Summary:
This should fix the MCJIT unit tests that were broken by r201792 on the MIPS buildbot.
MIPS currently uses the default implementation of sys::getHostCPUName() which
always returns "generic". For now, we will accept "generic" and coerce it to
"mips32" or "mips64" depending on the target architecture like we do for empty
CPU names.

Reviewers: jacksprat, matheusalmeida

Reviewed By: jacksprat

Differential Revision: http://llvm-reviews.chandlerc.com/D2878

Modified:
    llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
    llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp

Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp?rev=202253&r1=202252&r2=202253&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp Wed Feb 26 04:20:15 2014
@@ -42,7 +42,7 @@ using namespace llvm;
 /// Select the Mips CPU for the given triple and cpu name.
 /// FIXME: Merge with the copy in MipsSubtarget.cpp
 static inline StringRef selectMipsCPU(StringRef TT, StringRef CPU) {
-  if (CPU.empty()) {
+  if (CPU.empty() || CPU == "generic") {
     Triple TheTriple(TT);
     if (TheTriple.getArch() == Triple::mips ||
         TheTriple.getArch() == Triple::mipsel)

Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp?rev=202253&r1=202252&r2=202253&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp Wed Feb 26 04:20:15 2014
@@ -62,7 +62,7 @@ Mips16ConstantIslands(
 /// Select the Mips CPU for the given triple and cpu name.
 /// FIXME: Merge with the copy in MipsMCTargetDesc.cpp
 static inline StringRef selectMipsCPU(StringRef TT, StringRef CPU) {
-  if (CPU.empty()) {
+  if (CPU.empty() || CPU == "generic") {
     Triple TheTriple(TT);
     if (TheTriple.getArch() == Triple::mips ||
         TheTriple.getArch() == Triple::mipsel)





More information about the llvm-commits mailing list