forked from OSchip/llvm-project
Rename CGVtableInfo to CodeGenVTables in preparation of adding another VTableInfo class.
llvm-svn: 99250
This commit is contained in:
parent
86face8333
commit
a864caff8c
|
@ -489,10 +489,10 @@ CodeGenModule::GetAddrOfCovariantThunk(GlobalDecl GD,
|
|||
}
|
||||
|
||||
void CodeGenModule::BuildThunksForVirtual(GlobalDecl GD) {
|
||||
CGVtableInfo::AdjustmentVectorTy *AdjPtr = getVtableInfo().getAdjustments(GD);
|
||||
CodeGenVTables::AdjustmentVectorTy *AdjPtr = getVTables().getAdjustments(GD);
|
||||
if (!AdjPtr)
|
||||
return;
|
||||
CGVtableInfo::AdjustmentVectorTy &Adj = *AdjPtr;
|
||||
CodeGenVTables::AdjustmentVectorTy &Adj = *AdjPtr;
|
||||
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
|
||||
for (unsigned i = 0; i < Adj.size(); i++) {
|
||||
GlobalDecl OGD = Adj[i].first;
|
||||
|
@ -618,17 +618,17 @@ llvm::Value *
|
|||
CodeGenFunction::BuildVirtualCall(const CXXMethodDecl *MD, llvm::Value *This,
|
||||
const llvm::Type *Ty) {
|
||||
MD = MD->getCanonicalDecl();
|
||||
uint64_t VtableIndex = CGM.getVtableInfo().getMethodVtableIndex(MD);
|
||||
uint64_t VTableIndex = CGM.getVTables().getMethodVtableIndex(MD);
|
||||
|
||||
return ::BuildVirtualCall(*this, VtableIndex, This, Ty);
|
||||
return ::BuildVirtualCall(*this, VTableIndex, This, Ty);
|
||||
}
|
||||
|
||||
llvm::Value *
|
||||
CodeGenFunction::BuildVirtualCall(const CXXDestructorDecl *DD, CXXDtorType Type,
|
||||
llvm::Value *&This, const llvm::Type *Ty) {
|
||||
DD = cast<CXXDestructorDecl>(DD->getCanonicalDecl());
|
||||
uint64_t VtableIndex =
|
||||
CGM.getVtableInfo().getMethodVtableIndex(GlobalDecl(DD, Type));
|
||||
uint64_t VTableIndex =
|
||||
CGM.getVTables().getMethodVtableIndex(GlobalDecl(DD, Type));
|
||||
|
||||
return ::BuildVirtualCall(*this, VtableIndex, This, Ty);
|
||||
return ::BuildVirtualCall(*this, VTableIndex, This, Ty);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ CodeGenModule::ComputeThunkAdjustment(const CXXRecordDecl *ClassDecl,
|
|||
}
|
||||
if (VBase)
|
||||
VirtualOffset =
|
||||
getVtableInfo().getVirtualBaseOffsetOffset(ClassDecl, BaseClassDecl);
|
||||
getVTables().getVirtualBaseOffsetOffset(ClassDecl, BaseClassDecl);
|
||||
|
||||
uint64_t Offset =
|
||||
ComputeNonVirtualBaseClassOffset(getContext(), Paths.front(), Start);
|
||||
|
@ -471,7 +471,7 @@ void CodeGenFunction::EmitClassAggrCopyAssignment(llvm::Value *Dest,
|
|||
/// GetVTTParameter - Return the VTT parameter that should be passed to a
|
||||
/// base constructor/destructor with virtual bases.
|
||||
static llvm::Value *GetVTTParameter(CodeGenFunction &CGF, GlobalDecl GD) {
|
||||
if (!CGVtableInfo::needsVTTParameter(GD)) {
|
||||
if (!CodeGenVTables::needsVTTParameter(GD)) {
|
||||
// This constructor/destructor does not need a VTT parameter.
|
||||
return 0;
|
||||
}
|
||||
|
@ -486,21 +486,21 @@ static llvm::Value *GetVTTParameter(CodeGenFunction &CGF, GlobalDecl GD) {
|
|||
// If the record matches the base, this is the complete ctor/dtor
|
||||
// variant calling the base variant in a class with virtual bases.
|
||||
if (RD == Base) {
|
||||
assert(!CGVtableInfo::needsVTTParameter(CGF.CurGD) &&
|
||||
assert(!CodeGenVTables::needsVTTParameter(CGF.CurGD) &&
|
||||
"doing no-op VTT offset in base dtor/ctor?");
|
||||
SubVTTIndex = 0;
|
||||
} else {
|
||||
SubVTTIndex = CGF.CGM.getVtableInfo().getSubVTTIndex(RD, Base);
|
||||
SubVTTIndex = CGF.CGM.getVTables().getSubVTTIndex(RD, Base);
|
||||
assert(SubVTTIndex != 0 && "Sub-VTT index must be greater than zero!");
|
||||
}
|
||||
|
||||
if (CGVtableInfo::needsVTTParameter(CGF.CurGD)) {
|
||||
if (CodeGenVTables::needsVTTParameter(CGF.CurGD)) {
|
||||
// A VTT parameter was passed to the constructor, use it.
|
||||
VTT = CGF.LoadCXXVTT();
|
||||
VTT = CGF.Builder.CreateConstInBoundsGEP1_64(VTT, SubVTTIndex);
|
||||
} else {
|
||||
// We're the complete constructor, so get the VTT by name.
|
||||
VTT = CGF.CGM.getVtableInfo().getVTT(RD);
|
||||
VTT = CGF.CGM.getVTables().getVTT(RD);
|
||||
VTT = CGF.Builder.CreateConstInBoundsGEP2_64(VTT, 0, SubVTTIndex);
|
||||
}
|
||||
|
||||
|
@ -1474,7 +1474,7 @@ CodeGenFunction::EmitDelegateCXXConstructorCall(const CXXConstructorDecl *Ctor,
|
|||
QualType VoidPP = getContext().getPointerType(getContext().VoidPtrTy);
|
||||
DelegateArgs.push_back(std::make_pair(RValue::get(VTT), VoidPP));
|
||||
|
||||
if (CGVtableInfo::needsVTTParameter(CurGD)) {
|
||||
if (CodeGenVTables::needsVTTParameter(CurGD)) {
|
||||
assert(I != E && "cannot skip vtt parameter, already done with args");
|
||||
assert(I->second == VoidPP && "skipping parameter not of vtt type");
|
||||
++I;
|
||||
|
@ -1541,7 +1541,7 @@ CodeGenFunction::GetVirtualBaseClassOffset(llvm::Value *This,
|
|||
VTablePtr = Builder.CreateLoad(VTablePtr, "vtable");
|
||||
|
||||
int64_t VBaseOffsetOffset =
|
||||
CGM.getVtableInfo().getVirtualBaseOffsetOffset(ClassDecl, BaseClassDecl);
|
||||
CGM.getVTables().getVirtualBaseOffsetOffset(ClassDecl, BaseClassDecl);
|
||||
|
||||
llvm::Value *VBaseOffsetPtr =
|
||||
Builder.CreateConstGEP1_64(VTablePtr, VBaseOffsetOffset, "vbase.offset.ptr");
|
||||
|
@ -1560,9 +1560,9 @@ void CodeGenFunction::InitializeVtablePtrs(const CXXRecordDecl *ClassDecl) {
|
|||
if (!ClassDecl->isDynamicClass())
|
||||
return;
|
||||
|
||||
llvm::Constant *Vtable = CGM.getVtableInfo().getVtable(ClassDecl);
|
||||
CGVtableInfo::AddrSubMap_t& AddressPoints =
|
||||
*(*CGM.getVtableInfo().AddressPoints[ClassDecl])[ClassDecl];
|
||||
llvm::Constant *VTable = CGM.getVTables().getVtable(ClassDecl);
|
||||
CodeGenVTables::AddrSubMap_t& AddressPoints =
|
||||
*(*CGM.getVTables().AddressPoints[ClassDecl])[ClassDecl];
|
||||
llvm::Value *ThisPtr = LoadCXXThis();
|
||||
const ASTRecordLayout &Layout = getContext().getASTRecordLayout(ClassDecl);
|
||||
|
||||
|
@ -1573,18 +1573,18 @@ void CodeGenFunction::InitializeVtablePtrs(const CXXRecordDecl *ClassDecl) {
|
|||
CXXRecordDecl *BaseClassDecl
|
||||
= cast<CXXRecordDecl>(Base.getType()->getAs<RecordType>()->getDecl());
|
||||
uint64_t Offset = Layout.getVBaseClassOffset(BaseClassDecl);
|
||||
InitializeVtablePtrsRecursive(BaseClassDecl, Vtable, AddressPoints,
|
||||
InitializeVtablePtrsRecursive(BaseClassDecl, VTable, AddressPoints,
|
||||
ThisPtr, Offset);
|
||||
}
|
||||
|
||||
// Store address points for non-virtual bases and current class
|
||||
InitializeVtablePtrsRecursive(ClassDecl, Vtable, AddressPoints, ThisPtr, 0);
|
||||
InitializeVtablePtrsRecursive(ClassDecl, VTable, AddressPoints, ThisPtr, 0);
|
||||
}
|
||||
|
||||
void CodeGenFunction::InitializeVtablePtrsRecursive(
|
||||
const CXXRecordDecl *ClassDecl,
|
||||
llvm::Constant *Vtable,
|
||||
CGVtableInfo::AddrSubMap_t& AddressPoints,
|
||||
CodeGenVTables::AddrSubMap_t& AddressPoints,
|
||||
llvm::Value *ThisPtr,
|
||||
uint64_t Offset) {
|
||||
if (!ClassDecl->isDynamicClass())
|
||||
|
|
|
@ -608,7 +608,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method,
|
|||
// It doesn't make sense to give a virtual destructor a vtable index,
|
||||
// since a single destructor has two entries in the vtable.
|
||||
if (!isa<CXXDestructorDecl>(Method))
|
||||
VIndex = CGM.getVtableInfo().getMethodVtableIndex(Method);
|
||||
VIndex = CGM.getVTables().getMethodVtableIndex(Method);
|
||||
ContainingType = RecordTy;
|
||||
}
|
||||
|
||||
|
@ -666,7 +666,7 @@ CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile Unit,
|
|||
if (BI->isVirtual()) {
|
||||
// virtual base offset offset is -ve. The code generator emits dwarf
|
||||
// expression where it expects +ve number.
|
||||
BaseOffset = 0 - CGM.getVtableInfo().getVirtualBaseOffsetOffset(RD, Base);
|
||||
BaseOffset = 0 - CGM.getVTables().getVirtualBaseOffsetOffset(RD, Base);
|
||||
BFlags = llvm::DIType::FlagVirtual;
|
||||
} else
|
||||
BaseOffset = RL.getBaseClassOffset(Base);
|
||||
|
|
|
@ -333,8 +333,7 @@ void AggExprEmitter::VisitUnaryAddrOf(const UnaryOperator *E) {
|
|||
llvm::Value *FuncPtr;
|
||||
|
||||
if (MD->isVirtual()) {
|
||||
int64_t Index =
|
||||
CGF.CGM.getVtableInfo().getMethodVtableIndex(MD);
|
||||
int64_t Index = CGF.CGM.getVTables().getMethodVtableIndex(MD);
|
||||
|
||||
// Itanium C++ ABI 2.3:
|
||||
// For a non-virtual function, this field is a simple function pointer.
|
||||
|
|
|
@ -417,7 +417,7 @@ public:
|
|||
|
||||
// Get the function pointer (or index if this is a virtual function).
|
||||
if (MD->isVirtual()) {
|
||||
uint64_t Index = CGM.getVtableInfo().getMethodVtableIndex(MD);
|
||||
uint64_t Index = CGM.getVTables().getMethodVtableIndex(MD);
|
||||
|
||||
// Itanium C++ ABI 2.3:
|
||||
// For a non-virtual function, this field is a simple function pointer.
|
||||
|
|
|
@ -760,7 +760,7 @@ void RTTIBuilder::BuildVMIClassTypeInfo(const CXXRecordDecl *RD) {
|
|||
// subobject. For a virtual base, this is the offset in the virtual table of
|
||||
// the virtual base offset for the virtual base referenced (negative).
|
||||
if (Base->isVirtual())
|
||||
OffsetFlags = CGM.getVtableInfo().getVirtualBaseOffsetOffset(RD, BaseDecl);
|
||||
OffsetFlags = CGM.getVTables().getVirtualBaseOffsetOffset(RD, BaseDecl);
|
||||
else {
|
||||
const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
|
||||
OffsetFlags = Layout.getBaseClassOffset(BaseDecl) / 8;
|
||||
|
|
|
@ -29,7 +29,7 @@ class VTTBuilder {
|
|||
/// BLayout - Layout for the most derived class that this vtable is being
|
||||
/// built for.
|
||||
const ASTRecordLayout &BLayout;
|
||||
CGVtableInfo::AddrMap_t &AddressPoints;
|
||||
CodeGenVTables::AddrMap_t &AddressPoints;
|
||||
// vtbl - A pointer to the vtable for Class.
|
||||
llvm::Constant *ClassVtbl;
|
||||
llvm::LLVMContext &VMContext;
|
||||
|
@ -54,13 +54,13 @@ class VTTBuilder {
|
|||
llvm::Constant *&CtorVtable = CtorVtables[Base];
|
||||
if (!CtorVtable) {
|
||||
// Build the vtable.
|
||||
CGVtableInfo::CtorVtableInfo Info
|
||||
= CGM.getVtableInfo().getCtorVtable(Class, Base, BaseIsVirtual);
|
||||
CodeGenVTables::CtorVtableInfo Info
|
||||
= CGM.getVTables().getCtorVtable(Class, Base, BaseIsVirtual);
|
||||
|
||||
CtorVtable = Info.Vtable;
|
||||
|
||||
// Add the address points for this base.
|
||||
for (CGVtableInfo::AddressPointsMapTy::const_iterator I =
|
||||
for (CodeGenVTables::AddressPointsMapTy::const_iterator I =
|
||||
Info.AddressPoints.begin(), E = Info.AddressPoints.end();
|
||||
I != E; ++I) {
|
||||
uint64_t &AddressPoint =
|
||||
|
@ -263,12 +263,12 @@ public:
|
|||
CodeGenModule &cgm, bool GenerateDefinition)
|
||||
: Inits(inits), Class(c), CGM(cgm),
|
||||
BLayout(cgm.getContext().getASTRecordLayout(c)),
|
||||
AddressPoints(*cgm.getVtableInfo().AddressPoints[c]),
|
||||
AddressPoints(*cgm.getVTables().AddressPoints[c]),
|
||||
VMContext(cgm.getModule().getContext()),
|
||||
GenerateDefinition(GenerateDefinition) {
|
||||
|
||||
// First comes the primary virtual table pointer for the complete class...
|
||||
ClassVtbl = GenerateDefinition ? CGM.getVtableInfo().getVtable(Class) : 0;
|
||||
ClassVtbl = GenerateDefinition ? CGM.getVTables().getVtable(Class) : 0;
|
||||
|
||||
llvm::Constant *Init = BuildVtablePtr(ClassVtbl, Class, Class, 0);
|
||||
Inits.push_back(Init);
|
||||
|
@ -293,9 +293,9 @@ public:
|
|||
}
|
||||
|
||||
llvm::GlobalVariable *
|
||||
CGVtableInfo::GenerateVTT(llvm::GlobalVariable::LinkageTypes Linkage,
|
||||
bool GenerateDefinition,
|
||||
const CXXRecordDecl *RD) {
|
||||
CodeGenVTables::GenerateVTT(llvm::GlobalVariable::LinkageTypes Linkage,
|
||||
bool GenerateDefinition,
|
||||
const CXXRecordDecl *RD) {
|
||||
// Only classes that have virtual bases need a VTT.
|
||||
if (RD->getNumVBases() == 0)
|
||||
return 0;
|
||||
|
@ -336,8 +336,8 @@ CGVtableInfo::GenerateVTT(llvm::GlobalVariable::LinkageTypes Linkage,
|
|||
return GV;
|
||||
}
|
||||
|
||||
CGVtableInfo::CtorVtableInfo
|
||||
CGVtableInfo::getCtorVtable(const CXXRecordDecl *RD,
|
||||
CodeGenVTables::CtorVtableInfo
|
||||
CodeGenVTables::getCtorVtable(const CXXRecordDecl *RD,
|
||||
const BaseSubobject &Base, bool BaseIsVirtual) {
|
||||
CtorVtableInfo Info;
|
||||
|
||||
|
@ -348,14 +348,12 @@ CGVtableInfo::getCtorVtable(const CXXRecordDecl *RD,
|
|||
return Info;
|
||||
}
|
||||
|
||||
llvm::GlobalVariable *CGVtableInfo::getVTT(const CXXRecordDecl *RD) {
|
||||
llvm::GlobalVariable *CodeGenVTables::getVTT(const CXXRecordDecl *RD) {
|
||||
return GenerateVTT(llvm::GlobalValue::ExternalLinkage,
|
||||
/*GenerateDefinition=*/false, RD);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool CGVtableInfo::needsVTTParameter(GlobalDecl GD) {
|
||||
bool CodeGenVTables::needsVTTParameter(GlobalDecl GD) {
|
||||
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
|
||||
|
||||
// We don't have any virtual bases, just return early.
|
||||
|
@ -373,8 +371,8 @@ bool CGVtableInfo::needsVTTParameter(GlobalDecl GD) {
|
|||
return false;
|
||||
}
|
||||
|
||||
uint64_t CGVtableInfo::getSubVTTIndex(const CXXRecordDecl *RD,
|
||||
const CXXRecordDecl *Base) {
|
||||
uint64_t CodeGenVTables::getSubVTTIndex(const CXXRecordDecl *RD,
|
||||
const CXXRecordDecl *Base) {
|
||||
ClassPairTy ClassPair(RD, Base);
|
||||
|
||||
SubVTTIndiciesTy::iterator I =
|
||||
|
|
|
@ -1092,8 +1092,8 @@ public:
|
|||
PrimaryBasesSetVectorTy;
|
||||
|
||||
private:
|
||||
/// VtableInfo - Global vtable information.
|
||||
CGVtableInfo &VtableInfo;
|
||||
/// VTables - Global vtable information.
|
||||
CodeGenVTables &VTables;
|
||||
|
||||
/// MostDerivedClass - The most derived class for which we're building this
|
||||
/// vtable.
|
||||
|
@ -1133,7 +1133,7 @@ private:
|
|||
llvm::SmallVector<VtableComponent, 64> Components;
|
||||
|
||||
/// AddressPoints - Address points for the vtable being built.
|
||||
CGVtableInfo::AddressPointsMapTy AddressPoints;
|
||||
CodeGenVTables::AddressPointsMapTy AddressPoints;
|
||||
|
||||
/// ReturnAdjustment - A return adjustment.
|
||||
struct ReturnAdjustment {
|
||||
|
@ -1367,10 +1367,10 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
VtableBuilder(CGVtableInfo &VtableInfo, const CXXRecordDecl *MostDerivedClass,
|
||||
VtableBuilder(CodeGenVTables &VTables, const CXXRecordDecl *MostDerivedClass,
|
||||
uint64_t MostDerivedClassOffset, bool MostDerivedClassIsVirtual,
|
||||
const CXXRecordDecl *LayoutClass)
|
||||
: VtableInfo(VtableInfo), MostDerivedClass(MostDerivedClass),
|
||||
: VTables(VTables), MostDerivedClass(MostDerivedClass),
|
||||
MostDerivedClassOffset(MostDerivedClassOffset),
|
||||
MostDerivedClassIsVirtual(MostDerivedClassIsVirtual),
|
||||
LayoutClass(LayoutClass), Context(MostDerivedClass->getASTContext()),
|
||||
|
@ -1501,8 +1501,8 @@ VtableBuilder::ComputeReturnAdjustment(BaseOffset Offset) {
|
|||
VBaseOffsetOffsets.lookup(Offset.VirtualBase);
|
||||
} else {
|
||||
Adjustment.VBaseOffsetOffset =
|
||||
VtableInfo.getVirtualBaseOffsetOffset(Offset.DerivedClass,
|
||||
Offset.VirtualBase);
|
||||
VTables.getVirtualBaseOffsetOffset(Offset.DerivedClass,
|
||||
Offset.VirtualBase);
|
||||
}
|
||||
|
||||
// FIXME: Once the assert in getVirtualBaseOffsetOffset is back again,
|
||||
|
@ -2133,7 +2133,7 @@ void VtableBuilder::dumpLayout(llvm::raw_ostream& Out) {
|
|||
// Since an address point can be shared by multiple subobjects, we use an
|
||||
// STL multimap.
|
||||
std::multimap<uint64_t, BaseSubobject> AddressPointsByIndex;
|
||||
for (CGVtableInfo::AddressPointsMapTy::const_iterator I =
|
||||
for (CodeGenVTables::AddressPointsMapTy::const_iterator I =
|
||||
AddressPoints.begin(), E = AddressPoints.end(); I != E; ++I) {
|
||||
const BaseSubobject& Base = I->first;
|
||||
uint64_t Index = I->second;
|
||||
|
@ -2532,7 +2532,7 @@ private:
|
|||
llvm::DenseMap<CtorVtable_t, int64_t> &subAddressPoints;
|
||||
|
||||
/// AddressPoints - Address points for this vtable.
|
||||
CGVtableInfo::AddressPointsMapTy& AddressPoints;
|
||||
CodeGenVTables::AddressPointsMapTy& AddressPoints;
|
||||
|
||||
typedef CXXRecordDecl::method_iterator method_iter;
|
||||
const uint32_t LLVMPointerWidth;
|
||||
|
@ -2541,9 +2541,9 @@ private:
|
|||
static llvm::DenseMap<CtorVtable_t, int64_t>&
|
||||
AllocAddressPoint(CodeGenModule &cgm, const CXXRecordDecl *l,
|
||||
const CXXRecordDecl *c) {
|
||||
CGVtableInfo::AddrMap_t *&oref = cgm.getVtableInfo().AddressPoints[l];
|
||||
CodeGenVTables::AddrMap_t *&oref = cgm.getVTables().AddressPoints[l];
|
||||
if (oref == 0)
|
||||
oref = new CGVtableInfo::AddrMap_t;
|
||||
oref = new CodeGenVTables::AddrMap_t;
|
||||
|
||||
llvm::DenseMap<CtorVtable_t, int64_t> *&ref = (*oref)[c];
|
||||
if (ref == 0)
|
||||
|
@ -2756,7 +2756,7 @@ private:
|
|||
public:
|
||||
OldVtableBuilder(const CXXRecordDecl *MostDerivedClass,
|
||||
const CXXRecordDecl *l, uint64_t lo, CodeGenModule &cgm,
|
||||
bool build, CGVtableInfo::AddressPointsMapTy& AddressPoints)
|
||||
bool build, CodeGenVTables::AddressPointsMapTy& AddressPoints)
|
||||
: BuildVtable(build), MostDerivedClass(MostDerivedClass), LayoutClass(l),
|
||||
LayoutOffset(lo), BLayout(cgm.getContext().getASTRecordLayout(l)),
|
||||
rtti(0), VMContext(cgm.getModule().getContext()),CGM(cgm),
|
||||
|
@ -2877,7 +2877,7 @@ public:
|
|||
CXXRecordDecl *D = cast<CXXRecordDecl>(qD->getAs<RecordType>()->getDecl());
|
||||
CXXRecordDecl *B = cast<CXXRecordDecl>(qB->getAs<RecordType>()->getDecl());
|
||||
if (D != MostDerivedClass)
|
||||
return CGM.getVtableInfo().getVirtualBaseOffsetOffset(D, B);
|
||||
return CGM.getVTables().getVirtualBaseOffsetOffset(D, B);
|
||||
llvm::DenseMap<const CXXRecordDecl *, Index_t>::iterator i;
|
||||
i = VBIndex.find(B);
|
||||
if (i != VBIndex.end())
|
||||
|
@ -3464,7 +3464,7 @@ void OldVtableBuilder::AppendMethodsToVtable() {
|
|||
Methods.clear();
|
||||
}
|
||||
|
||||
void CGVtableInfo::ComputeMethodVtableIndices(const CXXRecordDecl *RD) {
|
||||
void CodeGenVTables::ComputeMethodVtableIndices(const CXXRecordDecl *RD) {
|
||||
|
||||
// Itanium C++ ABI 2.5.2:
|
||||
// The order of the virtual function pointers in a virtual table is the
|
||||
|
@ -3570,7 +3570,7 @@ void CGVtableInfo::ComputeMethodVtableIndices(const CXXRecordDecl *RD) {
|
|||
NumVirtualFunctionPointers[RD] = CurrentIndex;
|
||||
}
|
||||
|
||||
uint64_t CGVtableInfo::getNumVirtualFunctionPointers(const CXXRecordDecl *RD) {
|
||||
uint64_t CodeGenVTables::getNumVirtualFunctionPointers(const CXXRecordDecl *RD) {
|
||||
llvm::DenseMap<const CXXRecordDecl *, uint64_t>::iterator I =
|
||||
NumVirtualFunctionPointers.find(RD);
|
||||
if (I != NumVirtualFunctionPointers.end())
|
||||
|
@ -3583,7 +3583,7 @@ uint64_t CGVtableInfo::getNumVirtualFunctionPointers(const CXXRecordDecl *RD) {
|
|||
return I->second;
|
||||
}
|
||||
|
||||
uint64_t CGVtableInfo::getMethodVtableIndex(GlobalDecl GD) {
|
||||
uint64_t CodeGenVTables::getMethodVtableIndex(GlobalDecl GD) {
|
||||
MethodVtableIndicesTy::iterator I = MethodVtableIndices.find(GD);
|
||||
if (I != MethodVtableIndices.end())
|
||||
return I->second;
|
||||
|
@ -3597,8 +3597,8 @@ uint64_t CGVtableInfo::getMethodVtableIndex(GlobalDecl GD) {
|
|||
return I->second;
|
||||
}
|
||||
|
||||
CGVtableInfo::AdjustmentVectorTy*
|
||||
CGVtableInfo::getAdjustments(GlobalDecl GD) {
|
||||
CodeGenVTables::AdjustmentVectorTy*
|
||||
CodeGenVTables::getAdjustments(GlobalDecl GD) {
|
||||
SavedAdjustmentsTy::iterator I = SavedAdjustments.find(GD);
|
||||
if (I != SavedAdjustments.end())
|
||||
return &I->second;
|
||||
|
@ -3625,8 +3625,8 @@ CGVtableInfo::getAdjustments(GlobalDecl GD) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int64_t CGVtableInfo::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
|
||||
const CXXRecordDecl *VBase) {
|
||||
int64_t CodeGenVTables::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
|
||||
const CXXRecordDecl *VBase) {
|
||||
ClassPairTy ClassPair(RD, VBase);
|
||||
|
||||
VirtualBaseClassOffsetOffsetsMapTy::iterator I =
|
||||
|
@ -3662,20 +3662,20 @@ int64_t CGVtableInfo::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
|
|||
return I->second;
|
||||
}
|
||||
|
||||
uint64_t CGVtableInfo::getVtableAddressPoint(const CXXRecordDecl *RD) {
|
||||
uint64_t CodeGenVTables::getVtableAddressPoint(const CXXRecordDecl *RD) {
|
||||
uint64_t AddressPoint =
|
||||
(*(*(CGM.getVtableInfo().AddressPoints[RD]))[RD])[std::make_pair(RD, 0)];
|
||||
(*(*(CGM.getVTables().AddressPoints[RD]))[RD])[std::make_pair(RD, 0)];
|
||||
|
||||
return AddressPoint;
|
||||
}
|
||||
|
||||
llvm::GlobalVariable *
|
||||
CGVtableInfo::GenerateVtable(llvm::GlobalVariable::LinkageTypes Linkage,
|
||||
bool GenerateDefinition,
|
||||
const CXXRecordDecl *LayoutClass,
|
||||
const CXXRecordDecl *RD, uint64_t Offset,
|
||||
bool IsVirtual,
|
||||
AddressPointsMapTy& AddressPoints) {
|
||||
CodeGenVTables::GenerateVtable(llvm::GlobalVariable::LinkageTypes Linkage,
|
||||
bool GenerateDefinition,
|
||||
const CXXRecordDecl *LayoutClass,
|
||||
const CXXRecordDecl *RD, uint64_t Offset,
|
||||
bool IsVirtual,
|
||||
AddressPointsMapTy& AddressPoints) {
|
||||
if (GenerateDefinition) {
|
||||
if (LayoutClass == RD) {
|
||||
assert(!IsVirtual &&
|
||||
|
@ -3701,7 +3701,7 @@ CGVtableInfo::GenerateVtable(llvm::GlobalVariable::LinkageTypes Linkage,
|
|||
llvm::StringRef Name = OutName.str();
|
||||
|
||||
llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name);
|
||||
if (GV == 0 || CGM.getVtableInfo().AddressPoints[LayoutClass] == 0 ||
|
||||
if (GV == 0 || CGM.getVTables().AddressPoints[LayoutClass] == 0 ||
|
||||
GV->isDeclaration()) {
|
||||
OldVtableBuilder b(RD, LayoutClass, Offset, CGM, GenerateDefinition,
|
||||
AddressPoints);
|
||||
|
@ -3740,8 +3740,9 @@ CGVtableInfo::GenerateVtable(llvm::GlobalVariable::LinkageTypes Linkage,
|
|||
return GV;
|
||||
}
|
||||
|
||||
void CGVtableInfo::GenerateClassData(llvm::GlobalVariable::LinkageTypes Linkage,
|
||||
const CXXRecordDecl *RD) {
|
||||
void
|
||||
CodeGenVTables::GenerateClassData(llvm::GlobalVariable::LinkageTypes Linkage,
|
||||
const CXXRecordDecl *RD) {
|
||||
llvm::GlobalVariable *&Vtable = Vtables[RD];
|
||||
if (Vtable) {
|
||||
assert(Vtable->getInitializer() && "Vtable doesn't have a definition!");
|
||||
|
@ -3770,7 +3771,7 @@ void CGVtableInfo::GenerateClassData(llvm::GlobalVariable::LinkageTypes Linkage,
|
|||
}
|
||||
}
|
||||
|
||||
llvm::GlobalVariable *CGVtableInfo::getVtable(const CXXRecordDecl *RD) {
|
||||
llvm::GlobalVariable *CodeGenVTables::getVtable(const CXXRecordDecl *RD) {
|
||||
llvm::GlobalVariable *Vtable = Vtables.lookup(RD);
|
||||
|
||||
if (!Vtable) {
|
||||
|
@ -3783,7 +3784,7 @@ llvm::GlobalVariable *CGVtableInfo::getVtable(const CXXRecordDecl *RD) {
|
|||
return Vtable;
|
||||
}
|
||||
|
||||
void CGVtableInfo::MaybeEmitVtable(GlobalDecl GD) {
|
||||
void CodeGenVTables::MaybeEmitVtable(GlobalDecl GD) {
|
||||
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
|
||||
const CXXRecordDecl *RD = MD->getParent();
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ template <> struct isPodLike<clang::CodeGen::BaseSubobject> {
|
|||
namespace clang {
|
||||
namespace CodeGen {
|
||||
|
||||
class CGVtableInfo {
|
||||
class CodeGenVTables {
|
||||
public:
|
||||
typedef std::vector<std::pair<GlobalDecl, ThunkAdjustment> >
|
||||
AdjustmentVectorTy;
|
||||
|
@ -187,7 +187,7 @@ private:
|
|||
const CXXRecordDecl *RD);
|
||||
|
||||
public:
|
||||
CGVtableInfo(CodeGenModule &CGM)
|
||||
CodeGenVTables(CodeGenModule &CGM)
|
||||
: CGM(CGM) { }
|
||||
|
||||
/// needsVTTParameter - Return whether the given global decl needs a VTT
|
||||
|
|
|
@ -279,7 +279,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn) {
|
|||
Args.push_back(std::make_pair(CXXThisDecl, CXXThisDecl->getType()));
|
||||
|
||||
// Check if we need a VTT parameter as well.
|
||||
if (CGVtableInfo::needsVTTParameter(GD)) {
|
||||
if (CodeGenVTables::needsVTTParameter(GD)) {
|
||||
// FIXME: The comment about using a fake decl above applies here too.
|
||||
QualType T = getContext().getPointerType(getContext().VoidPtrTy);
|
||||
CXXVTTDecl =
|
||||
|
|
|
@ -525,7 +525,7 @@ public:
|
|||
|
||||
void InitializeVtablePtrsRecursive(const CXXRecordDecl *ClassDecl,
|
||||
llvm::Constant *Vtable,
|
||||
CGVtableInfo::AddrSubMap_t& AddressPoints,
|
||||
CodeGenVTables::AddrSubMap_t& AddressPoints,
|
||||
llvm::Value *ThisPtr,
|
||||
uint64_t Offset);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
|
|||
Features(C.getLangOptions()), CodeGenOpts(CGO), TheModule(M),
|
||||
TheTargetData(TD), TheTargetCodeGenInfo(0), Diags(diags),
|
||||
Types(C, M, TD, getTargetCodeGenInfo().getABIInfo()),
|
||||
MangleCtx(C), VtableInfo(*this), Runtime(0),
|
||||
MangleCtx(C), VTables(*this), Runtime(0),
|
||||
MemCpyFn(0), MemMoveFn(0), MemSetFn(0), CFConstantStringClassRef(0),
|
||||
VMContext(M.getContext()) {
|
||||
|
||||
|
@ -495,7 +495,7 @@ void CodeGenModule::EmitDeferred() {
|
|||
if (!DeferredVtables.empty()) {
|
||||
const CXXRecordDecl *RD = DeferredVtables.back();
|
||||
DeferredVtables.pop_back();
|
||||
getVtableInfo().GenerateClassData(getVtableLinkage(RD), RD);
|
||||
getVTables().GenerateClassData(getVtableLinkage(RD), RD);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -715,7 +715,7 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) {
|
|||
"Generating code for declaration");
|
||||
|
||||
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
|
||||
getVtableInfo().MaybeEmitVtable(GD);
|
||||
getVTables().MaybeEmitVtable(GD);
|
||||
if (MD->isVirtual() && MD->isOutOfLine() &&
|
||||
(!isa<CXXDestructorDecl>(D) || GD.getDtorType() != Dtor_Base)) {
|
||||
if (isa<CXXDestructorDecl>(D)) {
|
||||
|
|
|
@ -93,8 +93,8 @@ class CodeGenModule : public BlockModule {
|
|||
CodeGenTypes Types;
|
||||
MangleContext MangleCtx;
|
||||
|
||||
/// VtableInfo - Holds information about C++ vtables.
|
||||
CGVtableInfo VtableInfo;
|
||||
/// VTables - Holds information about C++ vtables.
|
||||
CodeGenVTables VTables;
|
||||
|
||||
CGObjCRuntime* Runtime;
|
||||
CGDebugInfo* DebugInfo;
|
||||
|
@ -181,7 +181,7 @@ public:
|
|||
llvm::Module &getModule() const { return TheModule; }
|
||||
CodeGenTypes &getTypes() { return Types; }
|
||||
MangleContext &getMangleContext() { return MangleCtx; }
|
||||
CGVtableInfo &getVtableInfo() { return VtableInfo; }
|
||||
CodeGenVTables &getVTables() { return VTables; }
|
||||
Diagnostic &getDiags() const { return Diags; }
|
||||
const llvm::TargetData &getTargetData() const { return TheTargetData; }
|
||||
llvm::LLVMContext &getLLVMContext() { return VMContext; }
|
||||
|
|
Loading…
Reference in New Issue