Hi all,
the attached patch adds support for *-eabihf, which uses ARM_AAPCS_VFP
as calling convention in combination with the __aeabi_* library
functions. The only non-trivial part of the patch is in Clang where the
change to isEABI() will make getSizeOfUnwindException() return 88 for
GNUEABIHF as it would for GNUEABI. I'm not sure if the difference is
intentional -- it doesn't make sense to me. Comments?

Joerg
Index: lib/CodeGen/TargetInfo.cpp
===================================================================
--- lib/CodeGen/TargetInfo.cpp	(revision 197181)
+++ lib/CodeGen/TargetInfo.cpp	(working copy)
@@ -3074,13 +3074,25 @@
     switch (getTarget().getTriple().getEnvironment()) {
     case llvm::Triple::Android:
     case llvm::Triple::EABI:
+    case llvm::Triple::EABIHF:
     case llvm::Triple::GNUEABI:
+    case llvm::Triple::GNUEABIHF:
       return true;
     default:
       return false;
     }
   }
 
+  bool isEABIHF() const {
+    switch (getTarget().getTriple().getEnvironment()) {
+    case llvm::Triple::EABIHF:
+    case llvm::Triple::GNUEABIHF:
+      return true;
+    default:
+      return false;
+    }
+  }
+
   ABIKind getABIKind() const { return Kind; }
 
 private:
@@ -3214,7 +3226,7 @@
 /// Return the default calling convention that LLVM will use.
 llvm::CallingConv::ID ARMABIInfo::getLLVMDefaultCC() const {
   // The default calling convention that LLVM will infer.
-  if (getTarget().getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
+  if (isEABIHF())
     return llvm::CallingConv::ARM_AAPCS_VFP;
   else if (isEABI())
     return llvm::CallingConv::ARM_AAPCS;
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp	(revision 197176)
+++ lib/Driver/Tools.cpp	(working copy)
@@ -652,6 +652,9 @@
       case llvm::Triple::GNUEABI:
         FloatABI = "softfp";
         break;
+      case llvm::Triple::EABIHF:
+        FloatABI = "hard";
+        break;
       case llvm::Triple::EABI:
         // EABI is always AAPCS, and if it was not marked 'hard', it's softfp
         FloatABI = "softfp";
@@ -757,6 +760,7 @@
     case llvm::Triple::GNUEABIHF:
       ABIName = "aapcs-linux";
       break;
+    case llvm::Triple::EABIHF:
     case llvm::Triple::EABI:
       ABIName = "aapcs";
       break;
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h	(revision 197176)
+++ include/llvm/ADT/Triple.h	(working copy)
@@ -121,6 +121,7 @@
     GNUEABIHF,
     GNUX32,
     EABI,
+    EABIHF,
     MachO,
     Android,
     ELF
Index: lib/Support/Triple.cpp
===================================================================
--- lib/Support/Triple.cpp	(revision 197176)
+++ lib/Support/Triple.cpp	(working copy)
@@ -150,6 +150,7 @@
   case GNUEABI: return "gnueabi";
   case GNUX32: return "gnux32";
   case EABI: return "eabi";
+  case EABIHF: return "eabihf";
   case MachO: return "macho";
   case Android: return "android";
   case ELF: return "elf";
@@ -297,6 +298,7 @@
 
 static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
   return StringSwitch<Triple::EnvironmentType>(EnvironmentName)
+    .StartsWith("eabihf", Triple::EABIHF)
     .StartsWith("eabi", Triple::EABI)
     .StartsWith("gnueabihf", Triple::GNUEABIHF)
     .StartsWith("gnueabi", Triple::GNUEABI)
Index: lib/Target/ARM/ARMSubtarget.cpp
===================================================================
--- lib/Target/ARM/ARMSubtarget.cpp	(revision 197332)
+++ lib/Target/ARM/ARMSubtarget.cpp	(working copy)
@@ -191,6 +191,7 @@
 
   switch (TargetTriple.getEnvironment()) {
   case Triple::EABI:
+  case Triple::EABIHF:
   case Triple::GNUEABI:
   case Triple::GNUEABIHF:
     TargetABI = ARM_ABI_AAPCS;
Index: lib/Target/ARM/ARMSubtarget.h
===================================================================
--- lib/Target/ARM/ARMSubtarget.h	(revision 197176)
+++ lib/Target/ARM/ARMSubtarget.h	(working copy)
@@ -317,7 +317,8 @@
   // even for GNUEABI, so we can make a distinction here and still conform to
   // the EABI on GNU (and Android) mode. This requires change in Clang, too.
   bool isTargetAEABI() const {
-    return TargetTriple.getEnvironment() == Triple::EABI;
+    return TargetTriple.getEnvironment() == Triple::EABI ||
+      TargetTriple.getEnvironment() == Triple::EABIHF;
   }
 
   bool isAPCS_ABI() const { return TargetABI == ARM_ABI_APCS; }
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to