diff options
author | Mike Stump <mrs@apple.com> | 2009-11-11 20:26:26 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-11-11 20:26:26 +0000 |
commit | eac4559790341f25f382d245784b1e61608b1352 (patch) | |
tree | dfc406e1e9e02331ec458d42bf62d9cdd6e9ce7c /clang | |
parent | 7cf8238291279cd8588d6b6f73e9ef3432acb66e (diff) | |
download | bcm5719-llvm-eac4559790341f25f382d245784b1e61608b1352.tar.gz bcm5719-llvm-eac4559790341f25f382d245784b1e61608b1352.zip |
Push ctor vtable construction down further. WIP.
llvm-svn: 86878
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGVtable.cpp | 24 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGVtable.h | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 4 |
3 files changed, 22 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp index 4d3c3a595dd..233bdafd4f6 100644 --- a/clang/lib/CodeGen/CGVtable.cpp +++ b/clang/lib/CodeGen/CGVtable.cpp @@ -681,10 +681,15 @@ int64_t CGVtableInfo::getVirtualBaseOffsetIndex(const CXXRecordDecl *RD, 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 @@ class VTTBuilder { && !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 @@ class VTTBuilder { 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 @@ llvm::Constant *CodeGenModule::GenerateVTT(const CXXRecordDecl *RD) { 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 @@ llvm::Constant *CGVtableInfo::getVtable(const CXXRecordDecl *RD, CGM.GenerateVTT(RD); return vtbl; } + +llvm::Constant *CGVtableInfo::getCtorVtable(const CXXRecordDecl *RD, + const CXXRecordDecl *Class, + uint64_t Offset) { + return CGM.GenerateVtable(RD, Class, Offset); +} diff --git a/clang/lib/CodeGen/CGVtable.h b/clang/lib/CodeGen/CGVtable.h index 9620e42aab6..7ad42b59fb6 100644 --- a/clang/lib/CodeGen/CGVtable.h +++ b/clang/lib/CodeGen/CGVtable.h @@ -57,8 +57,9 @@ public: 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); }; } diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 6c433d9d66b..990706d11fc 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -253,7 +253,9 @@ public: 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); |