[cfe-commits] r99868 - in /cfe/trunk/lib/CodeGen: CGVtable.cpp CGVtable.h
Anders Carlsson
andersca at mac.com
Mon Mar 29 20:35:35 PDT 2010
Author: andersca
Date: Mon Mar 29 22:35:35 2010
New Revision: 99868
URL: http://llvm.org/viewvc/llvm-project?rev=99868&view=rev
Log:
Remove UseNewVTableCode checks.
Modified:
cfe/trunk/lib/CodeGen/CGVtable.cpp
cfe/trunk/lib/CodeGen/CGVtable.h
Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=99868&r1=99867&r2=99868&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Mon Mar 29 22:35:35 2010
@@ -3617,21 +3617,8 @@
return I->second;
}
-static bool UseNewVTableCode = true;
-
uint64_t
CodeGenVTables::getAddressPoint(BaseSubobject Base, const CXXRecordDecl *RD) {
- // FIXME: Always use the new vtable code once we know it works.
- if (!UseNewVTableCode) {
- const CodeGenVTables::AddrSubMap_t& AddressPoints = getAddressPoints(RD);
-
- uint64_t AddressPoint =
- AddressPoints.lookup(std::make_pair(Base.getBase(),
- Base.getBaseOffset()));
-
- assert(AddressPoint && "Address point must not be zero!");
- }
-
uint64_t AddressPoint = AddressPoints.lookup(std::make_pair(RD, Base));
assert(AddressPoint && "Address point must not be zero!");
@@ -4189,9 +4176,7 @@
return GV;
}
-// FIXME: When the new code is in place, we can change this to return a
-// GlobalVariable.
-llvm::Constant *CodeGenVTables::GetAddrOfVTable(const CXXRecordDecl *RD) {
+llvm::GlobalVariable *CodeGenVTables::GetAddrOfVTable(const CXXRecordDecl *RD) {
llvm::SmallString<256> OutName;
CGM.getMangleContext().mangleCXXVtable(RD, OutName);
llvm::StringRef Name = OutName.str();
@@ -4202,23 +4187,8 @@
llvm::ArrayType *ArrayType =
llvm::ArrayType::get(Int8PtrTy, getNumVTableComponents(RD));
- // FIXME: Always use the new vtable code once we know it works.
- if (UseNewVTableCode)
- return GetGlobalVariable(CGM.getModule(), Name, ArrayType,
- llvm::GlobalValue::ExternalLinkage);
-
- llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(Name);
- if (GV) {
- if (!GV->isDeclaration() || GV->getType()->getElementType() == ArrayType)
- return GV;
-
- return llvm::ConstantExpr::getBitCast(GV, ArrayType->getPointerTo());
- }
-
- GV = new llvm::GlobalVariable(CGM.getModule(), ArrayType, /*isConstant=*/true,
- llvm::GlobalValue::ExternalLinkage, 0, Name);
-
- return GV;
+ return GetGlobalVariable(CGM.getModule(), Name, ArrayType,
+ llvm::GlobalValue::ExternalLinkage);
}
void
@@ -4305,16 +4275,9 @@
return;
}
- // FIXME: Always use the new vtable code once we know it works.
- if (UseNewVTableCode) {
- VTable = cast<llvm::GlobalVariable>(GetAddrOfVTable(RD));
- EmitVTableDefinition(VTable, Linkage, RD);
- } else {
- llvm::DenseMap<BaseSubobject, uint64_t> AddressPoints;
- VTable = GenerateVtable(Linkage, /*GenerateDefinition=*/true, RD, RD, 0,
- /*IsVirtual=*/false,
- AddressPoints);
- }
+ VTable = GetAddrOfVTable(RD);
+ EmitVTableDefinition(VTable, Linkage, RD);
+
GenerateVTT(Linkage, /*GenerateDefinition=*/true, RD);
}
Modified: cfe/trunk/lib/CodeGen/CGVtable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.h?rev=99868&r1=99867&r2=99868&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.h (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.h Mon Mar 29 22:35:35 2010
@@ -385,7 +385,7 @@
uint64_t getAddressPoint(BaseSubobject Base, const CXXRecordDecl *RD);
/// GetAddrOfVTable - Get the address of the vtable for the given record decl.
- llvm::Constant *GetAddrOfVTable(const CXXRecordDecl *RD);
+ llvm::GlobalVariable *GetAddrOfVTable(const CXXRecordDecl *RD);
/// EmitVTableDefinition - Emit the definition of the given vtable.
void EmitVTableDefinition(llvm::GlobalVariable *VTable,
More information about the cfe-commits
mailing list