[cfe-commits] r159091 - in /cfe/trunk/lib/CodeGen: CGCXXABI.h CodeGenModule.cpp ItaniumCXXABI.cpp MicrosoftCXXABI.cpp
Charles Davis
cdavis at mines.edu
Sat Jun 23 16:44:00 PDT 2012
Author: cdavis
Date: Sat Jun 23 18:44:00 2012
New Revision: 159091
URL: http://llvm.org/viewvc/llvm-project?rev=159091&view=rev
Log:
IRGen: Factor v-table generation into the CGCXXABI object.
Modified:
cfe/trunk/lib/CodeGen/CGCXXABI.h
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
Modified: cfe/trunk/lib/CodeGen/CGCXXABI.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXABI.h?rev=159091&r1=159090&r2=159091&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXXABI.h (original)
+++ cfe/trunk/lib/CodeGen/CGCXXABI.h Sat Jun 23 18:44:00 2012
@@ -280,6 +280,11 @@
/// \param addr - a pointer to pass to the destructor function.
virtual void registerGlobalDtor(CodeGenFunction &CGF, llvm::Constant *dtor,
llvm::Constant *addr);
+
+ /***************************** Virtual Tables *******************************/
+
+ /// Generates and emits the virtual tables for a class.
+ virtual void EmitVTables(const CXXRecordDecl *Class) = 0;
};
/// Creates an instance of a C++ ABI class.
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=159091&r1=159090&r2=159091&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat Jun 23 18:44:00 2012
@@ -668,7 +668,7 @@
if (!DeferredVTables.empty()) {
const CXXRecordDecl *RD = DeferredVTables.back();
DeferredVTables.pop_back();
- getVTables().GenerateClassData(getVTableLinkage(RD), RD);
+ getCXXABI().EmitVTables(RD);
continue;
}
@@ -1312,7 +1312,7 @@
void CodeGenModule::EmitVTable(CXXRecordDecl *Class, bool DefinitionRequired) {
if (DefinitionRequired)
- getVTables().GenerateClassData(getVTableLinkage(Class), Class);
+ getCXXABI().EmitVTables(Class);
}
llvm::GlobalVariable::LinkageTypes
Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=159091&r1=159090&r2=159091&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Sat Jun 23 18:44:00 2012
@@ -20,6 +20,7 @@
#include "CGCXXABI.h"
#include "CGRecordLayout.h"
+#include "CGVTables.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include <clang/AST/Mangle.h>
@@ -121,6 +122,8 @@
llvm::GlobalVariable *DeclPtr, bool PerformInit);
void registerGlobalDtor(CodeGenFunction &CGF, llvm::Constant *dtor,
llvm::Constant *addr);
+
+ void EmitVTables(const CXXRecordDecl *Class);
};
class ARMCXXABI : public ItaniumCXXABI {
@@ -1151,3 +1154,8 @@
CGF.registerGlobalDtorWithAtExit(dtor, addr);
}
+
+/// Generate and emit virtual tables for the given class.
+void ItaniumCXXABI::EmitVTables(const CXXRecordDecl *Class) {
+ CGM.getVTables().GenerateClassData(CGM.getVTableLinkage(Class), Class);
+}
Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=159091&r1=159090&r2=159091&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Sat Jun 23 18:44:00 2012
@@ -60,6 +60,8 @@
llvm::GlobalVariable *DeclPtr,
bool PerformInit);
+ void EmitVTables(const CXXRecordDecl *Class);
+
// ==== Notes on array cookies =========
//
@@ -165,6 +167,10 @@
CGF.EmitCXXGlobalVarDeclInit(D, DeclPtr, PerformInit);
}
+void MicrosoftCXXABI::EmitVTables(const CXXRecordDecl *Class) {
+ // FIXME: implement
+}
+
CGCXXABI *clang::CodeGen::CreateMicrosoftCXXABI(CodeGenModule &CGM) {
return new MicrosoftCXXABI(CGM);
}
More information about the cfe-commits
mailing list