long double patch 2 of N. Handle it in TargetData.

(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
This commit is contained in:
Dale Johannesen 2007-08-03 20:20:50 +00:00
parent ab8702787d
commit 8c1e6a119a
6 changed files with 19 additions and 7 deletions

View 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),

View 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
}

View 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.

View 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) {
}

View 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: {

View 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) {