[cfe-commits] r86878 - in /cfe/trunk/lib/CodeGen: CGVtable.cpp CGVtable.h CodeGenModule.h
Mike Stump
mrs at apple.com
Wed Nov 11 12:26:27 PST 2009
Author: mrs
Date: Wed Nov 11 14:26:26 2009
New Revision: 86878
URL: http://llvm.org/viewvc/llvm-project?rev=86878&view=rev
Log:
Push ctor vtable construction down further. WIP.
Modified:
cfe/trunk/lib/CodeGen/CGVtable.cpp
cfe/trunk/lib/CodeGen/CGVtable.h
cfe/trunk/lib/CodeGen/CodeGenModule.h
Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=86878&r1=86877&r2=86878&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Wed Nov 11 14:26:26 2009
@@ -681,10 +681,15 @@
return I->second;
}
-llvm::Constant *CodeGenModule::GenerateVtable(const CXXRecordDecl *RD) {
+llvm::Constant *CodeGenModule::GenerateVtable(const CXXRecordDecl *RD,
+ const CXXRecordDecl *LayoutClass,
+ uint64_t Offset) {
llvm::SmallString<256> OutName;
llvm::raw_svector_ostream Out(OutName);
- mangleCXXVtable(getMangleContext(), RD, Out);
+ if (LayoutClass)
+ mangleCXXCtorVtable(getMangleContext(), RD, Offset, LayoutClass, Out);
+ else
+ mangleCXXVtable(getMangleContext(), RD, Out);
llvm::GlobalVariable::LinkageTypes linktype;
linktype = llvm::GlobalValue::LinkOnceODRLinkage;
@@ -754,7 +759,7 @@
&& !NonVirtualPrimaryBase) {
// FIXME: Slightly too many of these for __ZTT8test8_B2
llvm::Constant *vtbl;
- vtbl = CGM.getVtableInfo().getVtable(Base, Class, BaseOffset/8);
+ vtbl = CGM.getVtableInfo().getCtorVtable(Base, Class, BaseOffset/8);
Inits.push_back(vtbl);
}
Secondary(Base, BaseOffset, BaseMorallyVirtual);
@@ -768,7 +773,7 @@
return;
// First comes the primary virtual table pointer...
- Inits.push_back(CGM.getVtableInfo().getVtable(RD, Class, Offset));
+ Inits.push_back(CGM.getVtableInfo().getCtorVtable(RD, Class, Offset));
// then the secondary VTTs....
SecondaryVTTs(RD, MorallyVirtual);
@@ -852,10 +857,7 @@
return vtt;
}
-llvm::Constant *CGVtableInfo::getVtable(const CXXRecordDecl *RD,
- const CXXRecordDecl *Class,
- uint64_t Offset) {
- // FIXME: Add ctor vtable support
+llvm::Constant *CGVtableInfo::getVtable(const CXXRecordDecl *RD) {
llvm::Constant *&vtbl = Vtables[RD];
if (vtbl)
return vtbl;
@@ -863,3 +865,9 @@
CGM.GenerateVTT(RD);
return vtbl;
}
+
+llvm::Constant *CGVtableInfo::getCtorVtable(const CXXRecordDecl *RD,
+ const CXXRecordDecl *Class,
+ uint64_t Offset) {
+ return CGM.GenerateVtable(RD, Class, Offset);
+}
Modified: cfe/trunk/lib/CodeGen/CGVtable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.h?rev=86878&r1=86877&r2=86878&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.h (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.h Wed Nov 11 14:26:26 2009
@@ -57,8 +57,9 @@
int64_t getVirtualBaseOffsetIndex(const CXXRecordDecl *RD,
const CXXRecordDecl *VBase);
- llvm::Constant *getVtable(const CXXRecordDecl *RD,
- const CXXRecordDecl *Class=0, uint64_t Offset=0);
+ llvm::Constant *getVtable(const CXXRecordDecl *RD);
+ llvm::Constant *getCtorVtable(const CXXRecordDecl *RD,
+ const CXXRecordDecl *Class, uint64_t Offset);
};
}
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=86878&r1=86877&r2=86878&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Wed Nov 11 14:26:26 2009
@@ -253,7 +253,9 @@
const llvm::Type *Ty = 0);
/// GenerateVtable - Generate the vtable for the given type.
- llvm::Constant *GenerateVtable(const CXXRecordDecl *RD);
+ llvm::Constant *GenerateVtable(const CXXRecordDecl *RD,
+ const CXXRecordDecl *Class=0,
+ uint64_t Offset=0);
/// GenerateVTT - Generate the VTT for the given type.
llvm::Constant *GenerateVTT(const CXXRecordDecl *RD);
More information about the cfe-commits
mailing list