[cfe-commits] r106131 - in /cfe/trunk: lib/CodeGen/TargetInfo.cpp lib/Driver/Tools.cpp test/CodeGen/builtin-attributes.c test/CodeGenCXX/arm-cc.cpp

Rafael Espindola rafael.espindola at gmail.com
Wed Jun 16 12:01:17 PDT 2010


Author: rafael
Date: Wed Jun 16 14:01:17 2010
New Revision: 106131

URL: http://llvm.org/viewvc/llvm-project?rev=106131&view=rev
Log:
Change the test for which ABI/CC to use on ARM to be base on the environment
(the last argument of the triple).

Modified:
    cfe/trunk/lib/CodeGen/TargetInfo.cpp
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/CodeGen/builtin-attributes.c
    cfe/trunk/test/CodeGenCXX/arm-cc.cpp

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=106131&r1=106130&r2=106131&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Jun 16 14:01:17 2010
@@ -1778,10 +1778,11 @@
 
   const llvm::Triple &Triple(Context.Target.getTriple());
   llvm::CallingConv::ID DefaultCC;
-  if (Triple.getOS() == llvm::Triple::Darwin)
-    DefaultCC = llvm::CallingConv::ARM_APCS;
-  else
+  if (Triple.getEnvironmentName() == "gnueabi" ||
+      Triple.getEnvironmentName() == "eabi")
     DefaultCC = llvm::CallingConv::ARM_AAPCS;
+  else
+    DefaultCC = llvm::CallingConv::ARM_APCS;
 
   switch (getABIKind()) {
   case APCS:

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=106131&r1=106130&r2=106131&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jun 16 14:01:17 2010
@@ -394,20 +394,13 @@
     ABIName = A->getValue(Args);
   } else {
     // Select the default based on the platform.
-    switch (getToolChain().getTriple().getOS()) {
-      // FIXME: Is this right for non-Darwin and non-Linux?
-    default:
+    llvm::StringRef env = getToolChain().getTriple().getEnvironmentName();
+    if (env == "gnueabi")
+      ABIName = "aapcs-linux";
+    else if (env == "eabi")
       ABIName = "aapcs";
-      break;
-
-    case llvm::Triple::Darwin:
+    else
       ABIName = "apcs-gnu";
-      break;
-
-    case llvm::Triple::Linux:
-      ABIName = "aapcs-linux";
-      break;
-    }
   }
   CmdArgs.push_back("-target-abi");
   CmdArgs.push_back(ABIName);

Modified: cfe/trunk/test/CodeGen/builtin-attributes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-attributes.c?rev=106131&r1=106130&r2=106131&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtin-attributes.c (original)
+++ cfe/trunk/test/CodeGen/builtin-attributes.c Wed Jun 16 14:01:17 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple arm-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm-unknown-linux-gnueabi -emit-llvm -o - %s | FileCheck %s
 
 // CHECK: declare i32 @printf(i8*, ...)
 void f0() {

Modified: cfe/trunk/test/CodeGenCXX/arm-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/arm-cc.cpp?rev=106131&r1=106130&r2=106131&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/arm-cc.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/arm-cc.cpp Wed Jun 16 14:01:17 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=arm-linux-gnueabi -target-abi aapcs -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=arm-unknown-linux-gnueabi -target-abi aapcs -emit-llvm -o - | FileCheck %s
 
 class SMLoc {
  const char *Ptr;





More information about the cfe-commits mailing list