do not store wchar/char16/char32/intmax width/alignment info
into TargetInfo, just derive this based on the underlying type. This prevents them from getting out of synch, patch by Ken Dyck! llvm-svn: 86976
This commit is contained in:
@@ -44,16 +44,12 @@ protected:
|
|||||||
// values are specified by the TargetInfo constructor.
|
// values are specified by the TargetInfo constructor.
|
||||||
bool TLSSupported;
|
bool TLSSupported;
|
||||||
unsigned char PointerWidth, PointerAlign;
|
unsigned char PointerWidth, PointerAlign;
|
||||||
unsigned char WCharWidth, WCharAlign;
|
|
||||||
unsigned char Char16Width, Char16Align;
|
|
||||||
unsigned char Char32Width, Char32Align;
|
|
||||||
unsigned char IntWidth, IntAlign;
|
unsigned char IntWidth, IntAlign;
|
||||||
unsigned char FloatWidth, FloatAlign;
|
unsigned char FloatWidth, FloatAlign;
|
||||||
unsigned char DoubleWidth, DoubleAlign;
|
unsigned char DoubleWidth, DoubleAlign;
|
||||||
unsigned char LongDoubleWidth, LongDoubleAlign;
|
unsigned char LongDoubleWidth, LongDoubleAlign;
|
||||||
unsigned char LongWidth, LongAlign;
|
unsigned char LongWidth, LongAlign;
|
||||||
unsigned char LongLongWidth, LongLongAlign;
|
unsigned char LongLongWidth, LongLongAlign;
|
||||||
unsigned char IntMaxTWidth;
|
|
||||||
const char *DescriptionString;
|
const char *DescriptionString;
|
||||||
const char *UserLabelPrefix;
|
const char *UserLabelPrefix;
|
||||||
const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
|
const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
|
||||||
@@ -150,18 +146,18 @@ public:
|
|||||||
|
|
||||||
/// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
|
/// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
|
||||||
/// bits.
|
/// bits.
|
||||||
unsigned getWCharWidth() const { return WCharWidth; }
|
unsigned getWCharWidth() const { return getTypeWidth(WCharType); }
|
||||||
unsigned getWCharAlign() const { return WCharAlign; }
|
unsigned getWCharAlign() const { return getTypeAlign(WCharType); }
|
||||||
|
|
||||||
/// getChar16Width/Align - Return the size of 'char16_t' for this target, in
|
/// getChar16Width/Align - Return the size of 'char16_t' for this target, in
|
||||||
/// bits.
|
/// bits.
|
||||||
unsigned getChar16Width() const { return Char16Width; }
|
unsigned getChar16Width() const { return getTypeWidth(Char16Type); }
|
||||||
unsigned getChar16Align() const { return Char16Align; }
|
unsigned getChar16Align() const { return getTypeAlign(Char16Type); }
|
||||||
|
|
||||||
/// getChar32Width/Align - Return the size of 'char32_t' for this target, in
|
/// getChar32Width/Align - Return the size of 'char32_t' for this target, in
|
||||||
/// bits.
|
/// bits.
|
||||||
unsigned getChar32Width() const { return Char32Width; }
|
unsigned getChar32Width() const { return getTypeWidth(Char32Type); }
|
||||||
unsigned getChar32Align() const { return Char32Align; }
|
unsigned getChar32Align() const { return getTypeAlign(Char32Type); }
|
||||||
|
|
||||||
/// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
|
/// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
|
||||||
unsigned getFloatWidth() const { return FloatWidth; }
|
unsigned getFloatWidth() const { return FloatWidth; }
|
||||||
@@ -184,7 +180,7 @@ public:
|
|||||||
/// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this
|
/// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this
|
||||||
/// target, in bits.
|
/// target, in bits.
|
||||||
unsigned getIntMaxTWidth() const {
|
unsigned getIntMaxTWidth() const {
|
||||||
return IntMaxTWidth;
|
return getTypeWidth(IntMaxType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getUserLabelPrefix - This returns the default value of the
|
/// getUserLabelPrefix - This returns the default value of the
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ TargetInfo::TargetInfo(const std::string &T) : Triple(T) {
|
|||||||
// These should be overridden by concrete targets as needed.
|
// These should be overridden by concrete targets as needed.
|
||||||
TLSSupported = true;
|
TLSSupported = true;
|
||||||
PointerWidth = PointerAlign = 32;
|
PointerWidth = PointerAlign = 32;
|
||||||
WCharWidth = WCharAlign = 32;
|
|
||||||
Char16Width = Char16Align = 16;
|
|
||||||
Char32Width = Char32Align = 32;
|
|
||||||
IntWidth = IntAlign = 32;
|
IntWidth = IntAlign = 32;
|
||||||
LongWidth = LongAlign = 32;
|
LongWidth = LongAlign = 32;
|
||||||
LongLongWidth = LongLongAlign = 64;
|
LongLongWidth = LongLongAlign = 64;
|
||||||
@@ -37,7 +34,6 @@ TargetInfo::TargetInfo(const std::string &T) : Triple(T) {
|
|||||||
DoubleAlign = 64;
|
DoubleAlign = 64;
|
||||||
LongDoubleWidth = 64;
|
LongDoubleWidth = 64;
|
||||||
LongDoubleAlign = 64;
|
LongDoubleAlign = 64;
|
||||||
IntMaxTWidth = 64;
|
|
||||||
SizeType = UnsignedLong;
|
SizeType = UnsignedLong;
|
||||||
PtrDiffType = SignedLong;
|
PtrDiffType = SignedLong;
|
||||||
IntMaxType = SignedLongLong;
|
IntMaxType = SignedLongLong;
|
||||||
@@ -147,7 +143,6 @@ bool TargetInfo::isTypeSigned(IntType T) const {
|
|||||||
void TargetInfo::setForcedLangOptions(LangOptions &Opts) {
|
void TargetInfo::setForcedLangOptions(LangOptions &Opts) {
|
||||||
if (Opts.ShortWChar) {
|
if (Opts.ShortWChar) {
|
||||||
WCharType = UnsignedShort;
|
WCharType = UnsignedShort;
|
||||||
WCharWidth = WCharAlign = 16;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -962,7 +962,6 @@ public:
|
|||||||
: X86_32TargetInfo(triple) {
|
: X86_32TargetInfo(triple) {
|
||||||
TLSSupported = false;
|
TLSSupported = false;
|
||||||
WCharType = UnsignedShort;
|
WCharType = UnsignedShort;
|
||||||
WCharWidth = WCharAlign = 16;
|
|
||||||
DoubleAlign = LongLongAlign = 64;
|
DoubleAlign = LongLongAlign = 64;
|
||||||
DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
|
DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
|
||||||
"i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-"
|
"i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-"
|
||||||
@@ -1033,7 +1032,6 @@ public:
|
|||||||
: X86_32TargetInfo(triple) {
|
: X86_32TargetInfo(triple) {
|
||||||
TLSSupported = false;
|
TLSSupported = false;
|
||||||
WCharType = UnsignedShort;
|
WCharType = UnsignedShort;
|
||||||
WCharWidth = WCharAlign = 16;
|
|
||||||
DoubleAlign = LongLongAlign = 64;
|
DoubleAlign = LongLongAlign = 64;
|
||||||
DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
|
DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
|
||||||
"i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-"
|
"i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-"
|
||||||
@@ -1092,7 +1090,6 @@ public:
|
|||||||
: X86_64TargetInfo(triple) {
|
: X86_64TargetInfo(triple) {
|
||||||
TLSSupported = false;
|
TLSSupported = false;
|
||||||
WCharType = UnsignedShort;
|
WCharType = UnsignedShort;
|
||||||
WCharWidth = WCharAlign = 16;
|
|
||||||
LongWidth = LongAlign = 32;
|
LongWidth = LongAlign = 32;
|
||||||
DoubleAlign = LongLongAlign = 64;
|
DoubleAlign = LongLongAlign = 64;
|
||||||
}
|
}
|
||||||
@@ -1507,7 +1504,6 @@ namespace {
|
|||||||
TLSSupported = false;
|
TLSSupported = false;
|
||||||
IntWidth = 16;
|
IntWidth = 16;
|
||||||
LongWidth = LongLongWidth = 32;
|
LongWidth = LongLongWidth = 32;
|
||||||
IntMaxTWidth = 32;
|
|
||||||
PointerWidth = 16;
|
PointerWidth = 16;
|
||||||
IntAlign = 8;
|
IntAlign = 8;
|
||||||
LongAlign = LongLongAlign = 8;
|
LongAlign = LongLongAlign = 8;
|
||||||
@@ -1575,7 +1571,6 @@ namespace {
|
|||||||
TLSSupported = false;
|
TLSSupported = false;
|
||||||
IntWidth = 16;
|
IntWidth = 16;
|
||||||
LongWidth = LongLongWidth = 32;
|
LongWidth = LongLongWidth = 32;
|
||||||
IntMaxTWidth = 32;
|
|
||||||
PointerWidth = 16;
|
PointerWidth = 16;
|
||||||
IntAlign = 8;
|
IntAlign = 8;
|
||||||
LongAlign = LongLongAlign = 8;
|
LongAlign = LongLongAlign = 8;
|
||||||
@@ -1789,7 +1784,6 @@ namespace {
|
|||||||
TLSSupported = false;
|
TLSSupported = false;
|
||||||
IntWidth = 32;
|
IntWidth = 32;
|
||||||
LongWidth = LongLongWidth = 32;
|
LongWidth = LongLongWidth = 32;
|
||||||
IntMaxTWidth = 32;
|
|
||||||
PointerWidth = 32;
|
PointerWidth = 32;
|
||||||
IntAlign = 32;
|
IntAlign = 32;
|
||||||
LongAlign = LongLongAlign = 32;
|
LongAlign = LongLongAlign = 32;
|
||||||
|
|||||||
@@ -364,11 +364,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
|||||||
DefineTypeSize("__INT_MAX__", TargetInfo::SignedInt, TI, Buf);
|
DefineTypeSize("__INT_MAX__", TargetInfo::SignedInt, TI, Buf);
|
||||||
DefineTypeSize("__LONG_MAX__", TargetInfo::SignedLong, TI, Buf);
|
DefineTypeSize("__LONG_MAX__", TargetInfo::SignedLong, TI, Buf);
|
||||||
DefineTypeSize("__LONG_LONG_MAX__", TargetInfo::SignedLongLong, TI, Buf);
|
DefineTypeSize("__LONG_LONG_MAX__", TargetInfo::SignedLongLong, TI, Buf);
|
||||||
// FIXME: TI.getWCharWidth() and TI.getTypeWidth(TI.getWCharType()) return
|
DefineTypeSize("__WCHAR_MAX__", TI.getWCharType(), TI, Buf);
|
||||||
// different values on PIC16 and MSP430. TargetInfo needs to be corrected
|
|
||||||
// and the following line substituted for the one below it.
|
|
||||||
// DefineTypeSize("__WCHAR_MAX__", TI.getWCharType(), TI, Buf);
|
|
||||||
DefineTypeSize("__WCHAR_MAX__", TI.getWCharWidth(), "", true, Buf);
|
|
||||||
DefineTypeSize("__INTMAX_MAX__", TI.getIntMaxType(), TI, Buf);
|
DefineTypeSize("__INTMAX_MAX__", TI.getIntMaxType(), TI, Buf);
|
||||||
|
|
||||||
DefineType("__INTMAX_TYPE__", TI.getIntMaxType(), Buf);
|
DefineType("__INTMAX_TYPE__", TI.getIntMaxType(), Buf);
|
||||||
|
|||||||
@@ -408,7 +408,7 @@
|
|||||||
// MSP430:#define __SIZE_TYPE__ unsigned int
|
// MSP430:#define __SIZE_TYPE__ unsigned int
|
||||||
// MSP430:#define __UINTMAX_TYPE__ long unsigned int
|
// MSP430:#define __UINTMAX_TYPE__ long unsigned int
|
||||||
// MSP430:#define __USER_LABEL_PREFIX__ _
|
// MSP430:#define __USER_LABEL_PREFIX__ _
|
||||||
// MSP430:#define __WCHAR_MAX__ 2147483647
|
// MSP430:#define __WCHAR_MAX__ 32767
|
||||||
// MSP430:#define __WCHAR_TYPE__ int
|
// MSP430:#define __WCHAR_TYPE__ int
|
||||||
// MSP430:#define __WINT_TYPE__ int
|
// MSP430:#define __WINT_TYPE__ int
|
||||||
// MSP430:#define __clang__ 1
|
// MSP430:#define __clang__ 1
|
||||||
@@ -476,7 +476,7 @@
|
|||||||
// PIC16:#define __SIZE_TYPE__ unsigned int
|
// PIC16:#define __SIZE_TYPE__ unsigned int
|
||||||
// PIC16:#define __UINTMAX_TYPE__ long unsigned int
|
// PIC16:#define __UINTMAX_TYPE__ long unsigned int
|
||||||
// PIC16:#define __USER_LABEL_PREFIX__ _
|
// PIC16:#define __USER_LABEL_PREFIX__ _
|
||||||
// PIC16:#define __WCHAR_MAX__ 2147483647
|
// PIC16:#define __WCHAR_MAX__ 32767
|
||||||
// PIC16:#define __WCHAR_TYPE__ int
|
// PIC16:#define __WCHAR_TYPE__ int
|
||||||
// PIC16:#define __WINT_TYPE__ int
|
// PIC16:#define __WINT_TYPE__ int
|
||||||
// PIC16:#define __clang__ 1
|
// PIC16:#define __clang__ 1
|
||||||
|
|||||||
@@ -406,8 +406,8 @@
|
|||||||
// MSP430:WINT_MIN_ (-2147483647 -1)
|
// MSP430:WINT_MIN_ (-2147483647 -1)
|
||||||
// MSP430:WINT_MAX_ 2147483647
|
// MSP430:WINT_MAX_ 2147483647
|
||||||
//
|
//
|
||||||
// MSP430:WCHAR_MAX_ 2147483647
|
// MSP430:WCHAR_MAX_ 32767
|
||||||
// MSP430:WCHAR_MIN_ (-2147483647 -1)
|
// MSP430:WCHAR_MIN_ (-32767 -1)
|
||||||
//
|
//
|
||||||
// MSP430:INT8_C_(0) (0)
|
// MSP430:INT8_C_(0) (0)
|
||||||
// MSP430:UINT8_C_(0) (0U)
|
// MSP430:UINT8_C_(0) (0U)
|
||||||
@@ -506,8 +506,8 @@
|
|||||||
// PIC16:WINT_MIN_ (-2147483647 -1)
|
// PIC16:WINT_MIN_ (-2147483647 -1)
|
||||||
// PIC16:WINT_MAX_ 2147483647
|
// PIC16:WINT_MAX_ 2147483647
|
||||||
//
|
//
|
||||||
// PIC16:WCHAR_MAX_ 2147483647
|
// PIC16:WCHAR_MAX_ 32767
|
||||||
// PIC16:WCHAR_MIN_ (-2147483647 -1)
|
// PIC16:WCHAR_MIN_ (-32767 -1)
|
||||||
//
|
//
|
||||||
// PIC16:INT8_C_(0) (0)
|
// PIC16:INT8_C_(0) (0)
|
||||||
// PIC16:UINT8_C_(0) (0U)
|
// PIC16:UINT8_C_(0) (0U)
|
||||||
|
|||||||
Reference in New Issue
Block a user