[PATCH] Fix the NaCl DataLayout strings produced by clang
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Wed Dec 18 14:53:56 PST 2013
Hi dschuff,
Hi Derek,
>From the discussion on the other code review it looks like it might be better to fix the string clang produces for NaCl and then synchronize llvm's.
This code review updates clang's to match my understanding of what is desired from the discussion on the other code review. In the process of writing this I found out that mipsel-nacl exists, but I have no idea what the expected DataLayout should be.
http://llvm-reviews.chandlerc.com/D2437
Files:
lib/Basic/Targets.cpp
test/CodeGen/target-data.c
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -624,7 +624,18 @@
this->IntPtrType = TargetInfo::SignedInt;
// RegParmMax is inherited from the underlying architecture
this->LongDoubleFormat = &llvm::APFloat::IEEEdouble;
- this->DescriptionString = "e-p:32:32-i64:64-v128:32";
+ if (Triple.getArch() == llvm::Triple::arm) {
+ this->DescriptionString = "e-p:32:32-i64:64-v128:64:128-n32-S128";
+ } else if (Triple.getArch() == llvm::Triple::x86) {
+ this->DescriptionString = "e-p:32:32-i64:64-n8:16:32-S128";
+ } else if (Triple.getArch() == llvm::Triple::x86_64) {
+ this->DescriptionString = "e-p:32:32-i64:64-s:64-n8:16:32:64-S128";
+ } else if (Triple.getArch() == llvm::Triple::mipsel) {
+ // Handled on mips' setDescriptionString.
+ } else {
+ assert(Triple.getArch() == llvm::Triple::le32);
+ this->DescriptionString = "e-p:32:32-i64:64-v128:32";
+ }
}
virtual typename Target::CallingConvCheckResult checkCallingConvention(
CallingConv CC) const {
Index: test/CodeGen/target-data.c
===================================================================
--- test/CodeGen/target-data.c
+++ test/CodeGen/target-data.c
@@ -60,15 +60,15 @@
// RUN: %clang_cc1 -triple i686-nacl -o - -emit-llvm %s | \
// RUN: FileCheck %s -check-prefix=I686-NACL
-// I686-NACL: target datalayout = "e-p:32:32-i64:64-v128:32"
+// I686-NACL: target datalayout = "e-p:32:32-i64:64-n8:16:32-S128"
// RUN: %clang_cc1 -triple x86_64-nacl -o - -emit-llvm %s | \
// RUN: FileCheck %s -check-prefix=X86_64-NACL
-// X86_64-NACL: target datalayout = "e-p:32:32-i64:64-v128:32"
+// X86_64-NACL: target datalayout = "e-p:32:32-i64:64-s:64-n8:16:32:64-S128"
// RUN: %clang_cc1 -triple arm-nacl-gnueabi -o - -emit-llvm %s | \
// RUN: FileCheck %s -check-prefix=ARM-NACL
-// ARM-NACL: target datalayout = "e-p:32:32-i64:64-v128:32"
+// ARM-NACL: target datalayout = "e-p:32:32-i64:64-v128:64:128-n32-S128"
// RUN: %clang_cc1 -triple mipsel-nacl -o - -emit-llvm %s | \
// RUN: FileCheck %s -check-prefix=MIPS-NACL
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2437.1.patch
Type: text/x-patch
Size: 2178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131218/9a6f6596/attachment.bin>
More information about the cfe-commits
mailing list