forked from OSchip/llvm-project
[SystemZ][z/OS] Add GOFF Support to the DataLayout
- This patch adds in the GOFF mangling support to the LLVM data layout string. A corresponding additional line has been added into the data layout section in the language reference documentation. - Furthermore, this patch also sets the right data layout string for the z/OS target in the SystemZ backend. Reviewed By: uweigand, Kai, abhina.sreeskantharajan, MaskRay Differential Revision: https://reviews.llvm.org/D109362
This commit is contained in:
parent
ef976337f5
commit
e09a1dc475
|
@ -46,7 +46,17 @@ public:
|
|||
LongDoubleFormat = &llvm::APFloat::IEEEquad();
|
||||
DefaultAlignForAttributeAligned = 64;
|
||||
MinGlobalAlign = 16;
|
||||
resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64");
|
||||
if (Triple.isOSzOS()) {
|
||||
// All vector types are default aligned on an 8-byte boundary, even if the
|
||||
// vector facility is not available. That is different from Linux.
|
||||
MaxVectorAlign = 64;
|
||||
// Compared to Linux/ELF, the data layout differs only in some details:
|
||||
// - name mangling is GOFF
|
||||
// - 128 bit vector types are 64 bit aligned
|
||||
resetDataLayout(
|
||||
"E-m:l-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64");
|
||||
} else
|
||||
resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64");
|
||||
MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
|
||||
HasStrictFP = true;
|
||||
}
|
||||
|
@ -129,7 +139,7 @@ public:
|
|||
HasVector &= !SoftFloat;
|
||||
|
||||
// If we use the vector ABI, vector types are 64-bit aligned.
|
||||
if (HasVector) {
|
||||
if (HasVector && !getTriple().isOSzOS()) {
|
||||
MaxVectorAlign = 64;
|
||||
resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64"
|
||||
"-v128:64-a:8:16-n32:64");
|
||||
|
|
|
@ -219,40 +219,24 @@
|
|||
// RUN: FileCheck %s -check-prefix=HEXAGON
|
||||
// HEXAGON: target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
|
||||
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z10 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch8 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z196 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch9 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu zEC12 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch10 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z13 -target-feature +soft-float -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ
|
||||
// SYSTEMZ: target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"
|
||||
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z13 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch11 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z14 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch12 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z15 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch13 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch14 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
|
||||
// SYSTEMZ-VECTOR: target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
|
||||
|
||||
// RUN: %clang_cc1 -triple s390x-none-zos -target-cpu z10 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=ZOS
|
||||
// RUN: %clang_cc1 -triple s390x-none-zos -target-cpu z13 -target-feature +soft-float -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=ZOS
|
||||
// RUN: %clang_cc1 -triple s390x-none-zos -target-cpu z13 -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=ZOS
|
||||
// ZOS: target datalayout = "E-m:l-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
|
||||
|
||||
// RUN: %clang_cc1 -triple msp430-unknown -o - -emit-llvm %s | \
|
||||
// RUN: FileCheck %s -check-prefix=MSP430
|
||||
// MSP430: target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16"
|
||||
|
|
|
@ -2605,6 +2605,7 @@ as follows:
|
|||
options are
|
||||
|
||||
* ``e``: ELF mangling: Private symbols get a ``.L`` prefix.
|
||||
* ``l``: GOFF mangling: Private symbols get a ``@`` prefix.
|
||||
* ``m``: Mips mangling: Private symbols get a ``$`` prefix.
|
||||
* ``o``: Mach-O mangling: Private symbols get ``L`` prefix. Other
|
||||
symbols get a ``_`` prefix.
|
||||
|
|
|
@ -135,6 +135,7 @@ private:
|
|||
MM_MachO,
|
||||
MM_WinCOFF,
|
||||
MM_WinCOFFX86,
|
||||
MM_GOFF,
|
||||
MM_Mips,
|
||||
MM_XCOFF
|
||||
};
|
||||
|
@ -316,6 +317,7 @@ public:
|
|||
switch (ManglingMode) {
|
||||
case MM_None:
|
||||
case MM_ELF:
|
||||
case MM_GOFF:
|
||||
case MM_Mips:
|
||||
case MM_WinCOFF:
|
||||
case MM_XCOFF:
|
||||
|
@ -334,6 +336,8 @@ public:
|
|||
case MM_ELF:
|
||||
case MM_WinCOFF:
|
||||
return ".L";
|
||||
case MM_GOFF:
|
||||
return "@";
|
||||
case MM_Mips:
|
||||
return "$";
|
||||
case MM_MachO:
|
||||
|
|
|
@ -151,6 +151,8 @@ PointerAlignElem::operator==(const PointerAlignElem &rhs) const {
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
const char *DataLayout::getManglingComponent(const Triple &T) {
|
||||
if (T.isOSBinFormatGOFF())
|
||||
return "-m:l";
|
||||
if (T.isOSBinFormatMachO())
|
||||
return "-m:o";
|
||||
if (T.isOSWindows() && T.isOSBinFormatCOFF())
|
||||
|
@ -500,6 +502,9 @@ Error DataLayout::parseSpecifier(StringRef Desc) {
|
|||
case 'e':
|
||||
ManglingMode = MM_ELF;
|
||||
break;
|
||||
case 'l':
|
||||
ManglingMode = MM_GOFF;
|
||||
break;
|
||||
case 'o':
|
||||
ManglingMode = MM_MachO;
|
||||
break;
|
||||
|
|
|
@ -84,8 +84,9 @@ static std::string computeDataLayout(const Triple &TT, StringRef CPU,
|
|||
// 128-bit floats are aligned only to 64 bits.
|
||||
Ret += "-f128:64";
|
||||
|
||||
// When using the vector ABI, 128-bit vectors are also aligned to 64 bits.
|
||||
if (VectorABI)
|
||||
// When using the vector ABI on Linux, 128-bit vectors are also aligned to 64
|
||||
// bits. On z/OS, vector types are always aligned to 64 bits.
|
||||
if (VectorABI || TT.isOSzOS())
|
||||
Ret += "-v128:64";
|
||||
|
||||
// We prefer 16 bits of aligned for all globals; see above.
|
||||
|
|
|
@ -156,4 +156,22 @@ TEST(ManglerTest, XCOFF) {
|
|||
"L..foo");
|
||||
}
|
||||
|
||||
TEST(ManglerTest, GOFF) {
|
||||
LLVMContext Ctx;
|
||||
DataLayout DL("m:l"); // GOFF
|
||||
Module Mod("test", Ctx);
|
||||
Mod.setDataLayout(DL);
|
||||
Mangler Mang;
|
||||
|
||||
EXPECT_EQ(mangleStr("foo", Mang, DL), "foo");
|
||||
EXPECT_EQ(mangleStr("\01foo", Mang, DL), "foo");
|
||||
EXPECT_EQ(mangleStr("?foo", Mang, DL), "?foo");
|
||||
EXPECT_EQ(mangleFunc("foo", llvm::GlobalValue::ExternalLinkage,
|
||||
llvm::CallingConv::C, Mod, Mang),
|
||||
"foo");
|
||||
EXPECT_EQ(mangleFunc("foo", llvm::GlobalValue::PrivateLinkage,
|
||||
llvm::CallingConv::C, Mod, Mang),
|
||||
"@foo");
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
|
Loading…
Reference in New Issue