[PATCH] Create android x86_32 target info

Tamas Berghammer tberghammer at google.com
Mon Mar 16 09:08:35 PDT 2015


Hi danalbert,

Create android x86_32 target info

On android x86_32 the long double is only 64 bits (compared to 80 bits on linux x86_32). This CL creates a new target info class to use the correct size for long double on android x86_32.

http://reviews.llvm.org/D8357

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6585,6 +6585,17 @@
 };
 } // end anonymous namespace.
 
+namespace {
+// x86-32 Android target
+class AndroidX86_32TargetInfo : public LinuxTargetInfo<X86_32TargetInfo> {
+public:
+  AndroidX86_32TargetInfo(const llvm::Triple &Triple)
+      : LinuxTargetInfo<X86_32TargetInfo>(Triple) {
+    LongDoubleWidth = 64;
+  }
+};
+} // end anonymous namespace
+
 
 //===----------------------------------------------------------------------===//
 // Driver code
@@ -6862,8 +6873,14 @@
       return new DarwinI386TargetInfo(Triple);
 
     switch (os) {
-    case llvm::Triple::Linux:
-      return new LinuxTargetInfo<X86_32TargetInfo>(Triple);
+    case llvm::Triple::Linux: {
+      switch (Triple.getEnvironment()) {
+      default:
+        return new LinuxTargetInfo<X86_32TargetInfo>(Triple);
+      case llvm::Triple::Android:
+        return new AndroidX86_32TargetInfo(Triple);
+      }
+    }
     case llvm::Triple::DragonFly:
       return new DragonFlyBSDTargetInfo<X86_32TargetInfo>(Triple);
     case llvm::Triple::NetBSD:

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8357.22026.patch
Type: text/x-patch
Size: 1186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150316/b037b4fa/attachment.bin>


More information about the cfe-commits mailing list