[cfe-commits] r99250 - in /cfe/trunk/lib/CodeGen: CGCXX.cpp CGClass.cpp CGDebugInfo.cpp CGExprAgg.cpp CGExprConstant.cpp CGRTTI.cpp CGVTT.cpp CGVtable.cpp CGVtable.h CodeGenFunction.cpp CodeGenFunction.h CodeGenModule.cpp CodeGenModule.h

Anders Carlsson andersca at mac.com
Mon Mar 22 21:11:46 PDT 2010


Author: andersca
Date: Mon Mar 22 23:11:45 2010
New Revision: 99250

URL: http://llvm.org/viewvc/llvm-project?rev=99250&view=rev
Log:
Rename CGVtableInfo to CodeGenVTables in preparation of adding another VTableInfo class.

Modified:
    cfe/trunk/lib/CodeGen/CGCXX.cpp
    cfe/trunk/lib/CodeGen/CGClass.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGExprAgg.cpp
    cfe/trunk/lib/CodeGen/CGExprConstant.cpp
    cfe/trunk/lib/CodeGen/CGRTTI.cpp
    cfe/trunk/lib/CodeGen/CGVTT.cpp
    cfe/trunk/lib/CodeGen/CGVtable.cpp
    cfe/trunk/lib/CodeGen/CGVtable.h
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.h

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Mon Mar 22 23:11:45 2010
@@ -489,10 +489,10 @@
 }
 
 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 @@
 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);
 }

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Mon Mar 22 23:11:45 2010
@@ -98,7 +98,7 @@
   }
   if (VBase)
     VirtualOffset = 
-      getVtableInfo().getVirtualBaseOffsetOffset(ClassDecl, BaseClassDecl);
+      getVTables().getVirtualBaseOffsetOffset(ClassDecl, BaseClassDecl);
   
   uint64_t Offset = 
     ComputeNonVirtualBaseClassOffset(getContext(), Paths.front(), Start);
@@ -471,7 +471,7 @@
 /// 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 @@
   // 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 @@
     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 @@
   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 @@
   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 @@
     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())

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Mar 22 23:11:45 2010
@@ -608,7 +608,7 @@
     // 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 @@
     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);

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Mon Mar 22 23:11:45 2010
@@ -333,8 +333,7 @@
   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. 

Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Mon Mar 22 23:11:45 2010
@@ -417,7 +417,7 @@
     
     // 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. 

Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Mon Mar 22 23:11:45 2010
@@ -760,7 +760,7 @@
     // 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;

Modified: cfe/trunk/lib/CodeGen/CGVTT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTT.cpp?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTT.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTT.cpp Mon Mar 22 23:11:45 2010
@@ -29,7 +29,7 @@
   /// 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 @@
     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 @@
              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 @@
 }
 
 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 @@
   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 @@
   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 @@
   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 = 

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Mon Mar 22 23:11:45 2010
@@ -1092,8 +1092,8 @@
     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 @@
   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 @@
   }
 
 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 @@
           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 @@
   // 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 @@
   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 @@
   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 @@
 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 @@
     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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   }
 }
 
-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 @@
   return Vtable;
 }
 
-void CGVtableInfo::MaybeEmitVtable(GlobalDecl GD) {
+void CodeGenVTables::MaybeEmitVtable(GlobalDecl GD) {
   const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
   const CXXRecordDecl *RD = MD->getParent();
 

Modified: cfe/trunk/lib/CodeGen/CGVtable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.h?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.h (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.h Mon Mar 22 23:11:45 2010
@@ -126,7 +126,7 @@
 namespace clang {
 namespace CodeGen {
 
-class CGVtableInfo {
+class CodeGenVTables {
 public:
   typedef std::vector<std::pair<GlobalDecl, ThunkAdjustment> >
       AdjustmentVectorTy;
@@ -187,7 +187,7 @@
                                     const CXXRecordDecl *RD);
 
 public:
-  CGVtableInfo(CodeGenModule &CGM)
+  CodeGenVTables(CodeGenModule &CGM)
     : CGM(CGM) { }
 
   /// needsVTTParameter - Return whether the given global decl needs a VTT

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Mon Mar 22 23:11:45 2010
@@ -279,7 +279,7 @@
       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 = 

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Mon Mar 22 23:11:45 2010
@@ -525,7 +525,7 @@
 
   void InitializeVtablePtrsRecursive(const CXXRecordDecl *ClassDecl,
                                      llvm::Constant *Vtable,
-                                     CGVtableInfo::AddrSubMap_t& AddressPoints,
+                                    CodeGenVTables::AddrSubMap_t& AddressPoints,
                                      llvm::Value *ThisPtr,
                                      uint64_t Offset);
 

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Mar 22 23:11:45 2010
@@ -47,7 +47,7 @@
     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 @@
     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 @@
                                  "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)) {

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=99250&r1=99249&r2=99250&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Mon Mar 22 23:11:45 2010
@@ -93,8 +93,8 @@
   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 @@
   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; }





More information about the cfe-commits mailing list