]> granicus.if.org Git - clang/commitdiff
ARM: default to arm1176jzf-s for hard-float platforms.
authorTim Northover <tnorthover@apple.com>
Tue, 20 Aug 2013 13:13:38 +0000 (13:13 +0000)
committerTim Northover <tnorthover@apple.com>
Tue, 20 Aug 2013 13:13:38 +0000 (13:13 +0000)
It makes no sense to try and compile for arm7tdmi when we're targeting
something like gnueabihf. Although not strictly the most basic hardware
conceivable, I believe arm1176jzf-s is a reasonable compromise (that can always
be overridden explicitly if needed) since it's still in reasonably common use
unlike earlier cores.

Patch by Stephen Kelly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188796 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChain.cpp

index ca74395955e03a62ecd82b26196b6a13a154da05..ad8482d21d56d8e3d48fd6b8eb334da6420132a7 100644 (file)
@@ -180,7 +180,7 @@ static const char *getARMTargetCPU(const ArgList &Args,
     MArch = Triple.getArchName();
   }
 
-  return llvm::StringSwitch<const char *>(MArch)
+  const char *result = llvm::StringSwitch<const char *>(MArch)
     .Cases("armv2", "armv2a","arm2")
     .Case("armv3", "arm6")
     .Case("armv3m", "arm7m")
@@ -207,7 +207,15 @@ static const char *getARMTargetCPU(const ArgList &Args,
     .Case("xscale", "xscale")
     // If all else failed, return the most base CPU with thumb interworking
     // supported by LLVM.
-    .Default("arm7tdmi");
+    .Default(0);
+
+  if (result)
+    return result;
+
+  return
+    Triple.getEnvironment() == llvm::Triple::GNUEABIHF
+      ? "arm1176jzf-s"
+      : "arm7tdmi";
 }
 
 /// getLLVMArchSuffixForARM - Get the LLVM arch name to use for a particular