long double patch 2 of N. Handle it in TargetData.
authorDale Johannesen <dalej@apple.com>
Fri, 3 Aug 2007 20:20:50 +0000 (20:20 +0000)
committerDale Johannesen <dalej@apple.com>
Fri, 3 Aug 2007 20:20:50 +0000 (20:20 +0000)
(I've tried to get the info right for all targets,
but I'm not expert on all of them - check yours.)

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

lib/Target/Alpha/AlphaTargetMachine.cpp
lib/Target/IA64/IA64TargetMachine.cpp
lib/Target/PowerPC/PPCSubtarget.h
lib/Target/Sparc/SparcTargetMachine.cpp
lib/Target/TargetData.cpp
lib/Target/X86/X86TargetMachine.cpp

index f051da45d82d943d2dae43c4c8b01bf8bc84708b..85ec02899adbf7f5aa55b941a2ec979797f3f8aa 100644 (file)
@@ -57,7 +57,7 @@ unsigned AlphaTargetMachine::getJITMatchQuality() {
 }
 
 AlphaTargetMachine::AlphaTargetMachine(const Module &M, const std::string &FS)
-  : DataLayout("e"),
+  : DataLayout("e-f128:128:128"),
     FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
     JITInfo(*this),
     Subtarget(M, FS),
index 51beaa1ebe15d1406ce76195017090b7c45473a8..71f614d07f173b5bdec4c4953f981c5f080fc078 100644 (file)
@@ -63,7 +63,7 @@ unsigned IA64TargetMachine::getModuleMatchQuality(const Module &M) {
 /// IA64TargetMachine ctor - Create an LP64 architecture model
 ///
 IA64TargetMachine::IA64TargetMachine(const Module &M, const std::string &FS)
-  : DataLayout("e"),
+  : DataLayout("e-f80:128:128"),
     FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
     TLInfo(*this) { // FIXME? check this stuff
 }
index d1e135c32f553193c023ad777c6eb3ceefef639a..1ad3f132020dbf1992df64550b5d34c33daaaf7a 100644 (file)
@@ -104,8 +104,8 @@ public:
   /// getTargetDataString - Return the pointer size and type alignment
   /// properties of this subtarget.
   const char *getTargetDataString() const {
-    return isPPC64() ? "E-p:64:64-f64:32:64-i64:32:64"
-                     : "E-p:32:32-f64:32:64-i64:32:64";
+    return isPPC64() ? "E-p:64:64-f64:32:64-i64:32:64-f128:64:128"
+                     : "E-p:32:32-f64:32:64-i64:32:64-f128:64:128";
   }
 
   /// isPPC64 - Return true if we are generating code for 64-bit pointer mode.
index e0206d809168e05a6234424591bf1d81ee72abb3..167e7ec246a1d5eeea530dd82514ff1bf77510a3 100644 (file)
@@ -30,7 +30,7 @@ const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const {
 /// SparcTargetMachine ctor - Create an ILP32 architecture model
 ///
 SparcTargetMachine::SparcTargetMachine(const Module &M, const std::string &FS)
-  : DataLayout("E-p:32:32"),
+  : DataLayout("E-p:32:32-f128:128:128"),
     Subtarget(M, FS), InstrInfo(Subtarget),
     FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
 }
index 301e8c12ab452d46b83a1d4509b923144d71466c..bb1ad3271baa4f8c7a8ede251f018ac94f9b741e 100644 (file)
@@ -436,6 +436,13 @@ uint64_t TargetData::getTypeSize(const Type *Ty) const {
     return 4;
   case Type::DoubleTyID:
     return 8;
+  case Type::PPC_FP128TyID:
+  case Type::FP128TyID:
+    return 16;
+  // In memory objects this is always aligned to a higher boundary, but
+  // only 10 bytes contain information.
+  case Type::X86_FP80TyID:
+    return 10;
   case Type::VectorTyID: {
     const VectorType *PTy = cast<VectorType>(Ty);
     return PTy->getBitWidth() / 8;
@@ -493,6 +500,11 @@ unsigned char TargetData::getAlignment(const Type *Ty, bool abi_or_pref) const {
     break;
   case Type::FloatTyID:
   case Type::DoubleTyID:
+  // PPC_FP128TyID and FP128TyID have different data contents, but the
+  // same size and alignment, so they look the same here.
+  case Type::PPC_FP128TyID:
+  case Type::FP128TyID:
+  case Type::X86_FP80TyID:
     AlignType = FLOAT_ALIGN;
     break;
   case Type::VectorTyID: {
index 02fbf9596ae2a6729cc437036842816e474b47aa..35be090337589b46d711f8e0ba64af8147bc023d 100644 (file)
@@ -115,8 +115,8 @@ X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS,
                                    bool is64Bit)
   : Subtarget(M, FS, is64Bit),
     DataLayout(Subtarget.is64Bit() ?
-               std::string("e-p:64:64-f64:32:64-i64:32:64") :
-               std::string("e-p:32:32-f64:32:64-i64:32:64")),
+               std::string("e-p:64:64-f64:32:64-i64:32:64-f80:128:128") :
+               std::string("e-p:32:32-f64:32:64-i64:32:64-f80:128:128")),
     FrameInfo(TargetFrameInfo::StackGrowsDown,
               Subtarget.getStackAlignment(), Subtarget.is64Bit() ? -8 : -4),
     InstrInfo(*this), JITInfo(*this), TLInfo(*this) {