aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVtable.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-03-30 03:35:35 +0000
committerAnders Carlsson <andersca@mac.com>2010-03-30 03:35:35 +0000
commit9dc338ac74e7855293a60812bd5780a52f141f52 (patch)
treeacc3e4aa2ff9fb52f19e308f0a31c88afe52b5d3 /lib/CodeGen/CGVtable.cpp
parent8887bdcd4056ac25cb37dcb2abb9514e668eb81a (diff)
Remove UseNewVTableCode checks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99868 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r--lib/CodeGen/CGVtable.cpp49
1 files changed, 6 insertions, 43 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index afbfeabeb8..30c9efc91b 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -3617,21 +3617,8 @@ int64_t CodeGenVTables::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
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 @@ GetGlobalVariable(llvm::Module &Module, llvm::StringRef Name,
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::Constant *CodeGenVTables::GetAddrOfVTable(const CXXRecordDecl *RD) {
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 @@ CodeGenVTables::GenerateClassData(llvm::GlobalVariable::LinkageTypes Linkage,
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);
}