forked from OSchip/llvm-project
Some small changes to make the target info a bit more accurate.
llvm-svn: 51319
This commit is contained in:
parent
d5a55bd466
commit
b53660698a
|
@ -38,7 +38,9 @@ protected:
|
||||||
unsigned char PointerWidth, PointerAlign;
|
unsigned char PointerWidth, PointerAlign;
|
||||||
unsigned char WCharWidth, WCharAlign;
|
unsigned char WCharWidth, WCharAlign;
|
||||||
unsigned char IntWidth, IntAlign;
|
unsigned char IntWidth, IntAlign;
|
||||||
|
unsigned char FloatWidth, FloatAlign;
|
||||||
unsigned char DoubleWidth, DoubleAlign;
|
unsigned char DoubleWidth, DoubleAlign;
|
||||||
|
unsigned char LongDoubleWidth, LongDoubleAlign;
|
||||||
unsigned char LongWidth, LongAlign;
|
unsigned char LongWidth, LongAlign;
|
||||||
unsigned char LongLongWidth, LongLongAlign;
|
unsigned char LongLongWidth, LongLongAlign;
|
||||||
|
|
||||||
|
@ -114,8 +116,8 @@ public:
|
||||||
unsigned getWCharAlign() const { return WCharAlign; }
|
unsigned getWCharAlign() const { return WCharAlign; }
|
||||||
|
|
||||||
/// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
|
/// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
|
||||||
unsigned getFloatWidth() const { return 32; } // FIXME
|
unsigned getFloatWidth() const { return FloatWidth; }
|
||||||
unsigned getFloatAlign() const { return 32; } // FIXME
|
unsigned getFloatAlign() const { return FloatAlign; }
|
||||||
const llvm::fltSemantics *getFloatFormat() const { return FloatFormat; }
|
const llvm::fltSemantics *getFloatFormat() const { return FloatFormat; }
|
||||||
|
|
||||||
/// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
|
/// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
|
||||||
|
@ -125,8 +127,8 @@ public:
|
||||||
|
|
||||||
/// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
|
/// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
|
||||||
/// double'.
|
/// double'.
|
||||||
unsigned getLongDoubleWidth() const { return 64; } // FIXME
|
unsigned getLongDoubleWidth() const { return LongDoubleWidth; }
|
||||||
unsigned getLongDoubleAlign() const { return 64; } // FIXME
|
unsigned getLongDoubleAlign() const { return LongDoubleAlign; }
|
||||||
const llvm::fltSemantics *getLongDoubleFormat() const {
|
const llvm::fltSemantics *getLongDoubleFormat() const {
|
||||||
return LongDoubleFormat;
|
return LongDoubleFormat;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,21 @@ using namespace clang;
|
||||||
|
|
||||||
// TargetInfo Constructor.
|
// TargetInfo Constructor.
|
||||||
TargetInfo::TargetInfo(const std::string &T) : Triple(T) {
|
TargetInfo::TargetInfo(const std::string &T) : Triple(T) {
|
||||||
// Set defaults. These should be overridden by concrete targets as needed.
|
// Set defaults. Defaults are set for a 32-bit RISC platform,
|
||||||
|
// like PPC or SPARC.
|
||||||
|
// These should be overridden by concrete targets as needed.
|
||||||
CharIsSigned = true;
|
CharIsSigned = true;
|
||||||
PointerWidth = PointerAlign = 32;
|
PointerWidth = PointerAlign = 32;
|
||||||
WCharWidth = WCharAlign = 32;
|
WCharWidth = WCharAlign = 32;
|
||||||
IntWidth = IntAlign = 32;
|
IntWidth = IntAlign = 32;
|
||||||
LongWidth = LongAlign = 32;
|
LongWidth = LongAlign = 32;
|
||||||
LongLongWidth = LongLongAlign = 64;
|
LongLongWidth = LongLongAlign = 64;
|
||||||
|
FloatWidth = 32;
|
||||||
|
FloatAlign = 32;
|
||||||
DoubleWidth = 64;
|
DoubleWidth = 64;
|
||||||
DoubleAlign = 32;
|
DoubleAlign = 64;
|
||||||
|
LongDoubleWidth = 64;
|
||||||
|
LongDoubleAlign = 64;
|
||||||
FloatFormat = &llvm::APFloat::IEEEsingle;
|
FloatFormat = &llvm::APFloat::IEEEsingle;
|
||||||
DoubleFormat = &llvm::APFloat::IEEEdouble;
|
DoubleFormat = &llvm::APFloat::IEEEdouble;
|
||||||
LongDoubleFormat = &llvm::APFloat::IEEEdouble;
|
LongDoubleFormat = &llvm::APFloat::IEEEdouble;
|
||||||
|
|
|
@ -697,8 +697,13 @@ public:
|
||||||
namespace {
|
namespace {
|
||||||
class DarwinI386TargetInfo : public DarwinTargetInfo {
|
class DarwinI386TargetInfo : public DarwinTargetInfo {
|
||||||
public:
|
public:
|
||||||
DarwinI386TargetInfo(const std::string& triple) : DarwinTargetInfo(triple) {}
|
DarwinI386TargetInfo(const std::string& triple) : DarwinTargetInfo(triple) {
|
||||||
|
DoubleAlign = LongLongAlign = 32;
|
||||||
|
LongDoubleWidth = 96;
|
||||||
|
LongDoubleAlign = 32;
|
||||||
|
LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void getTargetDefines(std::vector<char> &Defines) const {
|
virtual void getTargetDefines(std::vector<char> &Defines) const {
|
||||||
DarwinTargetInfo::getTargetDefines(Defines);
|
DarwinTargetInfo::getTargetDefines(Defines);
|
||||||
getX86Defines(Defines, false);
|
getX86Defines(Defines, false);
|
||||||
|
@ -741,6 +746,9 @@ class DarwinX86_64TargetInfo : public DarwinTargetInfo {
|
||||||
public:
|
public:
|
||||||
DarwinX86_64TargetInfo(const std::string& triple) : DarwinTargetInfo(triple) {
|
DarwinX86_64TargetInfo(const std::string& triple) : DarwinTargetInfo(triple) {
|
||||||
LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
|
LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
|
||||||
|
LongDoubleWidth = 128;
|
||||||
|
LongDoubleAlign = 128;
|
||||||
|
LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void getTargetDefines(std::vector<char> &Defines) const {
|
virtual void getTargetDefines(std::vector<char> &Defines) const {
|
||||||
|
@ -782,7 +790,9 @@ public:
|
||||||
namespace {
|
namespace {
|
||||||
class DarwinARMTargetInfo : public DarwinTargetInfo {
|
class DarwinARMTargetInfo : public DarwinTargetInfo {
|
||||||
public:
|
public:
|
||||||
DarwinARMTargetInfo(const std::string& triple) :DarwinTargetInfo(triple) {}
|
DarwinARMTargetInfo(const std::string& triple) :DarwinTargetInfo(triple) {
|
||||||
|
// FIXME: Are the defaults corrent for ARM?
|
||||||
|
}
|
||||||
|
|
||||||
virtual void getTargetDefines(std::vector<char> &Defines) const {
|
virtual void getTargetDefines(std::vector<char> &Defines) const {
|
||||||
DarwinTargetInfo::getTargetDefines(Defines);
|
DarwinTargetInfo::getTargetDefines(Defines);
|
||||||
|
@ -871,7 +881,10 @@ namespace {
|
||||||
class PIC16TargetInfo : public TargetInfo{
|
class PIC16TargetInfo : public TargetInfo{
|
||||||
public:
|
public:
|
||||||
PIC16TargetInfo(const std::string& triple) : TargetInfo(triple) {
|
PIC16TargetInfo(const std::string& triple) : TargetInfo(triple) {
|
||||||
IntWidth = IntAlign = 16;
|
// FIXME: Is IntAlign really supposed to be 16? There seems
|
||||||
|
// little point on a platform with 8-bit loads.
|
||||||
|
IntWidth = IntAlign = LongAlign = LongLongAlign = PointerWidth = 16;
|
||||||
|
PointerAlign = 8;
|
||||||
}
|
}
|
||||||
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return 16; }
|
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return 16; }
|
||||||
virtual uint64_t getPointerAlignV(unsigned AddrSpace) const { return 8; }
|
virtual uint64_t getPointerAlignV(unsigned AddrSpace) const { return 8; }
|
||||||
|
@ -909,25 +922,25 @@ static inline bool IsX86(const std::string& TT) {
|
||||||
TargetInfo* TargetInfo::CreateTargetInfo(const std::string &T) {
|
TargetInfo* TargetInfo::CreateTargetInfo(const std::string &T) {
|
||||||
if (T.find("ppc-") == 0 || T.find("powerpc-") == 0)
|
if (T.find("ppc-") == 0 || T.find("powerpc-") == 0)
|
||||||
return new DarwinPPCTargetInfo(T);
|
return new DarwinPPCTargetInfo(T);
|
||||||
|
|
||||||
if (T.find("ppc64-") == 0 || T.find("powerpc64-") == 0)
|
if (T.find("ppc64-") == 0 || T.find("powerpc64-") == 0)
|
||||||
return new DarwinPPC64TargetInfo(T);
|
return new DarwinPPC64TargetInfo(T);
|
||||||
|
|
||||||
if (T.find("armv6-") == 0 || T.find("arm-") == 0)
|
if (T.find("armv6-") == 0 || T.find("arm-") == 0)
|
||||||
return new DarwinARMTargetInfo(T);
|
return new DarwinARMTargetInfo(T);
|
||||||
|
|
||||||
if (T.find("sparc-") == 0)
|
if (T.find("sparc-") == 0)
|
||||||
return new SolarisSparcV8TargetInfo(T); // ugly hack
|
return new SolarisSparcV8TargetInfo(T); // ugly hack
|
||||||
|
|
||||||
if (T.find("x86_64-") == 0)
|
if (T.find("x86_64-") == 0)
|
||||||
return new DarwinX86_64TargetInfo(T);
|
return new DarwinX86_64TargetInfo(T);
|
||||||
|
|
||||||
if (T.find("pic16-") == 0)
|
if (T.find("pic16-") == 0)
|
||||||
return new PIC16TargetInfo(T);
|
return new PIC16TargetInfo(T);
|
||||||
|
|
||||||
if (IsX86(T))
|
if (IsX86(T))
|
||||||
return new DarwinI386TargetInfo(T);
|
return new DarwinI386TargetInfo(T);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue