r259616 - Fix Itanium RTTI emission so that we emit fundamental type information into the
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 2 17:32:43 PST 2016
Author: rsmith
Date: Tue Feb 2 19:32:42 2016
New Revision: 259616
URL: http://llvm.org/viewvc/llvm-project?rev=259616&view=rev
Log:
Fix Itanium RTTI emission so that we emit fundamental type information into the
C++ ABI library for the same set of types for which we expect the C++ ABI
library to provide the RTTI.
Specifically:
1) __int128 and unsigned __int128 are now emitted into the ABI library. We
always expected them to be there but never actually made sure to emit them.
2) Do not expect OpenCL builtin types to have type info in the C++ ABI library.
Neither libc++abi nor libstdc++ puts them there when built with either GCC
or Clang.
This matches GCC's behavior.
Modified:
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/rtti-fundamental.cpp
Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=259616&r1=259615&r2=259616&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Tue Feb 2 19:32:42 2016
@@ -2508,6 +2508,11 @@ static bool TypeInfoIsInStandardLibrary(
// long, unsigned long, long long, unsigned long long, float, double,
// long double, char16_t, char32_t, and the IEEE 754r decimal and
// half-precision floating point types.
+ //
+ // GCC also emits RTTI for __int128.
+ // FIXME: We do not emit RTTI information for decimal types here.
+
+ // Types added here must also be added to EmitFundamentalRTTIDescriptors.
switch (Ty->getKind()) {
case BuiltinType::Void:
case BuiltinType::NullPtr:
@@ -2534,6 +2539,8 @@ static bool TypeInfoIsInStandardLibrary(
case BuiltinType::Char32:
case BuiltinType::Int128:
case BuiltinType::UInt128:
+ return true;
+
case BuiltinType::OCLImage1d:
case BuiltinType::OCLImage1dArray:
case BuiltinType::OCLImage1dBuffer:
@@ -2552,7 +2559,7 @@ static bool TypeInfoIsInStandardLibrary(
case BuiltinType::OCLQueue:
case BuiltinType::OCLNDRange:
case BuiltinType::OCLReserveID:
- return true;
+ return false;
case BuiltinType::Dependent:
#define BUILTIN_TYPE(Id, SingletonId)
@@ -3344,6 +3351,7 @@ void ItaniumCXXABI::EmitFundamentalRTTID
}
void ItaniumCXXABI::EmitFundamentalRTTIDescriptors() {
+ // Types added here must also be added to TypeInfoIsInStandardLibrary.
QualType FundamentalTypes[] = {
getContext().VoidTy, getContext().NullPtrTy,
getContext().BoolTy, getContext().WCharTy,
@@ -3352,7 +3360,8 @@ void ItaniumCXXABI::EmitFundamentalRTTID
getContext().UnsignedShortTy, getContext().IntTy,
getContext().UnsignedIntTy, getContext().LongTy,
getContext().UnsignedLongTy, getContext().LongLongTy,
- getContext().UnsignedLongLongTy, getContext().HalfTy,
+ getContext().UnsignedLongLongTy, getContext().Int128Ty,
+ getContext().UnsignedInt128Ty, getContext().HalfTy,
getContext().FloatTy, getContext().DoubleTy,
getContext().LongDoubleTy, getContext().Char16Ty,
getContext().Char32Ty,
Modified: cfe/trunk/test/CodeGenCXX/rtti-fundamental.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/rtti-fundamental.cpp?rev=259616&r1=259615&r2=259616&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/rtti-fundamental.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/rtti-fundamental.cpp Tue Feb 2 19:32:42 2016
@@ -89,6 +89,16 @@ namespace __cxxabiv1 {
// CHECK: @_ZTIPy = constant
// CHECK: @_ZTIPKy = constant
+// __int128
+// CHECK: @_ZTIn = constant
+// CHECK: @_ZTIPn = constant
+// CHECK: @_ZTIPKn = constant
+
+// unsigned __int128
+// CHECK: @_ZTIo = constant
+// CHECK: @_ZTIPo = constant
+// CHECK: @_ZTIPKo = constant
+
// half
// CHECK: @_ZTIDh = constant
// CHECK: @_ZTIPDh = constant
More information about the cfe-commits
mailing list