aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGRTTI.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-08 15:52:03 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-08 15:52:03 +0000
commit1e201b4a9d4880c3f90ab77e8a308140f003c7da (patch)
treea21e350910396eb75dd0b05e1011dd36efa37bb5 /lib/CodeGen/CGRTTI.cpp
parent71c972acd4a2cb5e369e35471dbb719185913cdc (diff)
Eliminate excessive PCH deserialization caused by the search for
__cxxabiv1::__fundamental_type_info in every translation unit. Previously, we would perform name lookup for __cxxabiv1::__fundamental_type_info at the end of IRGen for a each translation unit, to determine whether it was present. If so, we we produce type information for all of the fundamental types. However, this name lookup causes PCH deserialization of a significant part of the translation unit, which has a woeful impact on performance. With this change, we now look at each record type after we've generated its vtable to see if it is __cxxabiv1::__fundamental_type_info. If so, we generate type info for all of the fundamental types. This works because __cxxabiv1::__fundamental_type_info should always have a key function (typically the virtual destructor), that will be defined once in the support library. The fundamental type information will end up there. Fixes <rdar://problem/7840011>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100772 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGRTTI.cpp')
-rw-r--r--lib/CodeGen/CGRTTI.cpp35
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp
index 1caec97fc3..4e24bd26aa 100644
--- a/lib/CodeGen/CGRTTI.cpp
+++ b/lib/CodeGen/CGRTTI.cpp
@@ -791,35 +791,6 @@ llvm::Constant *CodeGenModule::GetAddrOfRTTIDescriptor(QualType Ty) {
return RTTIBuilder(*this).BuildTypeInfo(Ty);
}
-// Try to find the magic class __cxxabiv1::__fundamental_type_info. If
-// exists and has a destructor, we will emit the typeinfo for the fundamental
-// types. This is the same behaviour as GCC.
-static CXXRecordDecl *FindMagicClass(ASTContext &AC) {
- const IdentifierInfo &NamespaceII = AC.Idents.get("__cxxabiv1");
- DeclarationName NamespaceDN = AC.DeclarationNames.getIdentifier(&NamespaceII);
- TranslationUnitDecl *TUD = AC.getTranslationUnitDecl();
- DeclContext::lookup_result NamespaceLookup = TUD->lookup(NamespaceDN);
- if (NamespaceLookup.first == NamespaceLookup.second)
- return NULL;
- const NamespaceDecl *Namespace =
- dyn_cast<NamespaceDecl>(*NamespaceLookup.first);
- if (!Namespace)
- return NULL;
-
- const IdentifierInfo &ClassII = AC.Idents.get("__fundamental_type_info");
- DeclarationName ClassDN = AC.DeclarationNames.getIdentifier(&ClassII);
- DeclContext::lookup_const_result ClassLookup = Namespace->lookup(ClassDN);
- if (ClassLookup.first == ClassLookup.second)
- return NULL;
- CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(*ClassLookup.first);
-
- if (Class->hasDefinition() && Class->isDynamicClass() &&
- Class->getDestructor(AC))
- return Class;
-
- return NULL;
-}
-
void CodeGenModule::EmitFundamentalRTTIDescriptor(QualType Type) {
QualType PointerType = Context.getPointerType(Type);
QualType PointerTypeConst = Context.getPointerType(Type.withConst());
@@ -829,12 +800,6 @@ void CodeGenModule::EmitFundamentalRTTIDescriptor(QualType Type) {
}
void CodeGenModule::EmitFundamentalRTTIDescriptors() {
- CXXRecordDecl *RD = FindMagicClass(getContext());
- if (!RD)
- return;
-
- getVTables().GenerateClassData(getVtableLinkage(RD), RD);
-
QualType FundamentalTypes[] = { Context.VoidTy, Context.Char32Ty,
Context.Char16Ty, Context.UnsignedLongLongTy,
Context.LongLongTy, Context.WCharTy,